Author: hbelusca Date: Fri Aug 15 20:00:47 2014 New Revision: 63896
URL: http://svn.reactos.org/svn/reactos?rev=63896&view=rev Log: [CONSOLE.CPL][CONSRV]: Font fix n°1: correctly use the font size (for TT fonts only, at the moment).
Modified: branches/condrv_restructure/dll/cpl/console/font.c branches/condrv_restructure/dll/cpl/console/layout.c branches/condrv_restructure/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c branches/condrv_restructure/win32ss/user/winsrv/consrv/frontends/gui/guisettings.h
Modified: branches/condrv_restructure/dll/cpl/console/font.c URL: http://svn.reactos.org/svn/reactos/branches/condrv_restructure/dll/cpl/conso... ============================================================================== --- branches/condrv_restructure/dll/cpl/console/font.c [iso-8859-1] (original) +++ branches/condrv_restructure/dll/cpl/console/font.c [iso-8859-1] Fri Aug 15 20:00:47 2014 @@ -72,7 +72,7 @@ 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; } @@ -102,12 +102,9 @@ 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 @@ -158,7 +155,8 @@ /* 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; }
@@ -166,14 +164,16 @@ #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 @@ -205,7 +205,8 @@ 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; @@ -247,7 +248,7 @@ } else { - int i; + ULONG i; for (i = 0; i < sizeof(TrueTypePoints) / sizeof(TrueTypePoints[0]); ++i) { swprintf(FontSize, L"%2d", TrueTypePoints[i]); @@ -271,7 +272,6 @@ return FALSE; } } -
static VOID
Modified: branches/condrv_restructure/dll/cpl/console/layout.c URL: http://svn.reactos.org/svn/reactos/branches/condrv_restructure/dll/cpl/conso... ============================================================================== --- branches/condrv_restructure/dll/cpl/console/layout.c [iso-8859-1] (original) +++ branches/condrv_restructure/dll/cpl/console/layout.c [iso-8859-1] Fri Aug 15 20:00:47 2014 @@ -107,6 +107,8 @@ HBRUSH hBrush; HFONT Font, OldFont;
+ COORD FontSize = GuiInfo->FontSize; + if (TextMode == Screen) CurrentAttrib = pConInfo->ci.ScreenAttrib; else if (TextMode == Popup) @@ -120,8 +122,11 @@ 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, @@ -131,7 +136,7 @@ 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) @@ -154,7 +159,7 @@ 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);
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c URL: http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user/... ============================================================================== --- branches/condrv_restructure/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c [iso-8859-1] (original) +++ branches/condrv_restructure/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c [iso-8859-1] Fri Aug 15 20:00:47 2014 @@ -539,9 +539,14 @@ 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, @@ -554,20 +559,13 @@ 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; }
@@ -591,7 +589,7 @@ 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;
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/frontends/gui/guisettings.h URL: http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user/... ============================================================================== --- branches/condrv_restructure/win32ss/user/winsrv/consrv/frontends/gui/guisettings.h [iso-8859-1] (original) +++ branches/condrv_restructure/win32ss/user/winsrv/consrv/frontends/gui/guisettings.h [iso-8859-1] Fri Aug 15 20:00:47 2014 @@ -76,7 +76,7 @@ COLORREF ColorTable[16];
ULONG CodePage; - HWND HWnd; + HWND hWnd;
WCHAR ConsoleTitle[256]; } CONSOLE_STATE_INFO, *PCONSOLE_STATE_INFO;