GuiData->CharWidth = Metrics.tmMaxCharWidth;
GuiData->CharHeight = Metrics.tmHeight + Metrics.tmExternalLeading;
- /* Measure real char width more precisely if possible. */
+ /* Measure real char width more precisely if possible */
if (GetTextExtentPoint32W(drawItem->hDC, L"R", 1, &CharSize))
GuiData->CharWidth = CharSize.cx;
}
HWND hwndCombo = (HWND)lParam;
LPWSTR pszName = lplf->lfFaceName;
- BOOL fFixed;
- BOOL fTrueType;
-
/* Record the font's attributes (Fixedwidth and Truetype) */
- fFixed = ((lplf->lfPitchAndFamily & 0x03) == FIXED_PITCH);
- fTrueType = (lplf->lfOutPrecision == OUT_STROKE_PRECIS) ? TRUE : FALSE;
+ // BOOL fFixed = ((lplf->lfPitchAndFamily & 0x03) == FIXED_PITCH);
+ // BOOL fTrueType = (lplf->lfOutPrecision == OUT_STROKE_PRECIS);
/*
* According to: http://support.microsoft.com/kb/247815
/* Reject TrueType fonts that are not FF_MODERN */
if ((FontType == TRUETYPE_FONTTYPE) && ((lplf->lfPitchAndFamily & 0xF0) != FF_MODERN))
{
- DPRINT1("TrueType font '%S' rejected because it's not FF_MODERN (lfPitchAndFamily = %d)\n", pszName, lplf->lfPitchAndFamily);
+ DPRINT1("TrueType font '%S' rejected because it's not FF_MODERN (lfPitchAndFamily = %d)\n",
+ pszName, lplf->lfPitchAndFamily);
return TRUE;
}
#if 0
if ((FontType != TRUETYPE_FONTTYPE) && (lplf->lfCharSet != OEM_CHARSET))
{
- DPRINT1("Non-TrueType font '%S' rejected because it's not OEM_CHARSET %d\n", pszName, lplf->lfCharSet);
+ DPRINT1("Non-TrueType font '%S' rejected because it's not OEM_CHARSET %d\n",
+ pszName, lplf->lfCharSet);
return TRUE;
}
#else // Improved criterium
if ((FontType != TRUETYPE_FONTTYPE) &&
((lplf->lfCharSet != ANSI_CHARSET) && (lplf->lfCharSet != DEFAULT_CHARSET) && (lplf->lfCharSet != OEM_CHARSET)))
{
- DPRINT1("Non-TrueType font '%S' rejected because it's not ANSI_CHARSET or DEFAULT_CHARSET or OEM_CHARSET (lfCharSet = %d)\n", pszName, lplf->lfCharSet);
+ DPRINT1("Non-TrueType font '%S' rejected because it's not ANSI_CHARSET or DEFAULT_CHARSET or OEM_CHARSET (lfCharSet = %d)\n",
+ pszName, lplf->lfCharSet);
return TRUE;
}
#endif
DPRINT1("Add font '%S' (lfPitchAndFamily = %d)\n", pszName, lplf->lfPitchAndFamily);
/* Store this information in the list-item's userdata area */
- SendMessageW(hwndCombo, LB_SETITEMDATA, idx, MAKEWPARAM(fFixed, fTrueType));
+ // SendMessageW(hwndCombo, LB_SETITEMDATA, idx, MAKEWPARAM(fFixed, fTrueType));
+ SendMessageW(hwndCombo, LB_SETITEMDATA, idx, (WPARAM)FontType);
}
return TRUE;
}
else
{
- int i;
+ ULONG i;
for (i = 0; i < sizeof(TrueTypePoints) / sizeof(TrueTypePoints[0]); ++i)
{
swprintf(FontSize, L"%2d", TrueTypePoints[i]);
}
-
static VOID
FontSizeChange(HWND hwndDlg,
PGUI_CONSOLE_INFO GuiInfo);
HBRUSH hBrush;
HFONT Font, OldFont;
+ COORD FontSize = GuiInfo->FontSize;
+
if (TextMode == Screen)
CurrentAttrib = pConInfo->ci.ScreenAttrib;
else if (TextMode == Popup)
hBrush = CreateSolidBrush(nbkColor);
if (!hBrush) return FALSE;
- Font = CreateFontW(GuiInfo->FontSize.Y,
- GuiInfo->FontSize.X,
+ FontSize.Y = FontSize.Y > 0 ? -MulDiv(FontSize.Y, GetDeviceCaps(drawItem->hDC, LOGPIXELSY), 72)
+ : FontSize.Y;
+
+ Font = CreateFontW(FontSize.Y,
+ FontSize.X,
0,
TA_BASELINE,
GuiInfo->FontWeight,
OEM_CHARSET,
OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,
- DEFAULT_QUALITY, // NONANTIALIASED_QUALITY ; ANTIALIASED_QUALITY
+ DEFAULT_QUALITY,
FIXED_PITCH | GuiInfo->FontFamily,
GuiInfo->FaceName);
if (Font == NULL)
DrawTextW(drawItem->hDC, szPreviewText, wcslen(szPreviewText), &drawItem->rcItem, 0);
SetTextColor(drawItem->hDC, ptColor);
SetBkColor(drawItem->hDC, pbkColor);
- DeleteObject((HGDIOBJ)hBrush);
+ DeleteObject(hBrush);
SelectObject(drawItem->hDC, OldFont);
DeleteObject(Font);
TEXTMETRICW Metrics;
SIZE CharSize;
+ hDC = GetDC(GuiData->hWindow);
+
/*
* Initialize a new NORMAL font and get its metrics.
*/
+ FontSize.Y = FontSize.Y > 0 ? -MulDiv(FontSize.Y, GetDeviceCaps(hDC, LOGPIXELSY), 72)
+ : FontSize.Y;
+
NewFont = CreateFontW(FontSize.Y,
FontSize.X,
0,
OEM_CHARSET,
OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,
- DEFAULT_QUALITY, // NONANTIALIASED_QUALITY ; ANTIALIASED_QUALITY
+ DEFAULT_QUALITY,
FIXED_PITCH | FontFamily,
FaceName);
if (NewFont == NULL)
{
DPRINT1("InitFonts: CreateFontW failed\n");
- return FALSE;
- }
-
- hDC = GetDC(GuiData->hWindow);
- if (hDC == NULL)
- {
- DPRINT1("InitFonts: GetDC failed\n");
- DeleteObject(NewFont);
+ ReleaseDC(GuiData->hWindow, hDC);
return FALSE;
}
GuiData->CharWidth = Metrics.tmMaxCharWidth;
GuiData->CharHeight = Metrics.tmHeight + Metrics.tmExternalLeading;
- /* Measure real char width more precisely if possible. */
+ /* Measure real char width more precisely if possible */
if (GetTextExtentPoint32W(hDC, L"R", 1, &CharSize))
GuiData->CharWidth = CharSize.cx;