Author: tkreuzer
Date: Sat Feb 16 11:39:15 2013
New Revision: 58315
URL:
http://svn.reactos.org/svn/reactos?rev=58315&view=rev
Log:
[FONTVIEW]
Improve font type detection. Patch by Katayama Hirofumi. Slightly modified by me.
CORE-6801 #resolve
Modified:
trunk/reactos/base/applications/fontview/display.c
Modified: trunk/reactos/base/applications/fontview/display.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/fontview…
==============================================================================
--- trunk/reactos/base/applications/fontview/display.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/fontview/display.c [iso-8859-1] Sat Feb 16 11:39:15
2013
@@ -136,6 +136,28 @@
return y;
}
+static int
+CALLBACK
+EnumFontFamProcW(
+ const LOGFONTW *lpelfe,
+ const TEXTMETRICW *lptm,
+ DWORD FontType,
+ LPARAM lParam)
+{
+ PNEWTEXTMETRICW pntmw = (PNEWTEXTMETRICW)lptm;
+ PBOOL pfOpenType = (PBOOL)lParam;
+
+ if (FontType & TRUETYPE_FONTTYPE)
+ {
+ if (pntmw->ntmFlags & (NTM_TT_OPENTYPE | NTM_PS_OPENTYPE))
+ {
+ *pfOpenType = TRUE;
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
static LRESULT
Display_SetTypeFace(HWND hwnd, PEXTLOGFONTW pExtLogFont)
{
@@ -160,12 +182,27 @@
pData->hCharSetFont = CreateFontIndirectW(&logfont);
/* Get font format */
- // FIXME: Get the real font format (OpenType?)
SelectObject(hDC, pData->hCharSetFont);
GetTextMetrics(hDC, &tm);
- if ((tm.tmPitchAndFamily & TMPF_TRUETYPE) == TMPF_TRUETYPE)
- {
- swprintf(pData->szFormat, L" (TrueType)");
+ if (tm.tmPitchAndFamily & TMPF_TRUETYPE)
+ {
+ BOOL fOpenType = FALSE;
+
+ EnumFontFamiliesExW(hDC, &logfont,
+ EnumFontFamProcW, (LPARAM)&fOpenType, 0);
+
+ if (fOpenType)
+ swprintf(pData->szFormat, L" (OpenType)");
+ else
+ swprintf(pData->szFormat, L" (TrueType)");
+ }
+ else if (tm.tmPitchAndFamily & TMPF_VECTOR)
+ {
+ swprintf(pData->szFormat, L" (Vector)");
+ }
+ else
+ {
+ swprintf(pData->szFormat, L" (Raster)");
}
for (i = 0; i < MAX_SIZES; i++)