Author: rharabien
Date: Fri Apr 15 20:03:44 2011
New Revision: 51356

URL: http://svn.reactos.org/svn/reactos?rev=51356&view=rev
Log:
[WIN32K]
* Revert part of 37148. One FontGDI is used for fonts with different sizes. Do 
not cache font metrics then and instead calculate them every time when needed. 
It fixes spacing in menus if some application uses default GUI font with size 
other than 11.
See issue #4106 for more details.

Modified:
    trunk/reactos/subsystems/win32/win32k/include/engobjects.h
    trunk/reactos/subsystems/win32/win32k/objects/freetype.c

Modified: trunk/reactos/subsystems/win32/win32k/include/engobjects.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/engobjects.h?rev=51356&r1=51355&r2=51356&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/engobjects.h [iso-8859-1] 
(original)
+++ trunk/reactos/subsystems/win32/win32k/include/engobjects.h [iso-8859-1] Fri 
Apr 15 20:03:44 2011
@@ -88,9 +88,6 @@
   ULONG Dummy;
 } FLOATGDI;
 
-
-#define FDM_TYPE_TEXT_METRIC  0x80000000
-
 typedef struct _FONTGDI {
   FONTOBJ     FontObj;
   ULONG       iUnique;
@@ -99,13 +96,11 @@
   DHPDEV      dhpdev;
   FT_Face     face;
   };
-  FLONG       flRealizedType;
 
   LONG        lMaxNegA;
   LONG        lMaxNegC;
   LONG        lMinWidthD;
 
-  TEXTMETRICW TextMetric;
   LPWSTR      Filename;
   BYTE        Underline;
   BYTE        StrikeOut;

Modified: trunk/reactos/subsystems/win32/win32k/objects/freetype.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/freetype.c?rev=51356&r1=51355&r2=51356&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/freetype.c [iso-8859-1] 
(original)
+++ trunk/reactos/subsystems/win32/win32k/objects/freetype.c [iso-8859-1] Fri 
Apr 15 20:03:44 2011
@@ -302,9 +302,6 @@
     PSECTION_OBJECT SectionObject;
     ULONG ViewSize = 0;
     LARGE_INTEGER SectionSize;
-#if 0 // Wine code
-    FT_Fixed XScale, YScale;
-#endif
     UNICODE_STRING FontRegPath = 
RTL_CONSTANT_STRING(L"\\REGISTRY\\Machine\\Software\\Microsoft\\Windows 
NT\\CurrentVersion\\Fonts");
 
     /* Open the font file */
@@ -395,22 +392,6 @@
     RtlCopyMemory(FontGDI->Filename, FileName->Buffer, FileName->Length);
     FontGDI->Filename[FileName->Length / sizeof(WCHAR)] = L'\0';
     FontGDI->face = Face;
-
-    /* FIXME: Complete text metrics */
-#if 0 /* This (Wine) code doesn't seem to work correctly for us */
-    XScale = Face->size->metrics.x_scale;
-    YScale = Face->size->metrics.y_scale;
-    FontGDI->TextMetric.tmAscent =  (FT_MulFix(Face->ascender, YScale) + 32) 
>> 6;
-    FontGDI->TextMetric.tmDescent = (FT_MulFix(Face->descender, YScale) + 32) 
>> 6;
-    FontGDI->TextMetric.tmHeight =  (FT_MulFix(Face->ascender, YScale) -
-                                     FT_MulFix(Face->descender, YScale)) >> 6;
-#else
-    FontGDI->TextMetric.tmAscent  = (Face->size->metrics.ascender + 32) >> 6; 
/* units above baseline */
-    FontGDI->TextMetric.tmDescent = (32 - Face->size->metrics.descender) >> 6; 
/* units below baseline */
-    FontGDI->TextMetric.tmHeight = (Face->size->metrics.ascender - 
Face->size->metrics.descender) >> 6;
-#endif
-
-
 
     DPRINT("Font loaded: %s (%s)\n", Face->family_name, Face->style_name);
     DPRINT("Num glyphs: %u\n", Face->num_glyphs);
@@ -856,14 +837,7 @@
 
     Otm->otmSize = Needed;
 
-//  FillTM(&Otm->otmTextMetrics, FontGDI, pOS2, pHori, !Error ? &Win : 0);
-    if (!(FontGDI->flRealizedType & FDM_TYPE_TEXT_METRIC))
-    {
-        FillTM(&FontGDI->TextMetric, FontGDI, pOS2, pHori, !Error ? &Win : 0);
-        FontGDI->flRealizedType |= FDM_TYPE_TEXT_METRIC;
-    }
-
-    RtlCopyMemory(&Otm->otmTextMetrics, &FontGDI->TextMetric, 
sizeof(TEXTMETRICW));
+    FillTM(&Otm->otmTextMetrics, FontGDI, pOS2, pHori, !Error ? &Win : 0);
 
     Otm->otmFiller = 0;
     RtlCopyMemory(&Otm->otmPanoseNumber, pOS2->panose, PANOSE_COUNT);
@@ -882,8 +856,8 @@
     Otm->otmrcFontBox.right = (FT_MulFix(FontGDI->face->bbox.xMax, XScale) + 
32) >> 6;
     Otm->otmrcFontBox.top = (FT_MulFix(FontGDI->face->bbox.yMax, YScale) + 32) 
>> 6;
     Otm->otmrcFontBox.bottom = (FT_MulFix(FontGDI->face->bbox.yMin, YScale) + 
32) >> 6;
-    Otm->otmMacAscent = FontGDI->TextMetric.tmAscent;
-    Otm->otmMacDescent = -FontGDI->TextMetric.tmDescent;
+    Otm->otmMacAscent = Otm->otmTextMetrics.tmAscent;
+    Otm->otmMacDescent = -Otm->otmTextMetrics.tmDescent;
     Otm->otmMacLineGap = Otm->otmLineGap;
     Otm->otmusMinimumPPEM = 0; /* TT Header */
     Otm->otmptSubscriptSize.x = (FT_MulFix(pOS2->ySubscriptXSize, XScale) + 
32) >> 6;
@@ -2512,13 +2486,8 @@
 
             if (NT_SUCCESS(Status))
             {
-                if (!(FontGDI->flRealizedType & FDM_TYPE_TEXT_METRIC))
-                {
-                    FillTM(&FontGDI->TextMetric, FontGDI, pOS2, pHori, !Error 
? &Win : 0);
-                    FontGDI->flRealizedType |= FDM_TYPE_TEXT_METRIC;
-                }
-
-                RtlCopyMemory(&ptmwi->TextMetric, &FontGDI->TextMetric, 
sizeof(TEXTMETRICW));
+                FillTM(&ptmwi->TextMetric, FontGDI, pOS2, pHori, !Error ? &Win 
: 0);
+
                 /* FIXME: Fill Diff member */
                 RtlZeroMemory(&ptmwi->Diff, sizeof(ptmwi->Diff));
             }
@@ -2814,7 +2783,6 @@
         TextObj->Font->iUniq = 1; // Now it can be cached.
         IntFontType(FontGdi);
         FontGdi->flType = TextObj->Font->flFontType;
-        FontGdi->flRealizedType = 0;
         FontGdi->Underline = 
TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfUnderline ? 0xff : 0;
         FontGdi->StrikeOut = 
TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfStrikeOut ? 0xff : 0;
         TextObj->fl |= TEXTOBJECT_INIT;


Reply via email to