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

commit b85f0056a843d887f3427dd5a3da046fc0a6cdab
Author:     Katayama Hirofumi MZ <[email protected]>
AuthorDate: Mon Nov 28 07:34:58 2022 +0900
Commit:     GitHub <[email protected]>
CommitDate: Mon Nov 28 07:34:58 2022 +0900

    [NTGDI][FREETYPE] lfWidth for GetTextExtentPoint32 (#4912)
    
    - Apply LOGFONT.lfWidth in TextIntGetTextExtentPoint function.
    - Delete XFORM transformation in TextIntGetTextExtentPoint (to be simply 
ignored).
    CORE-11848
---
 win32ss/gdi/ntgdi/freetype.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/win32ss/gdi/ntgdi/freetype.c b/win32ss/gdi/ntgdi/freetype.c
index 7780ced82ae..1156684c40f 100644
--- a/win32ss/gdi/ntgdi/freetype.c
+++ b/win32ss/gdi/ntgdi/freetype.c
@@ -703,7 +703,7 @@ InitFontSupport(VOID)
     return TRUE;
 }
 
-LONG FASTCALL IntWidthMatrix(FT_Face face, FT_Matrix *pmat, LONG lfWidth)
+static LONG FASTCALL IntWidthMatrix(FT_Face face, FT_Matrix *pmat, LONG 
lfWidth)
 {
     LONG tmAveCharWidth;
     TT_OS2 *pOS2;
@@ -4276,7 +4276,6 @@ TextIntGetTextExtentPoint(PDC dc,
     FT_BitmapGlyph realglyph;
     INT glyph_index, i, previous;
     ULONGLONG TotalWidth64 = 0;
-    PMATRIX pmxWorldToDevice;
     LOGFONTW *plf;
     BOOL use_kerning;
     LONG ascender, descender;
@@ -4296,7 +4295,6 @@ TextIntGetTextExtentPoint(PDC dc,
 
     plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
     Cache.lfHeight = plf->lfHeight;
-
     Cache.Aspect.Emu.Bold = EMUBOLD_NEEDED(FontGDI->OriginalWeight, 
plf->lfWeight);
     Cache.Aspect.Emu.Italic = (plf->lfItalic && !FontGDI->OriginalItalic);
 
@@ -4305,9 +4303,12 @@ TextIntGetTextExtentPoint(PDC dc,
     else
         Cache.Aspect.RenderMode = (BYTE)FT_RENDER_MODE_MONO;
 
-    /* Get the DC's world-to-device transformation matrix */
-    pmxWorldToDevice = DC_pmxWorldToDevice(dc);
-    FtMatrixFromMx(&Cache.matTransform, pmxWorldToDevice);
+    // NOTE: GetTextExtentPoint32 simply ignores lfEscapement and XFORM.
+    if (FT_IS_SCALABLE(Cache.Face) && plf->lfWidth != 0)
+        IntWidthMatrix(Cache.Face, &Cache.matTransform, plf->lfWidth);
+    else
+        Cache.matTransform = identityMat;
+
     FT_Set_Transform(Cache.Face, &Cache.matTransform, 0);
 
     use_kerning = FT_HAS_KERNING(Cache.Face);
@@ -4336,6 +4337,7 @@ TextIntGetTextExtentPoint(PDC dc,
         {
             *Fit = i + 1;
         }
+
         if (NULL != Dx)
         {
             Dx[i] = (TotalWidth64 + 32) >> 6;

Reply via email to