]> git.pld-linux.org Git - packages/firefox.git/blob - mozilla-firefox-pango-cairo.patch
- deep park
[packages/firefox.git] / mozilla-firefox-pango-cairo.patch
1 --- mozilla/gfx/src/gtk/nsFontMetricsPango.cpp.foo2     2005-06-20 13:12:24.000000000 -0400
2 +++ mozilla/gfx/src/gtk/nsFontMetricsPango.cpp  2005-06-20 10:16:59.000000000 -0400
3 @@ -53,7 +53,6 @@
4  #include "nsUnicharUtils.h"
5  #include "nsQuickSort.h"
6  
7 -#include <pango/pangoxft.h>
8  #include <fontconfig/fontconfig.h>
9  #include <gdk/gdk.h>
10  #include <gdk/gdkx.h>
11 @@ -301,12 +300,11 @@
12  
13      // Get our font face
14      FT_Face face;
15 +    face = pango_fc_font_lock_face(fcfont);
16 +    if (!face)
17 +       return NS_ERROR_NOT_AVAILABLE;
18 +       
19      TT_OS2 *os2;
20 -    XftFont *xftFont = pango_xft_font_get_font(PANGO_FONT(fcfont));
21 -    if (!xftFont)
22 -        return NS_ERROR_NOT_AVAILABLE;
23 -
24 -    face = XftLockFace(xftFont);
25      os2 = (TT_OS2 *) FT_Get_Sfnt_Table(face, ft_sfnt_os2);
26  
27      // mEmHeight (size in pixels of EM height)
28 @@ -318,10 +316,12 @@
29      mEmHeight = PR_MAX(1, nscoord(size * f));
30  
31      // mMaxAscent
32 -    mMaxAscent = nscoord(xftFont->ascent * f);
33 +    val = MOZ_FT_TRUNC(face->size->metrics.ascender);
34 +    mMaxAscent = NSToIntRound(val * f);
35  
36      // mMaxDescent
37 -    mMaxDescent = nscoord(xftFont->descent * f);
38 +    val = -MOZ_FT_TRUNC(face->size->metrics.descender);
39 +    mMaxDescent = NSToIntRound(val * f);
40  
41      nscoord lineHeight = mMaxAscent + mMaxDescent;
42  
43 @@ -341,7 +341,8 @@
44      mEmDescent = mEmHeight - mEmAscent;
45  
46      // mMaxAdvance
47 -    mMaxAdvance = nscoord(xftFont->max_advance_width * f);
48 +    val = MOZ_FT_TRUNC(face->size->metrics.max_advance);
49 +    mMaxAdvance = NSToIntRound(val * f);
50  
51      // mPangoSpaceWidth
52      PangoLayout *layout = pango_layout_new(mPangoContext);
53 @@ -364,17 +365,16 @@
54      mAveCharWidth = tmpWidth;
55  
56      // mXHeight (height of an 'x' character)
57 -    PRUnichar xUnichar('x');
58 -    XGlyphInfo extents;
59 -    if (FcCharSetHasChar(xftFont->charset, xUnichar)) {
60 -        XftTextExtents16(GDK_DISPLAY(), xftFont, &xUnichar, 1, &extents);
61 -        mXHeight = extents.height;
62 +    if (pango_fc_font_has_char(fcfont, 'x')) {
63 +        PangoRectangle rect;
64 +        PangoGlyph glyph = pango_fc_font_get_glyph (fcfont, 'x');
65 +        pango_font_get_glyph_extents (PANGO_FONT (fcfont), glyph, &rect, NULL);
66 +        mXHeight = NSToIntRound(rect.height * f / PANGO_SCALE);
67      }
68      else {
69          // 56% of ascent, best guess for non-true type or asian fonts
70 -        mXHeight = nscoord(((float)mMaxAscent) * 0.56);
71 +        mXHeight = nscoord(((float)mMaxAscent) * 0.56 * f);
72      }
73 -    mXHeight = nscoord(mXHeight * f);
74  
75      // mUnderlineOffset (offset for underlines)
76      val = CONVERT_DESIGN_UNITS_TO_PIXELS(face->underline_position,
77 @@ -384,7 +394,8 @@
78      }
79      else {
80          mUnderlineOffset =
81 -            -NSToIntRound(PR_MAX(1, floor(0.1 * xftFont->height + 0.5)) * f);
82 +            -NSToIntRound(PR_MAX(1, floor(0.1 *
83 +                MOZ_FT_TRUNC(face->size->metrics.height) + 0.5)) * f);
84      }
85  
86      // mUnderlineSize (thickness of an underline)
87 @@ -395,7 +406,8 @@
88      }
89      else {
90          mUnderlineSize =
91 -            NSToIntRound(PR_MAX(1, floor(0.05 * xftFont->height + 0.5)) * f);
92 +            NSToIntRound(PR_MAX(1,
93 +               floor(0.05 * MOZ_FT_TRUNC(face->size->metrics.height) + 0.5)) * f);
94      }
95  
96      // mSuperscriptOffset
97 @@ -426,7 +438,7 @@
98      // mStrikeoutSize
99      mStrikeoutSize = mUnderlineSize;
100  
101 -    XftUnlockFace(xftFont);
102 +    pango_fc_font_unlock_face(fcfont);
103  
104      /*
105      printf("%i\n", mXHeight);
106 @@ -893,7 +905,7 @@
107  {
108      if (aIsRTL) {
109          if (!mRTLPangoContext) {
110 -            mRTLPangoContext = pango_xft_get_context(GDK_DISPLAY(), 0);
111 +            mRTLPangoContext = gdk_pango_context_get();
112              pango_context_set_base_dir(mRTLPangoContext, PANGO_DIRECTION_RTL);
113  
114              gdk_pango_context_set_colormap(mRTLPangoContext, gdk_rgb_get_cmap());
115 @@ -1163,7 +1175,7 @@
116      NS_ConvertUCS2toUTF8 name(aName);
117  
118      nsresult rv = NS_ERROR_FAILURE;
119 -    PangoContext *context = pango_xft_get_context(GDK_DISPLAY(), 0);
120 +    PangoContext *context = gdk_pango_context_get();
121      PangoFontFamily **familyList;
122      int n;
123  
124 @@ -1262,7 +1274,7 @@
125  
126      // Now that we have the font description set up, create the
127      // context.
128 -    mLTRPangoContext = pango_xft_get_context(GDK_DISPLAY(), 0);
129 +    mLTRPangoContext = gdk_pango_context_get();
130      mPangoContext = mLTRPangoContext;
131  
132      // Make sure to set the base direction to LTR - if layout needs to
This page took 0.046558 seconds and 4 git commands to generate.