From 2ccfe267a073cf8da82fe49e7198c46018c03e0b Mon Sep 17 00:00:00 2001 From: Katayama Hirofumi MZ Date: Fri, 17 Aug 2018 10:31:45 +0900 Subject: [PATCH] [FONT][WIN32SS] Add dumping functions for debugging --- win32ss/gdi/ntgdi/freetype.c | 122 +++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/win32ss/gdi/ntgdi/freetype.c b/win32ss/gdi/ntgdi/freetype.c index c269f4f738e..75f3fd506cf 100644 --- a/win32ss/gdi/ntgdi/freetype.c +++ b/win32ss/gdi/ntgdi/freetype.c @@ -335,6 +335,124 @@ SharedFace_Release(PSHARED_FACE Ptr) IntUnLockFreeType(); } +#if DBG +VOID DumpFontGDI(PFONTGDI FontGDI) +{ + const char *family_name; + const char *style_name; + FT_Face Face; + + if (!FontGDI) + { + DPRINT("FontGDI NULL\n"); + return; + } + + Face = (FontGDI->SharedFace ? FontGDI->SharedFace->Face : NULL); + if (Face) + { + family_name = Face->family_name; + if (!family_name) + family_name = ""; + + style_name = Face->style_name; + if (!style_name) + style_name = ""; + } + else + { + family_name = ""; + style_name = ""; + } + + DPRINT("family_name '%s', style_name '%s', FontGDI %p, FontObj %p, iUnique %lu, SharedFace %p, Face %p, CharSet %u, Filename '%S'\n", + family_name, + style_name, + FontGDI, + FontGDI->FontObj, + FontGDI->iUnique, + FontGDI->SharedFace, + Face, + FontGDI->CharSet, + FontGDI->Filename); +} + +VOID DumpFontList(PLIST_ENTRY Head) +{ + PLIST_ENTRY Entry; + PFONT_ENTRY CurrentEntry; + PFONTGDI FontGDI; + + DPRINT("## DumpFontList(%p)\n", Head); + + for (Entry = Head->Flink; Entry != Head; Entry = Entry->Flink) + { + CurrentEntry = CONTAINING_RECORD(Entry, FONT_ENTRY, ListEntry); + FontGDI = CurrentEntry->Font; + + DumpFontGDI(FontGDI); + } +} + +VOID DumpFontSubstEntry(PFONTSUBST_ENTRY pSubstEntry) +{ + DPRINT("%wZ,%u -> %wZ,%u\n", + &pSubstEntry->FontNames[FONTSUBST_FROM], + pSubstEntry->CharSets[FONTSUBST_FROM], + &pSubstEntry->FontNames[FONTSUBST_TO], + pSubstEntry->CharSets[FONTSUBST_TO]); +} + +VOID DumpFontSubstList(VOID) +{ + PLIST_ENTRY pHead = &g_FontSubstListHead; + PLIST_ENTRY pListEntry; + PFONTSUBST_ENTRY pSubstEntry; + + DPRINT("## DumpFontSubstList\n"); + + for (pListEntry = pHead->Flink; + pListEntry != pHead; + pListEntry = pListEntry->Flink) + { + pSubstEntry = + (PFONTSUBST_ENTRY)CONTAINING_RECORD(pListEntry, FONT_ENTRY, ListEntry); + + DumpFontSubstEntry(pSubstEntry); + } +} + +VOID DumpPrivateFontList(BOOL bDoLock) +{ + PPROCESSINFO Win32Process = PsGetCurrentProcessWin32Process(); + + if (bDoLock) + IntLockProcessPrivateFonts(Win32Process); + + DumpFontList(&Win32Process->PrivateFontListHead); + + if (bDoLock) + IntUnLockProcessPrivateFonts(Win32Process); +} + +VOID DumpGlobalFontList(BOOL bDoLock) +{ + if (bDoLock) + IntLockGlobalFonts(); + + DumpFontList(&g_FontListHead); + + if (bDoLock) + IntUnLockGlobalFonts(); +} + +VOID DumpFontInfo(BOOL bDoLock) +{ + DumpGlobalFontList(bDoLock); + DumpPrivateFontList(bDoLock); + DumpFontSubstList(); +} +#endif /* * IntLoadFontSubstList --- loads the list of font substitutes @@ -522,6 +640,10 @@ InitFontSupport(VOID) IntLoadSystemFonts(); IntLoadFontSubstList(&g_FontSubstListHead); +#if DBG + DumpFontInfo(TRUE); +#endif + return TRUE; } -- 2.17.1