mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[NTGDI][FREETYPE] Optimize MatchFontNames (#4861)
Optimize MatchFontNames helper function for speed. CORE-15554
This commit is contained in:
parent
467768f766
commit
9f36a9d4a7
1 changed files with 14 additions and 12 deletions
|
@ -5154,22 +5154,17 @@ IntFontType(PFONTGDI Font)
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL
|
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;
|
NTSTATUS Status;
|
||||||
UNICODE_STRING Name1, Name2;
|
UNICODE_STRING Name2;
|
||||||
|
|
||||||
if (lfFaceName[0] == UNICODE_NULL)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
RtlInitUnicodeString(&Name1, lfFaceName);
|
|
||||||
|
|
||||||
RtlInitUnicodeString(&Name2, NULL);
|
RtlInitUnicodeString(&Name2, NULL);
|
||||||
Status = IntGetFontLocalizedName(&Name2, SharedFace, NameID, LangID);
|
Status = IntGetFontLocalizedName(&Name2, SharedFace, NameID, LangID);
|
||||||
|
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
if (RtlCompareUnicodeString(&Name1, &Name2, TRUE) == 0)
|
if (RtlCompareUnicodeString(Name1, &Name2, TRUE) == 0)
|
||||||
{
|
{
|
||||||
RtlFreeUnicodeString(&Name2);
|
RtlFreeUnicodeString(&Name2);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -5184,15 +5179,22 @@ MatchFontName(PSHARED_FACE SharedFace, LPCWSTR lfFaceName, FT_UShort NameID, FT_
|
||||||
static BOOL
|
static BOOL
|
||||||
MatchFontNames(PSHARED_FACE SharedFace, LPCWSTR lfFaceName)
|
MatchFontNames(PSHARED_FACE SharedFace, LPCWSTR lfFaceName)
|
||||||
{
|
{
|
||||||
if (MatchFontName(SharedFace, lfFaceName, TT_NAME_ID_FONT_FAMILY, LANG_ENGLISH) ||
|
UNICODE_STRING Name1;
|
||||||
MatchFontName(SharedFace, lfFaceName, TT_NAME_ID_FULL_NAME, LANG_ENGLISH))
|
|
||||||
|
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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if (PRIMARYLANGID(gusLanguageID) != LANG_ENGLISH)
|
if (PRIMARYLANGID(gusLanguageID) != LANG_ENGLISH)
|
||||||
{
|
{
|
||||||
if (MatchFontName(SharedFace, lfFaceName, TT_NAME_ID_FONT_FAMILY, gusLanguageID) ||
|
if (MatchFontName(SharedFace, &Name1, TT_NAME_ID_FONT_FAMILY, gusLanguageID) ||
|
||||||
MatchFontName(SharedFace, lfFaceName, TT_NAME_ID_FULL_NAME, gusLanguageID))
|
MatchFontName(SharedFace, &Name1, TT_NAME_ID_FULL_NAME, gusLanguageID))
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue