[NTGDI][FREETYPE] lfWidth for GetTextExtentPoint32 (#4912)

- Apply LOGFONT.lfWidth in TextIntGetTextExtentPoint function.
- Delete XFORM transformation in TextIntGetTextExtentPoint (to be simply ignored).
CORE-11848
This commit is contained in:
Katayama Hirofumi MZ 2022-11-28 07:34:58 +09:00 committed by GitHub
parent 991e2bd45b
commit b85f0056a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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