https://git.reactos.org/?p=reactos.git;a=commitdiff;h=88ddb37acba00219eda08593b1c9773bb4c86f39

commit 88ddb37acba00219eda08593b1c9773bb4c86f39
Author:     Katayama Hirofumi MZ <[email protected]>
AuthorDate: Wed Dec 5 21:05:42 2018 +0900
Commit:     GitHub <[email protected]>
CommitDate: Wed Dec 5 21:05:42 2018 +0900

    [WIN32SS][FONT] Use HHEA table metrics if (fsSelection & 0x80) (#1093)
    
    This PR will fix too tiny glyph rendering. CORE-15166
---
 win32ss/gdi/ntgdi/freetype.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/win32ss/gdi/ntgdi/freetype.c b/win32ss/gdi/ntgdi/freetype.c
index dd5e0064a5..e07606ab52 100644
--- a/win32ss/gdi/ntgdi/freetype.c
+++ b/win32ss/gdi/ntgdi/freetype.c
@@ -3317,11 +3317,13 @@ IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG 
lfWidth, LONG lfHeight)
         return FT_Request_Size(face, &req);
     }
 
+    /* See also: 
https://docs.microsoft.com/en-us/typography/opentype/spec/os2#fsselection */
+#define FM_SEL_USE_TYPO_METRICS 0x80
     if (lfHeight > 0)
     {
         /* case (A): lfHeight is positive */
         Sum = pOS2->usWinAscent + pOS2->usWinDescent;
-        if (Sum == 0)
+        if (Sum == 0 || (pOS2->fsSelection & FM_SEL_USE_TYPO_METRICS))
         {
             Ascent = pHori->Ascender;
             Descent = -pHori->Descender;
@@ -3341,11 +3343,20 @@ IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG 
lfWidth, LONG lfHeight)
     else if (lfHeight < 0)
     {
         /* case (B): lfHeight is negative */
-        FontGDI->tmAscent = FT_MulDiv(-lfHeight, pOS2->usWinAscent, 
face->units_per_EM);
-        FontGDI->tmDescent = FT_MulDiv(-lfHeight, pOS2->usWinDescent, 
face->units_per_EM);
+        if (pOS2->fsSelection & FM_SEL_USE_TYPO_METRICS)
+        {
+            FontGDI->tmAscent = FT_MulDiv(-lfHeight, pHori->Ascender, 
face->units_per_EM);
+            FontGDI->tmDescent = FT_MulDiv(-lfHeight, -pHori->Descender, 
face->units_per_EM);
+        }
+        else
+        {
+            FontGDI->tmAscent = FT_MulDiv(-lfHeight, pOS2->usWinAscent, 
face->units_per_EM);
+            FontGDI->tmDescent = FT_MulDiv(-lfHeight, pOS2->usWinDescent, 
face->units_per_EM);
+        }
         FontGDI->tmHeight = FontGDI->tmAscent + FontGDI->tmDescent;
         FontGDI->tmInternalLeading = FontGDI->tmHeight + lfHeight;
     }
+#undef FM_SEL_USE_TYPO_METRICS
 
     FontGDI->EmHeight = FontGDI->tmHeight - FontGDI->tmInternalLeading;
     FontGDI->EmHeight = max(FontGDI->EmHeight, 1);

Reply via email to