Index: reactos/win32ss/gdi/ntgdi/freetype.c =================================================================== --- reactos/win32ss/gdi/ntgdi/freetype.c (revision 74662) +++ reactos/win32ss/gdi/ntgdi/freetype.c (working copy) @@ -2427,10 +2427,15 @@ for (i = 0; i < InfoEntries; i++) { RtlInitUnicodeString(&InfoFaceName, Info[i].EnumLogFontEx.elfLogFont.lfFaceName); - if (RtlEqualUnicodeString(&InfoFaceName, FaceName, TRUE)) + if (RtlEqualUnicodeString(FaceName, &InfoFaceName, TRUE)) { return i; } + RtlInitUnicodeString(&InfoFaceName, Info[i].FullFaceName); + if (RtlEqualUnicodeString(FaceName, &InfoFaceName, TRUE)) + { + return i; + } } return -1; @@ -2452,22 +2457,43 @@ return FindFaceNameInInfo(FaceName, Info, InfoEntries) < 0; } +static BOOL FASTCALL +FontFamilyFound(PFONTFAMILYINFO InfoEntry, + PFONTFAMILYINFO Info, DWORD InfoCount) +{ + UNICODE_STRING Str1, Str2; + LPLOGFONTW plf1 = &InfoEntry->EnumLogFontEx.elfLogFont; + DWORD i; + + for (i = 0; i < InfoCount; ++i) + { + LPLOGFONTW plf2 = &Info[i].EnumLogFontEx.elfLogFont; + if (plf1->lfCharSet != plf2->lfCharSet) + continue; + + RtlInitUnicodeString(&Str1, InfoEntry->EnumLogFontEx.elfFullName); + RtlInitUnicodeString(&Str2, Info[i].EnumLogFontEx.elfFullName); + if (!RtlEqualUnicodeString(&Str1, &Str2, TRUE)) + continue; + return TRUE; + } + return FALSE; +} + static BOOLEAN FASTCALL GetFontFamilyInfoForList(LPLOGFONTW LogFont, PFONTFAMILYINFO Info, DWORD *Count, - DWORD Size, + DWORD MaxCount, PLIST_ENTRY Head) { PLIST_ENTRY Entry; PFONT_ENTRY CurrentEntry; - ANSI_STRING EntryFaceNameA; - UNICODE_STRING EntryFaceNameW; FONTGDI *FontGDI; - NTSTATUS status; + UNICODE_STRING LogFontFaceNameW, EntryFaceNameW, EntryFullNameW; + FONTFAMILYINFO InfoEntry; - Entry = Head->Flink; - while (Entry != Head) + for (Entry = Head->Flink; Entry != Head; Entry = Entry->Flink) { CurrentEntry = (PFONT_ENTRY) CONTAINING_RECORD(Entry, FONT_ENTRY, ListEntry); @@ -2474,30 +2500,42 @@ FontGDI = CurrentEntry->Font; ASSERT(FontGDI); - RtlInitAnsiString(&EntryFaceNameA, FontGDI->SharedFace->Face->family_name); - status = RtlAnsiStringToUnicodeString(&EntryFaceNameW, &EntryFaceNameA, TRUE); - if (!NT_SUCCESS(status)) + if (LogFont->lfCharSet != DEFAULT_CHARSET && + LogFont->lfCharSet != FontGDI->CharSet) { - return FALSE; + continue; } - if ((LF_FACESIZE - 1) * sizeof(WCHAR) < EntryFaceNameW.Length) + if (LogFont->lfFaceName[0] == UNICODE_NULL) { - EntryFaceNameW.Length = (LF_FACESIZE - 1) * sizeof(WCHAR); - EntryFaceNameW.Buffer[LF_FACESIZE - 1] = L'\0'; + if (*Count < MaxCount) + { + FontFamilyFillInfo(&Info[*Count], NULL, NULL, FontGDI); + } + (*Count)++; + continue; } - if (FontFamilyInclude(LogFont, &EntryFaceNameW, Info, min(*Count, Size))) + FontFamilyFillInfo(&InfoEntry, NULL, NULL, FontGDI); + + RtlInitUnicodeString(&LogFontFaceNameW, LogFont->lfFaceName); + RtlInitUnicodeString(&EntryFaceNameW, InfoEntry.EnumLogFontEx.elfLogFont.lfFaceName); + RtlInitUnicodeString(&EntryFullNameW, InfoEntry.EnumLogFontEx.elfFullName); + + if (!RtlEqualUnicodeString(&LogFontFaceNameW, &EntryFaceNameW, TRUE) && + !RtlEqualUnicodeString(&LogFontFaceNameW, &EntryFullNameW, TRUE)) { - if (*Count < Size) + continue; + } + + if (!FontFamilyFound(&InfoEntry, Info, min(*Count, MaxCount))) + { + if (*Count < MaxCount) { - FontFamilyFillInfo(Info + *Count, EntryFaceNameW.Buffer, - NULL, FontGDI); + RtlCopyMemory(&Info[*Count], &InfoEntry, sizeof(InfoEntry)); } (*Count)++; } - RtlFreeUnicodeString(&EntryFaceNameW); - Entry = Entry->Flink; } return TRUE; @@ -4672,18 +4710,6 @@ return TRUE; } -static VOID -IntAddNameFromFamInfo(LPWSTR psz, FONTFAMILYINFO *FamInfo) -{ - wcscat(psz, FamInfo->EnumLogFontEx.elfLogFont.lfFaceName); - if (FamInfo->EnumLogFontEx.elfStyle[0] && - _wcsicmp(FamInfo->EnumLogFontEx.elfStyle, L"Regular") != 0) - { - wcscat(psz, L" "); - wcscat(psz, FamInfo->EnumLogFontEx.elfStyle); - } -} - BOOL FASTCALL IntGdiGetFontResourceInfo( @@ -4814,21 +4840,11 @@ case 1: /* copy the font title */ /* calculate the required size */ Size = 0; - Size += wcslen(FamInfo[0].EnumLogFontEx.elfLogFont.lfFaceName); - if (FamInfo[0].EnumLogFontEx.elfStyle[0] && - _wcsicmp(FamInfo[0].EnumLogFontEx.elfStyle, L"Regular") != 0) - { - Size += 1 + wcslen(FamInfo[0].EnumLogFontEx.elfStyle); - } + Size += wcslen(FamInfo[0].FullFaceName); for (i = 1; i < Count; ++i) { Size += 3; /* " & " */ - Size += wcslen(FamInfo[i].EnumLogFontEx.elfLogFont.lfFaceName); - if (FamInfo[i].EnumLogFontEx.elfStyle[0] && - _wcsicmp(FamInfo[i].EnumLogFontEx.elfStyle, L"Regular") != 0) - { - Size += 1 + wcslen(FamInfo[i].EnumLogFontEx.elfStyle); - } + Size += wcslen(FamInfo[i].FullFaceName); } Size += 2; /* "\0\0" */ Size *= sizeof(WCHAR); @@ -4845,11 +4861,11 @@ /* store font title to buffer */ WCHAR *psz = pBuffer; *psz = 0; - IntAddNameFromFamInfo(psz, &FamInfo[0]); + wcscat(psz, FamInfo[0].FullFaceName); for (i = 1; i < Count; ++i) { wcscat(psz, L" & "); - IntAddNameFromFamInfo(psz, &FamInfo[i]); + wcscat(psz, FamInfo[i].FullFaceName); } psz[wcslen(psz) + 1] = UNICODE_NULL; *pdwBytes = Size; Index: reactos/win32ss/include/ntgdibad.h =================================================================== --- reactos/win32ss/include/ntgdibad.h (revision 74662) +++ reactos/win32ss/include/ntgdibad.h (working copy) @@ -47,6 +47,7 @@ ENUMLOGFONTEXW EnumLogFontEx; NEWTEXTMETRICEXW NewTextMetricEx; DWORD FontType; + WCHAR FullFaceName[LF_FULLFACESIZE]; } FONTFAMILYINFO, *PFONTFAMILYINFO; /* Should be using NtGdiEnumFontChunk */