From The Compiler, 6 Years ago, written in Diff-output.
Embed
  1. --- src/rxvtfont.C.bukind       2007-11-30 14:36:33.000000000 +0600
  2. +++ src/rxvtfont.C      2007-11-30 14:39:29.000000000 +0600
  3. @@ -1171,12 +1171,21 @@
  4.            XGlyphInfo g;
  5.            XftTextExtents16 (disp, f, &ch, 1, &g);
  6.  
  7. +/*  
  8. + * bukind: don't use g.width as a width of a character!
  9. + * instead use g.xOff, see e.g.: http://keithp.com/~keithp/render/Xft.tutorial
  10. +
  11.            g.width -= g.x;
  12.  
  13.            int wcw = WCWIDTH (ch);
  14.            if (wcw > 0) g.width = (g.width + wcw - 1) / wcw;
  15.  
  16.            if (width    < g.width       ) width    = g.width;
  17. + */
  18. +          int wcw = WCWIDTH (ch);
  19. +          if (wcw > 1) g.xOff = g.xOff / wcw;
  20. +          if (width < g.xOff) width = g.xOff;
  21. +
  22.            if (height   < g.height      ) height   = g.height;
  23.            if (glheight < g.height - g.y) glheight = g.height - g.y;
  24.          }
  25.  
  26. @@ -1237,11 +1237,22 @@
  27.  
  28.        FT_Face face = XftLockFace (f);
  29.  
  30. +/*
  31. + * use ascent, descent and height from XftFont *f instead of FT_Face face.
  32. + * this somehow reproduces the behaviour of the line height as seen on xterm.
  33. +
  34.        ascent  = (face->size->metrics.ascender + 63) >> 6;
  35.        descent = (-face->size->metrics.descender + 63) >> 6;
  36.        height  = max (ascent + descent, (face->size->metrics.height + 63) >> 6);
  37.        width   = 0;
  38.  
  39. + */
  40. +
  41. +      ascent  = f->ascent;
  42. +      descent = f->descent;
  43. +      height  = max (ascent + descent, f->height);
  44. +      width   = 0;
  45. +
  46.        bool scalable = face->face_flags & FT_FACE_FLAG_SCALABLE;
  47.  
  48.        XftUnlockFace (f);