mirror of
https://github.com/reactos/reactos.git
synced 2025-06-04 08:50:27 +00:00
[NTGDI][FREETYPE] Reduce font size request (#4862)
- Delete some IntRequestFontSize function calls. - Enable cache on font size requests. - Add two members into FONTGDI structure, for font size cache. CORE-15554
This commit is contained in:
parent
140aa11c36
commit
467768f766
2 changed files with 14 additions and 12 deletions
|
@ -161,6 +161,8 @@ typedef struct _FONTGDI {
|
|||
LONG tmInternalLeading;
|
||||
LONG EmHeight;
|
||||
LONG Magic;
|
||||
LONG lfWidth;
|
||||
LONG lfHeight;
|
||||
} FONTGDI, *PFONTGDI;
|
||||
|
||||
/* The initialized 'Magic' value in FONTGDI */
|
||||
|
|
|
@ -1067,9 +1067,6 @@ IntLoadSystemFonts(VOID)
|
|||
}
|
||||
}
|
||||
|
||||
static FT_Error
|
||||
IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight);
|
||||
|
||||
/* NOTE: If nIndex < 0 then return the number of charsets. */
|
||||
UINT FASTCALL IntGetCharSet(INT nIndex, FT_ULong CodePageRange1)
|
||||
{
|
||||
|
@ -1349,10 +1346,6 @@ IntGdiLoadFontsFromMemory(PGDI_LOAD_FONT pLoadFont,
|
|||
DPRINT("Num glyphs: %d\n", Face->num_glyphs);
|
||||
DPRINT("CharSet: %d\n", FontGDI->CharSet);
|
||||
|
||||
IntLockFreeType();
|
||||
IntRequestFontSize(NULL, FontGDI, 0, 0);
|
||||
IntUnLockFreeType();
|
||||
|
||||
/* Add this font resource to the font table */
|
||||
Entry->Font = FontGDI;
|
||||
Entry->NotEnum = (Characteristics & FR_NOT_ENUM);
|
||||
|
@ -3512,6 +3505,13 @@ IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight)
|
|||
FT_WinFNT_HeaderRec WinFNT;
|
||||
LONG Ascent, Descent, Sum, EmHeight64;
|
||||
|
||||
if (FontGDI->Magic == FONTGDI_MAGIC &&
|
||||
FontGDI->lfHeight == lfHeight &&
|
||||
FontGDI->lfWidth == lfWidth)
|
||||
{
|
||||
return 0; /* Cached */
|
||||
}
|
||||
|
||||
lfWidth = abs(lfWidth);
|
||||
if (lfHeight == 0)
|
||||
{
|
||||
|
@ -3550,7 +3550,9 @@ IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight)
|
|||
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;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -3607,6 +3609,8 @@ IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight)
|
|||
FontGDI->EmHeight = max(FontGDI->EmHeight, 1);
|
||||
FontGDI->EmHeight = min(FontGDI->EmHeight, USHORT_MAX);
|
||||
FontGDI->Magic = FONTGDI_MAGIC;
|
||||
FontGDI->lfWidth = lfWidth;
|
||||
FontGDI->lfHeight = lfHeight;
|
||||
|
||||
EmHeight64 = (FontGDI->EmHeight << 6);
|
||||
|
||||
|
@ -5263,10 +5267,6 @@ TextIntRealizeFont(HFONT FontHandle, PTEXTOBJ pTextObj)
|
|||
PFONTGDI FontGdi = ObjToGDI(TextObj->Font, FONT);
|
||||
PSHARED_FACE SharedFace = FontGdi->SharedFace;
|
||||
|
||||
IntLockFreeType();
|
||||
IntRequestFontSize(NULL, FontGdi, pLogFont->lfWidth, pLogFont->lfHeight);
|
||||
IntUnLockFreeType();
|
||||
|
||||
TextObj->TextFace[0] = UNICODE_NULL;
|
||||
if (MatchFontNames(SharedFace, SubstitutedLogFont.lfFaceName))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue