mirror of
https://github.com/reactos/reactos.git
synced 2024-08-22 11:22:59 +00:00
[CONSOLE.CPL][CONSRV]
- Remove the unuseful UseRasterFonts member in console properties structure. - Fix my FontSize.X / FontSize.Y mixing (X is width, Y is height) that I introduced in revision 63819. - We are now able to change the console font via the console props control panel applet (work in progress, but it works!) svn path=/branches/condrv_restructure/; revision=63863
This commit is contained in:
parent
8e73c54f79
commit
23f16979ac
|
@ -118,7 +118,6 @@ InitConsoleDefaults(PCONSOLE_PROPS pConInfo)
|
|||
GuiInfo->FontSize.X = 0;
|
||||
GuiInfo->FontSize.Y = 0;
|
||||
GuiInfo->FontWeight = FW_DONTCARE;
|
||||
GuiInfo->UseRasterFonts = TRUE;
|
||||
|
||||
GuiInfo->FullScreen = FALSE;
|
||||
GuiInfo->ShowWindow = SW_SHOWNORMAL;
|
||||
|
|
|
@ -76,11 +76,25 @@
|
|||
if (GetTextExtentPoint32W(drawItem->hDC, L"R", 1, &CharSize))
|
||||
GuiData->CharWidth = CharSize.cx;
|
||||
}
|
||||
|
||||
/*
|
||||
* See also: Display_SetTypeFace in applications/fontview/display.c
|
||||
*/
|
||||
#endif
|
||||
|
||||
|
||||
BOOL CALLBACK
|
||||
EnumFontFamExProc(PLOGFONTW lplf,
|
||||
/*
|
||||
* Font pixel heights for TrueType fonts
|
||||
*/
|
||||
static SHORT TrueTypePoints[] =
|
||||
{
|
||||
// 8, 9, 10, 11, 12, 14, 16, 18, 20,
|
||||
// 22, 24, 26, 28, 36, 48, 72
|
||||
5, 6, 7, 8, 10, 12, 14, 16, 18, 20, 24, 28, 36, 72
|
||||
};
|
||||
|
||||
static BOOL CALLBACK
|
||||
EnumFontNamesProc(PLOGFONTW lplf,
|
||||
PNEWTEXTMETRICW lpntm,
|
||||
DWORD FontType,
|
||||
LPARAM lParam)
|
||||
|
@ -197,6 +211,161 @@ EnumFontFamExProc(PLOGFONTW lplf,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL CALLBACK
|
||||
EnumFontSizesProc(PLOGFONTW lplf,
|
||||
PNEWTEXTMETRICW lpntm,
|
||||
DWORD FontType,
|
||||
LPARAM lParam)
|
||||
{
|
||||
HWND hwndCombo = (HWND)lParam;
|
||||
WCHAR FontSize[100];
|
||||
|
||||
if (FontType != TRUETYPE_FONTTYPE)
|
||||
{
|
||||
// int logsize = lpntm->tmHeight - lpntm->tmInternalLeading;
|
||||
// LONG pointsize = MulDiv(logsize, 72, GetDeviceCaps(hdc, LOGPIXELSY));
|
||||
|
||||
// swprintf(FontSize, L"%2d (%d x %d)", pointsize, lplf->lfWidth, lplf->lfHeight);
|
||||
swprintf(FontSize, L"%d x %d", lplf->lfWidth, lplf->lfHeight);
|
||||
|
||||
/* Make sure the size doesn't already exist in the list */
|
||||
if (SendMessageW(hwndCombo, LB_FINDSTRINGEXACT, 0, (LPARAM)FontSize) == LB_ERR)
|
||||
{
|
||||
/* Add the size */
|
||||
INT idx = (INT)SendMessageW(hwndCombo, LB_ADDSTRING, 0, (LPARAM)FontSize);
|
||||
|
||||
/*
|
||||
* Store this information in the list-item's userdata area.
|
||||
* Format:
|
||||
* Width = FontSize.X = LOWORD(FontSize);
|
||||
* Height = FontSize.Y = HIWORD(FontSize);
|
||||
*/
|
||||
SendMessageW(hwndCombo, LB_SETITEMDATA, idx, MAKEWPARAM(lplf->lfWidth, lplf->lfHeight));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < sizeof(TrueTypePoints) / sizeof(TrueTypePoints[0]); ++i)
|
||||
{
|
||||
swprintf(FontSize, L"%2d", TrueTypePoints[i]);
|
||||
|
||||
/* Make sure the size doesn't already exist in the list */
|
||||
if (SendMessageW(hwndCombo, LB_FINDSTRINGEXACT, 0, (LPARAM)FontSize) == LB_ERR)
|
||||
{
|
||||
/* Add the size */
|
||||
INT idx = (INT)SendMessageW(hwndCombo, LB_ADDSTRING, 0, (LPARAM)FontSize);
|
||||
|
||||
/*
|
||||
* Store this information in the list-item's userdata area.
|
||||
* Format:
|
||||
* Width = FontSize.X = LOWORD(FontSize);
|
||||
* Height = FontSize.Y = HIWORD(FontSize);
|
||||
*/
|
||||
SendMessageW(hwndCombo, LB_SETITEMDATA, idx, MAKEWPARAM(0, TrueTypePoints[i]));
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static VOID
|
||||
FontSizeChange(HWND hwndDlg,
|
||||
PGUI_CONSOLE_INFO GuiInfo);
|
||||
|
||||
static VOID
|
||||
FontTypeChange(HWND hwndDlg,
|
||||
PGUI_CONSOLE_INFO GuiInfo)
|
||||
{
|
||||
INT Length, nSel;
|
||||
LPWSTR FaceName;
|
||||
|
||||
HDC hDC;
|
||||
LOGFONTW lf;
|
||||
|
||||
nSel = (INT)SendDlgItemMessageW(hwndDlg, IDC_LBOX_FONTTYPE,
|
||||
LB_GETCURSEL, 0, 0);
|
||||
if (nSel == LB_ERR) return;
|
||||
|
||||
Length = (INT)SendDlgItemMessageW(hwndDlg, IDC_LBOX_FONTTYPE,
|
||||
LB_GETTEXTLEN, nSel, 0);
|
||||
if (Length == LB_ERR) return;
|
||||
|
||||
FaceName = HeapAlloc(GetProcessHeap(),
|
||||
HEAP_ZERO_MEMORY,
|
||||
(Length + 1) * sizeof(WCHAR));
|
||||
if (FaceName == NULL) return;
|
||||
|
||||
Length = (INT)SendDlgItemMessageW(hwndDlg, IDC_LBOX_FONTTYPE,
|
||||
LB_GETTEXT, nSel, (LPARAM)FaceName);
|
||||
FaceName[Length] = '\0';
|
||||
|
||||
Length = min(Length/*wcslen(FaceName) + 1*/, LF_FACESIZE); // wcsnlen
|
||||
wcsncpy(GuiInfo->FaceName, FaceName, LF_FACESIZE);
|
||||
GuiInfo->FaceName[Length] = L'\0';
|
||||
DPRINT1("GuiInfo->FaceName = '%S'\n", GuiInfo->FaceName);
|
||||
|
||||
/* Enumerate the available sizes for the selected font */
|
||||
ZeroMemory(&lf, sizeof(lf));
|
||||
lf.lfCharSet = DEFAULT_CHARSET; // OEM_CHARSET;
|
||||
// lf.lfPitchAndFamily = FIXED_PITCH | FF_DONTCARE;
|
||||
wcsncpy(lf.lfFaceName, FaceName, LF_FACESIZE);
|
||||
lf.lfFaceName[Length] = L'\0';
|
||||
|
||||
hDC = GetDC(NULL);
|
||||
EnumFontFamiliesExW(hDC, &lf, (FONTENUMPROCW)EnumFontSizesProc,
|
||||
(LPARAM)GetDlgItem(hwndDlg, IDC_LBOX_FONTSIZE), 0);
|
||||
ReleaseDC(NULL, hDC);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, FaceName);
|
||||
|
||||
// TODO: Select a default font size????
|
||||
FontSizeChange(hwndDlg, GuiInfo);
|
||||
|
||||
// InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_FONT_WINDOW_PREVIEW), NULL, TRUE);
|
||||
// InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SELECT_FONT_PREVIEW), NULL, TRUE);
|
||||
}
|
||||
|
||||
static VOID
|
||||
FontSizeChange(HWND hwndDlg,
|
||||
PGUI_CONSOLE_INFO GuiInfo)
|
||||
{
|
||||
INT nSel;
|
||||
ULONG FontSize;
|
||||
WCHAR FontSizeStr[20];
|
||||
|
||||
nSel = (INT)SendDlgItemMessageW(hwndDlg, IDC_LBOX_FONTSIZE,
|
||||
LB_GETCURSEL, 0, 0);
|
||||
if (nSel == LB_ERR) return;
|
||||
|
||||
/*
|
||||
* Format:
|
||||
* Width = FontSize.X = LOWORD(FontSize);
|
||||
* Height = FontSize.Y = HIWORD(FontSize);
|
||||
*/
|
||||
FontSize = (ULONG)SendDlgItemMessageW(hwndDlg, IDC_LBOX_FONTSIZE,
|
||||
LB_GETITEMDATA, nSel, 0);
|
||||
if (FontSize == LB_ERR) return;
|
||||
|
||||
GuiInfo->FontSize.X = LOWORD(FontSize);
|
||||
GuiInfo->FontSize.Y = HIWORD(FontSize);
|
||||
DPRINT1("GuiInfo->FontSize = (%d x %d)\n", GuiInfo->FontSize.X, GuiInfo->FontSize.Y);
|
||||
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_FONT_WINDOW_PREVIEW), NULL, TRUE);
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SELECT_FONT_PREVIEW), NULL, TRUE);
|
||||
|
||||
swprintf(FontSizeStr, L"%2d", GuiInfo->FontSize.X);
|
||||
SetWindowText(GetDlgItem(hwndDlg, IDC_FONT_SIZE_X), FontSizeStr);
|
||||
swprintf(FontSizeStr, L"%2d", GuiInfo->FontSize.Y);
|
||||
SetWindowText(GetDlgItem(hwndDlg, IDC_FONT_SIZE_Y), FontSizeStr);
|
||||
}
|
||||
|
||||
|
||||
INT_PTR
|
||||
CALLBACK
|
||||
FontProc(HWND hwndDlg,
|
||||
|
@ -214,7 +383,6 @@ FontProc(HWND hwndDlg,
|
|||
case WM_INITDIALOG:
|
||||
{
|
||||
HDC hDC;
|
||||
HWND hwndCombo;
|
||||
LOGFONTW lf;
|
||||
INT idx;
|
||||
|
||||
|
@ -225,19 +393,19 @@ FontProc(HWND hwndDlg,
|
|||
ZeroMemory(&lf, sizeof(lf));
|
||||
lf.lfCharSet = DEFAULT_CHARSET; // OEM_CHARSET;
|
||||
// lf.lfPitchAndFamily = FIXED_PITCH | FF_DONTCARE;
|
||||
// lf.lfFaceName = L"";
|
||||
|
||||
hDC = GetDC(NULL);
|
||||
hwndCombo = GetDlgItem(hwndDlg, IDC_LBOX_FONTTYPE);
|
||||
EnumFontFamiliesExW(hDC, &lf, (FONTENUMPROCW)EnumFontFamExProc, (LPARAM)hwndCombo, 0);
|
||||
EnumFontFamiliesExW(hDC, &lf, (FONTENUMPROCW)EnumFontNamesProc,
|
||||
(LPARAM)GetDlgItem(hwndDlg, IDC_LBOX_FONTTYPE), 0);
|
||||
ReleaseDC(NULL, hDC);
|
||||
|
||||
DPRINT1("GuiInfo->FaceName = '%S'\n", GuiInfo->FaceName);
|
||||
idx = (INT)SendMessageW(hwndCombo, LB_FINDSTRINGEXACT, 0, (LPARAM)GuiInfo->FaceName);
|
||||
if (idx != LB_ERR)
|
||||
{
|
||||
SendMessageW(hwndCombo, LB_SETCURSEL, (WPARAM)idx, 0);
|
||||
}
|
||||
idx = (INT)SendDlgItemMessageW(hwndDlg, IDC_LBOX_FONTTYPE,
|
||||
LB_FINDSTRINGEXACT, 0, (LPARAM)GuiInfo->FaceName);
|
||||
if (idx != LB_ERR) SendDlgItemMessageW(hwndDlg, IDC_LBOX_FONTTYPE,
|
||||
LB_SETCURSEL, (WPARAM)idx, 0);
|
||||
|
||||
FontTypeChange(hwndDlg, GuiInfo);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -247,16 +415,66 @@ FontProc(HWND hwndDlg,
|
|||
LPDRAWITEMSTRUCT drawItem = (LPDRAWITEMSTRUCT)lParam;
|
||||
|
||||
if (drawItem->CtlID == IDC_STATIC_FONT_WINDOW_PREVIEW)
|
||||
{
|
||||
PaintConsole(drawItem, pConInfo);
|
||||
}
|
||||
else if (drawItem->CtlID == IDC_STATIC_SELECT_FONT_PREVIEW)
|
||||
{
|
||||
PaintText(drawItem, pConInfo, Screen);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
switch (((LPNMHDR)lParam)->code)
|
||||
{
|
||||
case PSN_APPLY:
|
||||
{
|
||||
if (!pConInfo->AppliedConfig)
|
||||
{
|
||||
return ApplyConsoleInfo(hwndDlg, pConInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Options have already been applied */
|
||||
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_NOERROR);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (HIWORD(wParam))
|
||||
{
|
||||
case LBN_SELCHANGE:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_LBOX_FONTTYPE:
|
||||
{
|
||||
FontTypeChange(hwndDlg, GuiInfo);
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
break;
|
||||
}
|
||||
|
||||
case IDC_LBOX_FONTSIZE:
|
||||
{
|
||||
FontSizeChange(hwndDlg, GuiInfo);
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -120,8 +120,8 @@ PaintText(LPDRAWITEMSTRUCT drawItem,
|
|||
hBrush = CreateSolidBrush(nbkColor);
|
||||
if (!hBrush) return FALSE;
|
||||
|
||||
Font = CreateFontW(GuiInfo->FontSize.X,
|
||||
0, // GuiInfo->FontSize.Y,
|
||||
Font = CreateFontW(GuiInfo->FontSize.Y,
|
||||
0, // GuiInfo->FontSize.X,
|
||||
0,
|
||||
TA_BASELINE,
|
||||
GuiInfo->FontWeight,
|
||||
|
|
|
@ -506,8 +506,8 @@ OnNcCreate(HWND hWnd, LPCREATESTRUCTW Create)
|
|||
|
||||
GuiData->hWindow = hWnd;
|
||||
|
||||
GuiData->Font = CreateFontW(GuiData->GuiInfo.FontSize.X,
|
||||
0, // GuiData->GuiInfo.FontSize.Y,
|
||||
GuiData->Font = CreateFontW(GuiData->GuiInfo.FontSize.Y,
|
||||
0, // GuiData->GuiInfo.FontSize.X,
|
||||
0,
|
||||
TA_BASELINE,
|
||||
GuiData->GuiInfo.FontWeight,
|
||||
|
|
|
@ -98,8 +98,8 @@ GuiConsoleReadUserSettings(IN OUT PGUI_CONSOLE_INFO TermInfo,
|
|||
}
|
||||
else if (!wcscmp(szValueName, L"FontSize"))
|
||||
{
|
||||
TermInfo->FontSize.X = LOWORD(Value);
|
||||
TermInfo->FontSize.Y = HIWORD(Value);
|
||||
TermInfo->FontSize.X = LOWORD(Value); // Width
|
||||
TermInfo->FontSize.Y = HIWORD(Value); // Height
|
||||
RetVal = TRUE;
|
||||
}
|
||||
else if (!wcscmp(szValueName, L"FontWeight"))
|
||||
|
@ -161,7 +161,7 @@ do {
|
|||
SetConsoleSetting(L"FaceName", REG_SZ, (wcslen(TermInfo->FaceName) + 1) * sizeof(WCHAR), TermInfo->FaceName, L'\0'); // wcsnlen
|
||||
SetConsoleSetting(L"FontFamily", REG_DWORD, sizeof(DWORD), &TermInfo->FontFamily, FF_DONTCARE);
|
||||
|
||||
Storage = MAKELONG(TermInfo->FontSize.X, TermInfo->FontSize.Y);
|
||||
Storage = MAKELONG(TermInfo->FontSize.X, TermInfo->FontSize.Y); // Width, Height
|
||||
SetConsoleSetting(L"FontSize", REG_DWORD, sizeof(DWORD), &Storage, 0);
|
||||
|
||||
SetConsoleSetting(L"FontWeight", REG_DWORD, sizeof(DWORD), &TermInfo->FontWeight, FW_DONTCARE);
|
||||
|
@ -197,7 +197,7 @@ GuiConsoleGetDefaultSettings(IN OUT PGUI_CONSOLE_INFO TermInfo,
|
|||
* 1. Load the default values
|
||||
*/
|
||||
// wcsncpy(TermInfo->FaceName, L"DejaVu Sans Mono", LF_FACESIZE);
|
||||
// TermInfo->FontSize = MAKELONG(12, 8); // 0x0008000C; // font is 8x12
|
||||
// TermInfo->FontSize = MAKELONG(8, 12); // 0x000C0008; // font is 8x12
|
||||
// TermInfo->FontSize = MAKELONG(16, 16); // font is 16x16
|
||||
// TermInfo->FontWeight = FW_NORMAL;
|
||||
|
||||
|
@ -207,7 +207,6 @@ GuiConsoleGetDefaultSettings(IN OUT PGUI_CONSOLE_INFO TermInfo,
|
|||
TermInfo->FontSize.X = 0;
|
||||
TermInfo->FontSize.Y = 0;
|
||||
TermInfo->FontWeight = FW_DONTCARE;
|
||||
TermInfo->UseRasterFonts = TRUE;
|
||||
|
||||
TermInfo->FullScreen = FALSE;
|
||||
TermInfo->ShowWindow = SW_SHOWNORMAL;
|
||||
|
@ -333,7 +332,6 @@ GuiConsoleShowConsoleProperties(PGUI_CONSOLE_DATA GuiData,
|
|||
GuiInfo->FontFamily = GuiData->GuiInfo.FontFamily;
|
||||
GuiInfo->FontSize = GuiData->GuiInfo.FontSize;
|
||||
GuiInfo->FontWeight = GuiData->GuiInfo.FontWeight;
|
||||
GuiInfo->UseRasterFonts = GuiData->GuiInfo.UseRasterFonts;
|
||||
GuiInfo->FullScreen = GuiData->GuiInfo.FullScreen;
|
||||
GuiInfo->AutoPosition = GuiData->GuiInfo.AutoPosition;
|
||||
GuiInfo->WindowOrigin = GuiData->GuiInfo.WindowOrigin;
|
||||
|
@ -420,6 +418,92 @@ Quit:
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
BOOL
|
||||
ChangeFont(PGUI_CONSOLE_DATA GuiData,
|
||||
LPWSTR FaceName, // Points to a WCHAR array of LF_FACESIZE elements.
|
||||
ULONG FontFamily,
|
||||
COORD FontSize,
|
||||
ULONG FontWeight)
|
||||
{
|
||||
HDC hDC;
|
||||
HFONT OldFont, NewFont;
|
||||
TEXTMETRICW Metrics;
|
||||
SIZE CharSize;
|
||||
SIZE_T Length;
|
||||
|
||||
NewFont = CreateFontW(FontSize.Y,
|
||||
0, // FontSize.X,
|
||||
0,
|
||||
TA_BASELINE,
|
||||
FontWeight,
|
||||
FALSE,
|
||||
FALSE,
|
||||
FALSE,
|
||||
OEM_CHARSET,
|
||||
OUT_DEFAULT_PRECIS,
|
||||
CLIP_DEFAULT_PRECIS,
|
||||
NONANTIALIASED_QUALITY,
|
||||
FIXED_PITCH | FontFamily /* FF_DONTCARE */,
|
||||
FaceName);
|
||||
if (NewFont == NULL)
|
||||
{
|
||||
DPRINT1("ChangeFont: CreateFont failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
hDC = GetDC(GuiData->hWindow);
|
||||
if (hDC == NULL)
|
||||
{
|
||||
DPRINT1("ChangeFont: GetDC failed\n");
|
||||
DeleteObject(NewFont);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
OldFont = SelectObject(hDC, NewFont);
|
||||
if (OldFont == NULL)
|
||||
{
|
||||
DPRINT1("ChangeFont: SelectObject failed\n");
|
||||
ReleaseDC(GuiData->hWindow, hDC);
|
||||
DeleteObject(NewFont);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!GetTextMetricsW(hDC, &Metrics))
|
||||
{
|
||||
DPRINT1("ChangeFont: GetTextMetrics failed\n");
|
||||
SelectObject(hDC, OldFont);
|
||||
ReleaseDC(GuiData->hWindow, hDC);
|
||||
DeleteObject(NewFont);
|
||||
return FALSE;
|
||||
}
|
||||
GuiData->CharWidth = Metrics.tmMaxCharWidth;
|
||||
GuiData->CharHeight = Metrics.tmHeight + Metrics.tmExternalLeading;
|
||||
|
||||
/* Measure real char width more precisely if possible. */
|
||||
if (GetTextExtentPoint32W(hDC, L"R", 1, &CharSize))
|
||||
GuiData->CharWidth = CharSize.cx;
|
||||
|
||||
SelectObject(hDC, OldFont);
|
||||
ReleaseDC(GuiData->hWindow, hDC);
|
||||
|
||||
if (GuiData->Font != NULL) DeleteObject(GuiData->Font);
|
||||
GuiData->Font = NewFont;
|
||||
|
||||
Length = min(wcslen(FaceName) + 1, LF_FACESIZE); // wcsnlen
|
||||
wcsncpy(GuiData->GuiInfo.FaceName, FaceName, LF_FACESIZE);
|
||||
GuiData->GuiInfo.FaceName[Length] = L'\0'; // NULL-terminate
|
||||
GuiData->GuiInfo.FontFamily = FontFamily;
|
||||
GuiData->GuiInfo.FontSize = FontSize;
|
||||
GuiData->GuiInfo.FontWeight = FontWeight;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
GuiApplyUserSettings(PGUI_CONSOLE_DATA GuiData,
|
||||
HANDLE hClientSection,
|
||||
|
@ -501,6 +585,15 @@ GuiApplyUserSettings(PGUI_CONSOLE_DATA GuiData,
|
|||
|
||||
// memcpy(&GuiData->GuiInfo, GuiInfo, sizeof(GUI_CONSOLE_INFO));
|
||||
|
||||
/* Change the font */
|
||||
ChangeFont(GuiData,
|
||||
GuiInfo->FaceName,
|
||||
GuiInfo->FontFamily,
|
||||
GuiInfo->FontSize,
|
||||
GuiInfo->FontWeight);
|
||||
// HACK, needed because changing font may change the size of the window
|
||||
/**/TermResizeTerminal(Console);/**/
|
||||
|
||||
/* Move the window to the user's values */
|
||||
GuiData->GuiInfo.AutoPosition = GuiInfo->AutoPosition;
|
||||
GuiData->GuiInfo.WindowOrigin = GuiInfo->WindowOrigin;
|
||||
|
@ -655,7 +748,6 @@ GuiApplyWindowsConsoleSettings(PGUI_CONSOLE_DATA GuiData,
|
|||
GuiInfo.FullScreen = !!pConInfo->FullScreen;
|
||||
GuiInfo.AutoPosition = !!pConInfo->AutoPosition;
|
||||
GuiInfo.WindowOrigin = pConInfo->WindowPosition;
|
||||
// BOOL GuiInfo.UseRasterFonts = pConInfo->
|
||||
// WORD GuiInfo.ShowWindow = pConInfo->
|
||||
|
||||
|
||||
|
@ -675,6 +767,15 @@ GuiApplyWindowsConsoleSettings(PGUI_CONSOLE_DATA GuiData,
|
|||
|
||||
// memcpy(&GuiData->GuiInfo, &GuiInfo, sizeof(GUI_CONSOLE_INFO));
|
||||
|
||||
/* Change the font */
|
||||
ChangeFont(GuiData,
|
||||
GuiInfo.FaceName,
|
||||
GuiInfo.FontFamily,
|
||||
GuiInfo.FontSize,
|
||||
GuiInfo.FontWeight);
|
||||
// HACK, needed because changing font may change the size of the window
|
||||
/**/TermResizeTerminal(Console);/**/
|
||||
|
||||
/* Move the window to the user's values */
|
||||
GuiData->GuiInfo.AutoPosition = GuiInfo.AutoPosition;
|
||||
GuiData->GuiInfo.WindowOrigin = GuiInfo.WindowOrigin;
|
||||
|
|
|
@ -34,7 +34,6 @@ typedef struct _GUI_CONSOLE_INFO
|
|||
ULONG FontFamily;
|
||||
COORD FontSize;
|
||||
ULONG FontWeight;
|
||||
BOOL UseRasterFonts;
|
||||
|
||||
BOOL FullScreen; /* Whether the console is displayed in full-screen or windowed mode */
|
||||
// ULONG HardwareState; /* _GDI_MANAGED, _DIRECT */
|
||||
|
|
|
@ -486,13 +486,15 @@ GuiInitFrontEnd(IN OUT PFRONTEND This,
|
|||
* Set up GUI data
|
||||
*/
|
||||
|
||||
// Font data
|
||||
Length = min(wcslen(TermInfo.FaceName) + 1, LF_FACESIZE); // wcsnlen
|
||||
wcsncpy(GuiData->GuiInfo.FaceName, TermInfo.FaceName, LF_FACESIZE);
|
||||
GuiData->GuiInfo.FaceName[Length] = L'\0';
|
||||
GuiData->GuiInfo.FontFamily = TermInfo.FontFamily;
|
||||
GuiData->GuiInfo.FontSize = TermInfo.FontSize;
|
||||
GuiData->GuiInfo.FontWeight = TermInfo.FontWeight;
|
||||
GuiData->GuiInfo.UseRasterFonts = TermInfo.UseRasterFonts;
|
||||
|
||||
// Display
|
||||
GuiData->GuiInfo.FullScreen = TermInfo.FullScreen;
|
||||
GuiData->GuiInfo.ShowWindow = TermInfo.ShowWindow;
|
||||
GuiData->GuiInfo.AutoPosition = TermInfo.AutoPosition;
|
||||
|
|
Loading…
Reference in a new issue