[ros-diffs] [tkreuzer] 53297: [GDI FONT DRIVER] - Calculate fxMaxAscender/fcMaxDescender from the font bounding box, instead of the WinAscender/WinDescender values - Round these values to 16 (pixel accuracy), ...

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Thu Aug 18 13:09:40 UTC 2011


Author: tkreuzer
Date: Thu Aug 18 13:09:36 2011
New Revision: 53297

URL: http://svn.reactos.org/svn/reactos?rev=53297&view=rev
Log:
[GDI FONT DRIVER]
- Calculate fxMaxAscender/fcMaxDescender from the font bounding box, instead of the WinAscender/WinDescender values
- Round these values to 16 (pixel accuracy), which fixes inconsistent height of marked text and the rest of the row in list boxes. This is most likely a Windows rounding bug.

Modified:
    branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/glyph.c

Modified: branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/glyph.c
URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/glyph.c?rev=53297&r1=53296&r2=53297&view=diff
==============================================================================
--- branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/glyph.c [iso-8859-1] (original)
+++ branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/glyph.c [iso-8859-1] Thu Aug 18 13:09:36 2011
@@ -152,17 +152,17 @@
 
     /* Calculate maximum ascender and descender */
     efTemp = efScaleY;
-    FLOATOBJ_MulLong(&efTemp, pface->ifiex.ifi.fwdWinAscender << 4);
+    FLOATOBJ_MulLong(&efTemp, ftface->bbox.yMax << 4);
     pfont->metrics.fxMaxAscender = FLOATOBJ_GetLong(&efTemp);
     efTemp = efScaleY;
-    FLOATOBJ_MulLong(&efTemp, pface->ifiex.ifi.fwdWinDescender << 4);
+    FLOATOBJ_MulLong(&efTemp, (-ftface->bbox.yMin) << 4);
     pfont->metrics.fxMaxDescender = FLOATOBJ_GetLong(&efTemp);
 
     /* The coordinate transformation given by Windows transforms from font
      * space to device space. Since we use FT_Set_Char_Size, which allows
      * higher precision than FT_Set_Pixel_Sizes, we need to convert into
-     * points. So we multiply our scaling coefficients with 72 divided by
-     * the device resolution. We also need a 26.6 fixpoint value, so we
+     * points. So we multiply our scaling coefficients with 72 and divide
+     * by the device resolution. We also need a 26.6 fixpoint value, so we
      * multiply with 64. */
     FLOATOBJ_MulLong(&efScaleX, 64 * pface->ifiex.ifi.fwdUnitsPerEm * 72);
     FLOATOBJ_DivLong(&efScaleX, pfo->sizLogResPpi.cx);
@@ -386,8 +386,8 @@
         }
 
         /* Copy some values from the font structure */
-        pfddm->fxMaxAscender = pfont->metrics.fxMaxAscender;
-        pfddm->fxMaxDescender = pfont->metrics.fxMaxDescender;
+        pfddm->fxMaxAscender = (pfont->metrics.fxMaxAscender + 15) & ~0x0f;
+        pfddm->fxMaxDescender = (pfont->metrics.fxMaxDescender + 15) & ~0x0f;
         pfddm->ptlUnderline1 = pfont->metrics.ptlUnderline1;
         pfddm->ptlStrikeout = pfont->metrics.ptlStrikeout;
         pfddm->ptlULThickness = pfont->metrics.ptlULThickness;
@@ -606,11 +606,9 @@
             }
 
             /* Return the size for a bitmap at least 1x1 pixels */
-            cx = pfont->ftface->glyph->bitmap.width;
-            cy = pfont->ftface->glyph->bitmap.rows;
-            return GLYPHBITS_SIZE(cx > 0 ? cx : 1,
-                                  cy > 0 ? cy : 1,
-                                  pfont->jBpp);
+            cx = max(1, pfont->ftface->glyph->bitmap.width);
+            cy = max(1, pfont->ftface->glyph->bitmap.rows);
+            return GLYPHBITS_SIZE(cx, cy, pfont->jBpp);
 
         case QFD_GLYPHANDOUTLINE:
             TRACE("QFD_GLYPHANDOUTLINE\n");




More information about the Ros-diffs mailing list