[WIN32SS] Add full name support in FontFamilyFillInfo. Patch by Katayama Hirofumi MZ. CORE-10876

svn path=/trunk/; revision=74353
This commit is contained in:
Mark Jansen 2017-04-17 16:08:38 +00:00
parent 7a5cfecf02
commit 4923220ed0

View file

@ -2090,7 +2090,8 @@ IntGetFontLocalizedName(PUNICODE_STRING pNameW, FT_Face Face,
/* Convert UTF-16 big endian to little endian */ /* Convert UTF-16 big endian to little endian */
SwapEndian(Buf, Name.string_len); SwapEndian(Buf, Name.string_len);
Status = RtlCreateUnicodeString(pNameW, Buf); RtlCreateUnicodeString(pNameW, Buf);
Status = STATUS_SUCCESS;
break; break;
} }
@ -2111,7 +2112,8 @@ IntGetFontLocalizedName(PUNICODE_STRING pNameW, FT_Face Face,
} }
static void FASTCALL static void FASTCALL
FontFamilyFillInfo(PFONTFAMILYINFO Info, PCWSTR FaceName, PFONTGDI FontGDI) FontFamilyFillInfo(PFONTFAMILYINFO Info, LPCWSTR FaceName,
LPCWSTR FullName, PFONTGDI FontGDI)
{ {
ANSI_STRING StyleA; ANSI_STRING StyleA;
UNICODE_STRING StyleW; UNICODE_STRING StyleW;
@ -2126,7 +2128,9 @@ FontFamilyFillInfo(PFONTFAMILYINFO Info, PCWSTR FaceName, PFONTGDI FontGDI)
DWORD fs0; DWORD fs0;
NTSTATUS status; NTSTATUS status;
FT_Face Face = FontGDI->SharedFace->Face; FT_Face Face = FontGDI->SharedFace->Face;
UNICODE_STRING NameW;
RtlInitUnicodeString(&NameW, NULL);
RtlZeroMemory(Info, sizeof(FONTFAMILYINFO)); RtlZeroMemory(Info, sizeof(FONTFAMILYINFO));
Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL); Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL);
Otm = ExAllocatePoolWithTag(PagedPool, Size, GDITAG_TEXT); Otm = ExAllocatePoolWithTag(PagedPool, Size, GDITAG_TEXT);
@ -2189,28 +2193,37 @@ FontFamilyFillInfo(PFONTFAMILYINFO Info, PCWSTR FaceName, PFONTGDI FontGDI)
ExFreePoolWithTag(Otm, GDITAG_TEXT); ExFreePoolWithTag(Otm, GDITAG_TEXT);
/* face name */ /* face name */
/* TODO: full name */
if (FaceName) if (FaceName)
{ {
RtlStringCbCopyW(Info->EnumLogFontEx.elfLogFont.lfFaceName, RtlStringCbCopyW(Lf->lfFaceName, sizeof(Lf->lfFaceName), FaceName);
sizeof(Info->EnumLogFontEx.elfLogFont.lfFaceName),
FaceName);
RtlStringCbCopyW(Info->EnumLogFontEx.elfFullName,
sizeof(Info->EnumLogFontEx.elfFullName),
FaceName);
} }
else else
{ {
UNICODE_STRING NameW;
RtlInitUnicodeString(&NameW, NULL);
status = IntGetFontLocalizedName(&NameW, Face, TT_NAME_ID_FONT_FAMILY, status = IntGetFontLocalizedName(&NameW, Face, TT_NAME_ID_FONT_FAMILY,
gusLanguageID); gusLanguageID);
if (NT_SUCCESS(status)) if (NT_SUCCESS(status))
{ {
/* store it */ /* store it */
RtlStringCbCopyW(Info->EnumLogFontEx.elfLogFont.lfFaceName, RtlStringCbCopyW(Lf->lfFaceName, sizeof(Lf->lfFaceName),
sizeof(Info->EnumLogFontEx.elfLogFont.lfFaceName),
NameW.Buffer); NameW.Buffer);
RtlFreeUnicodeString(&NameW);
}
}
/* full name */
if (FullName)
{
RtlStringCbCopyW(Info->EnumLogFontEx.elfFullName,
sizeof(Info->EnumLogFontEx.elfFullName),
FullName);
}
else
{
status = IntGetFontLocalizedName(&NameW, Face, TT_NAME_ID_FULL_NAME,
gusLanguageID);
if (NT_SUCCESS(status))
{
/* store it */
RtlStringCbCopyW(Info->EnumLogFontEx.elfFullName, RtlStringCbCopyW(Info->EnumLogFontEx.elfFullName,
sizeof(Info->EnumLogFontEx.elfFullName), sizeof(Info->EnumLogFontEx.elfFullName),
NameW.Buffer); NameW.Buffer);
@ -2371,7 +2384,8 @@ GetFontFamilyInfoForList(LPLOGFONTW LogFont,
{ {
if (*Count < Size) if (*Count < Size)
{ {
FontFamilyFillInfo(Info + *Count, EntryFaceNameW.Buffer, FontGDI); FontFamilyFillInfo(Info + *Count, EntryFaceNameW.Buffer,
NULL, FontGDI);
} }
(*Count)++; (*Count)++;
} }
@ -2442,7 +2456,7 @@ FontFamilyInfoQueryRegistryCallback(IN PWSTR ValueName, IN ULONG ValueType,
if (InfoContext->Count < InfoContext->Size) if (InfoContext->Count < InfoContext->Size)
{ {
FontFamilyFillInfo(InfoContext->Info + InfoContext->Count, FontFamilyFillInfo(InfoContext->Info + InfoContext->Count,
RegistryName.Buffer, FontGDI); RegistryName.Buffer, NULL, FontGDI);
} }
InfoContext->Count++; InfoContext->Count++;
return STATUS_SUCCESS; return STATUS_SUCCESS;
@ -4715,7 +4729,7 @@ IntGdiGetFontResourceInfo(
IsEqual = FALSE; IsEqual = FALSE;
FontFamilyFillInfo(&FamInfo[Count], FontEntry->FaceName.Buffer, FontFamilyFillInfo(&FamInfo[Count], FontEntry->FaceName.Buffer,
FontEntry->Font); NULL, FontEntry->Font);
for (i = 0; i < Count; ++i) for (i = 0; i < Count; ++i)
{ {
if (EqualFamilyInfo(&FamInfo[i], &FamInfo[Count])) if (EqualFamilyInfo(&FamInfo[i], &FamInfo[Count]))