mirror of
https://github.com/reactos/reactos.git
synced 2024-10-06 01:13:38 +00:00
[FONTVIEW]
Improve font type detection. Patch by Katayama Hirofumi. Slightly modified by me. CORE-6801 #resolve svn path=/trunk/; revision=58315
This commit is contained in:
parent
d77cbc7506
commit
413592e946
|
@ -136,6 +136,28 @@ Display_DrawText(HDC hDC, DISPLAYDATA* pData, int nYPos)
|
|||
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 @@ Display_SetTypeFace(HWND hwnd, PEXTLOGFONTW pExtLogFont)
|
|||
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)
|
||||
if (tm.tmPitchAndFamily & TMPF_TRUETYPE)
|
||||
{
|
||||
swprintf(pData->szFormat, L" (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++)
|
||||
|
|
Loading…
Reference in a new issue