mirror of
https://github.com/reactos/reactos.git
synced 2024-07-01 02:10:07 +00:00
[NTGDI][FREETYPE] Simplify IntRequestFontSize and FONTGDI
FONTGDI.lfWidth and FONTGDI.EmHeight are not used. Simplify code without setting these members. CORE-11848
This commit is contained in:
parent
476f94c0fe
commit
375b02f337
|
@ -162,9 +162,7 @@ typedef struct _FONTGDI {
|
||||||
LONG tmAscent;
|
LONG tmAscent;
|
||||||
LONG tmDescent;
|
LONG tmDescent;
|
||||||
LONG tmInternalLeading;
|
LONG tmInternalLeading;
|
||||||
LONG EmHeight;
|
|
||||||
LONG Magic;
|
LONG Magic;
|
||||||
LONG lfWidth;
|
|
||||||
LONG lfHeight;
|
LONG lfHeight;
|
||||||
} FONTGDI, *PFONTGDI;
|
} FONTGDI, *PFONTGDI;
|
||||||
|
|
||||||
|
|
|
@ -3503,14 +3503,7 @@ IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight)
|
||||||
TT_OS2 *pOS2;
|
TT_OS2 *pOS2;
|
||||||
TT_HoriHeader *pHori;
|
TT_HoriHeader *pHori;
|
||||||
FT_WinFNT_HeaderRec WinFNT;
|
FT_WinFNT_HeaderRec WinFNT;
|
||||||
LONG Ascent, Descent, Sum, EmHeight64;
|
LONG Ascent, Descent, Sum, EmHeight;
|
||||||
|
|
||||||
if (FontGDI->Magic == FONTGDI_MAGIC &&
|
|
||||||
FontGDI->lfHeight == lfHeight &&
|
|
||||||
FontGDI->lfWidth == lfWidth)
|
|
||||||
{
|
|
||||||
return 0; /* Cached */
|
|
||||||
}
|
|
||||||
|
|
||||||
lfWidth = abs(lfWidth);
|
lfWidth = abs(lfWidth);
|
||||||
if (lfHeight == 0)
|
if (lfHeight == 0)
|
||||||
|
@ -3529,6 +3522,9 @@ IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight)
|
||||||
if (lfHeight == -1)
|
if (lfHeight == -1)
|
||||||
lfHeight = -2;
|
lfHeight = -2;
|
||||||
|
|
||||||
|
if (FontGDI->Magic == FONTGDI_MAGIC && FontGDI->lfHeight == lfHeight)
|
||||||
|
return 0; /* Cached */
|
||||||
|
|
||||||
ASSERT_FREETYPE_LOCK_HELD();
|
ASSERT_FREETYPE_LOCK_HELD();
|
||||||
pOS2 = (TT_OS2 *)FT_Get_Sfnt_Table(face, FT_SFNT_OS2);
|
pOS2 = (TT_OS2 *)FT_Get_Sfnt_Table(face, FT_SFNT_OS2);
|
||||||
pHori = (TT_HoriHeader *)FT_Get_Sfnt_Table(face, FT_SFNT_HHEA);
|
pHori = (TT_HoriHeader *)FT_Get_Sfnt_Table(face, FT_SFNT_HHEA);
|
||||||
|
@ -3547,11 +3543,7 @@ IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight)
|
||||||
FontGDI->tmAscent = WinFNT.ascent;
|
FontGDI->tmAscent = WinFNT.ascent;
|
||||||
FontGDI->tmDescent = FontGDI->tmHeight - FontGDI->tmAscent;
|
FontGDI->tmDescent = FontGDI->tmHeight - FontGDI->tmAscent;
|
||||||
FontGDI->tmInternalLeading = WinFNT.internal_leading;
|
FontGDI->tmInternalLeading = WinFNT.internal_leading;
|
||||||
FontGDI->EmHeight = FontGDI->tmHeight - FontGDI->tmInternalLeading;
|
|
||||||
FontGDI->EmHeight = max(FontGDI->EmHeight, 1);
|
|
||||||
FontGDI->EmHeight = min(FontGDI->EmHeight, USHORT_MAX);
|
|
||||||
FontGDI->Magic = FONTGDI_MAGIC;
|
FontGDI->Magic = FONTGDI_MAGIC;
|
||||||
FontGDI->lfWidth = lfWidth;
|
|
||||||
FontGDI->lfHeight = lfHeight;
|
FontGDI->lfHeight = lfHeight;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -3605,18 +3597,16 @@ IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight)
|
||||||
}
|
}
|
||||||
#undef FM_SEL_USE_TYPO_METRICS
|
#undef FM_SEL_USE_TYPO_METRICS
|
||||||
|
|
||||||
FontGDI->EmHeight = FontGDI->tmHeight - FontGDI->tmInternalLeading;
|
|
||||||
FontGDI->EmHeight = max(FontGDI->EmHeight, 1);
|
|
||||||
FontGDI->EmHeight = min(FontGDI->EmHeight, USHORT_MAX);
|
|
||||||
FontGDI->Magic = FONTGDI_MAGIC;
|
FontGDI->Magic = FONTGDI_MAGIC;
|
||||||
FontGDI->lfWidth = lfWidth;
|
|
||||||
FontGDI->lfHeight = lfHeight;
|
FontGDI->lfHeight = lfHeight;
|
||||||
|
|
||||||
EmHeight64 = (FontGDI->EmHeight << 6);
|
EmHeight = FontGDI->tmHeight - FontGDI->tmInternalLeading;
|
||||||
|
EmHeight = max(EmHeight, 1);
|
||||||
|
EmHeight = min(EmHeight, USHORT_MAX);
|
||||||
|
|
||||||
req.type = FT_SIZE_REQUEST_TYPE_NOMINAL;
|
req.type = FT_SIZE_REQUEST_TYPE_NOMINAL;
|
||||||
req.width = 0;
|
req.width = 0;
|
||||||
req.height = EmHeight64;
|
req.height = (EmHeight << 6);
|
||||||
req.horiResolution = 0;
|
req.horiResolution = 0;
|
||||||
req.vertResolution = 0;
|
req.vertResolution = 0;
|
||||||
return FT_Request_Size(face, &req);
|
return FT_Request_Size(face, &req);
|
||||||
|
|
Loading…
Reference in a new issue