mirror of
https://github.com/reactos/reactos.git
synced 2024-11-27 05:23:33 +08:00
[NTGDI][FREETYPE] Optimize MatchFontNames (#4861)
Optimize MatchFontNames helper function for speed. CORE-15554
This commit is contained in:
parent
467768f766
commit
9f36a9d4a7
@ -5154,22 +5154,17 @@ IntFontType(PFONTGDI Font)
|
||||
}
|
||||
|
||||
static BOOL
|
||||
MatchFontName(PSHARED_FACE SharedFace, LPCWSTR lfFaceName, FT_UShort NameID, FT_UShort LangID)
|
||||
MatchFontName(PSHARED_FACE SharedFace, PUNICODE_STRING Name1, FT_UShort NameID, FT_UShort LangID)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
UNICODE_STRING Name1, Name2;
|
||||
|
||||
if (lfFaceName[0] == UNICODE_NULL)
|
||||
return FALSE;
|
||||
|
||||
RtlInitUnicodeString(&Name1, lfFaceName);
|
||||
UNICODE_STRING Name2;
|
||||
|
||||
RtlInitUnicodeString(&Name2, NULL);
|
||||
Status = IntGetFontLocalizedName(&Name2, SharedFace, NameID, LangID);
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
if (RtlCompareUnicodeString(&Name1, &Name2, TRUE) == 0)
|
||||
if (RtlCompareUnicodeString(Name1, &Name2, TRUE) == 0)
|
||||
{
|
||||
RtlFreeUnicodeString(&Name2);
|
||||
return TRUE;
|
||||
@ -5184,15 +5179,22 @@ MatchFontName(PSHARED_FACE SharedFace, LPCWSTR lfFaceName, FT_UShort NameID, FT_
|
||||
static BOOL
|
||||
MatchFontNames(PSHARED_FACE SharedFace, LPCWSTR lfFaceName)
|
||||
{
|
||||
if (MatchFontName(SharedFace, lfFaceName, TT_NAME_ID_FONT_FAMILY, LANG_ENGLISH) ||
|
||||
MatchFontName(SharedFace, lfFaceName, TT_NAME_ID_FULL_NAME, LANG_ENGLISH))
|
||||
UNICODE_STRING Name1;
|
||||
|
||||
if (lfFaceName[0] == UNICODE_NULL)
|
||||
return FALSE;
|
||||
|
||||
RtlInitUnicodeString(&Name1, lfFaceName);
|
||||
|
||||
if (MatchFontName(SharedFace, &Name1, TT_NAME_ID_FONT_FAMILY, LANG_ENGLISH) ||
|
||||
MatchFontName(SharedFace, &Name1, TT_NAME_ID_FULL_NAME, LANG_ENGLISH))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
if (PRIMARYLANGID(gusLanguageID) != LANG_ENGLISH)
|
||||
{
|
||||
if (MatchFontName(SharedFace, lfFaceName, TT_NAME_ID_FONT_FAMILY, gusLanguageID) ||
|
||||
MatchFontName(SharedFace, lfFaceName, TT_NAME_ID_FULL_NAME, gusLanguageID))
|
||||
if (MatchFontName(SharedFace, &Name1, TT_NAME_ID_FONT_FAMILY, gusLanguageID) ||
|
||||
MatchFontName(SharedFace, &Name1, TT_NAME_ID_FULL_NAME, gusLanguageID))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user