* Workaround for CORE-8525, CORE-6023, CORE-7735 and CORE-8635.
* Brought to you by V and Amine. Thanks to Timo and Jerome for the reviews.
CORE-8525 CORE-6023 CORE-7735 CORE-8635 #comment Please retest with r64777 or later.

svn path=/trunk/; revision=64777
This commit is contained in:
Amine Khaldi 2014-10-17 07:59:29 +00:00
parent 3fa669eddb
commit 5a93a71d04

View file

@ -2664,15 +2664,42 @@ GetFontScore(LOGFONTW *LogFont, PUNICODE_STRING FaceName, PFONTGDI FontGDI)
Status = RtlAnsiStringToUnicodeString(&EntryFaceNameW, &EntryFaceNameA, TRUE);
if (NT_SUCCESS(Status))
{
static const UNICODE_STRING MarlettFaceNameW = RTL_CONSTANT_STRING(L"Marlett");
static const UNICODE_STRING SymbolFaceNameW = RTL_CONSTANT_STRING(L"Symbol");
static const UNICODE_STRING VGAFaceNameW = RTL_CONSTANT_STRING(L"VGA");
if ((LF_FACESIZE - 1) * sizeof(WCHAR) < EntryFaceNameW.Length)
{
EntryFaceNameW.Length = (LF_FACESIZE - 1) * sizeof(WCHAR);
EntryFaceNameW.Buffer[LF_FACESIZE - 1] = L'\0';
}
if (0 == RtlCompareUnicodeString(FaceName, &EntryFaceNameW, TRUE))
if (!RtlCompareUnicodeString(FaceName, &EntryFaceNameW, TRUE))
{
Score += 49;
}
/* FIXME: this is a work around to counter weird fonts on weird places.
A proper fix would be to score fonts on more attributes than
the ones in this function */
if (!RtlCompareUnicodeString(&MarlettFaceNameW, &EntryFaceNameW, TRUE) &&
RtlCompareUnicodeString(&MarlettFaceNameW, FaceName, TRUE))
{
Score = 0;
}
if (!RtlCompareUnicodeString(&SymbolFaceNameW, &EntryFaceNameW, TRUE) &&
RtlCompareUnicodeString(&SymbolFaceNameW, FaceName, TRUE))
{
Score = 0;
}
if (!RtlCompareUnicodeString(&VGAFaceNameW, &EntryFaceNameW, TRUE) &&
RtlCompareUnicodeString(&VGAFaceNameW, FaceName, TRUE))
{
Score = 0;
}
RtlFreeUnicodeString(&EntryFaceNameW);
}