Advertisement
Guest User

font-fix.patch

a guest
Jul 20th, 2011
358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.66 KB | None | 0 0
  1. --- src/rxvtfont.C.orig 2011-07-20 22:19:29.878012201 -0300
  2. +++ src/rxvtfont.C  2011-07-20 22:19:33.634671723 -0300
  3. @@ -1237,11 +1237,22 @@
  4.  
  5.        FT_Face face = XftLockFace (f);
  6.  
  7. +/*
  8. + * use ascent, descent and height from XftFont *f instead of FT_Face face.
  9. + * this somehow reproduces the behaviour of the line height as seen on xterm.
  10. +
  11.        ascent  = (face->size->metrics.ascender + 63) >> 6;
  12.        descent = (-face->size->metrics.descender + 63) >> 6;
  13.        height  = max (ascent + descent, (face->size->metrics.height + 63) >> 6);
  14.        width   = 0;
  15.  
  16. + */
  17. +
  18. +      ascent  = f->ascent;
  19. +      descent = f->descent;
  20. +      height  = max (ascent + descent, f->height);
  21. +      width   = 0;
  22. +
  23.        bool scalable = face->face_flags & FT_FACE_FLAG_SCALABLE;
  24.  
  25.        XftUnlockFace (f);
  26. @@ -1265,6 +1276,11 @@
  27.            XGlyphInfo g;
  28.            XftTextExtents16 (disp, f, &ch, 1, &g);
  29.  
  30. +/*
  31. + * don't use g.width/g.height as width/height of a character!
  32. + * instead use g.xOff/g.yOff.
  33. + * see e.g.: http://keithp.com/~keithp/render/Xft.tutorial
  34. +
  35.            g.width -= g.x;
  36.  
  37.            int wcw = WCWIDTH (ch);
  38. @@ -1273,6 +1289,15 @@
  39.            if (width    < g.width       ) width    = g.width;
  40.            if (height   < g.height      ) height   = g.height;
  41.            if (glheight < g.height - g.y) glheight = g.height - g.y;
  42. +
  43. + */
  44. +
  45. +          int wcw = WCWIDTH (ch);
  46. +          if (wcw > 1) g.xOff = g.xOff / wcw;
  47. +
  48. +          if (width    < g.xOff      ) width    = g.xOff;
  49. +          if (height   < g.yOff      ) height   = g.yOff;
  50. +          if (glheight < g.yOff - g.y) glheight = g.yOff - g.y;
  51.          }
  52.  
  53.        if (!width)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement