[CONSOLE][CONCFG][CONSRV] Provide support for specified additional TrueType fonts + bugfixes.

CORE-12451 CORE-13182 CORE-13196

- CONSOLE: Initialize the additional TrueType fonts cache.
  * Fix the font preview when a TrueType font has been selected.
  * Refresh the available fonts and the font preview when the selected
    code page is changed (Work In Progress), or when the OS pool of
    font resources has changed (WM_FONTCHANGE message).

- CONCFG: Implement support for the additional TrueType fonts cache:
  the contents of the cache is enumerated under the registry key
    HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont

  * Add helper functions and macros.
  * In CreateConsoleFontEx(), set the mandatory font pitch&family flags
    and remove those that we do not support.
  * In IsValidConsoleFont2(), update the validity checks and the
    documentation links.

- CONSRV: Load/refresh the additional TrueType fonts cache when needed.
This commit is contained in:
Hermès Bélusca-Maïto 2019-05-19 22:55:14 +02:00
parent 73d7fd1415
commit c4e2826c73
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
11 changed files with 497 additions and 108 deletions

View file

@ -72,7 +72,8 @@ AddCodePage(
static VOID
BuildCodePageList(
IN HWND hDlg)
IN HWND hDlg,
IN UINT CurrentCodePage)
{
LIST_CTL ListCtl;
HKEY hKey;
@ -126,7 +127,7 @@ BuildCodePageList(
AddCodePage(&ListCtl, CP_UTF8);
/* Find and select the current code page in the sorted list */
if (BisectListSortedByValue(&ListCtl, ConInfo->CodePage, &CodePage, FALSE) == CB_ERR ||
if (BisectListSortedByValue(&ListCtl, CurrentCodePage, &CodePage, FALSE) == CB_ERR ||
CodePage == CB_ERR)
{
/* Not found, select the first element */
@ -212,7 +213,7 @@ OptionsProc(HWND hDlg,
{
case WM_INITDIALOG:
{
BuildCodePageList(hDlg);
BuildCodePageList(hDlg, ConInfo->CodePage);
UpdateDialogElements(hDlg, ConInfo);
return TRUE;
}
@ -332,6 +333,7 @@ OptionsProc(HWND hDlg,
}
}
else
// (HIWORD(wParam) == CBN_KILLFOCUS)
if ((HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_SELENDOK) &&
(LOWORD(wParam) == IDL_CODEPAGE))
{
@ -347,11 +349,15 @@ OptionsProc(HWND hDlg,
if (CodePage == CB_ERR)
break;
ConInfo->CodePage = CodePage;
/* Change the property sheet state only if the user validated */
if (HIWORD(wParam) == CBN_SELENDOK)
/* If the user validated a different code page... */
if ((HIWORD(wParam) == CBN_SELENDOK) && (CodePage != ConInfo->CodePage))
{
/* ... update the code page, notify the siblings and change the property sheet state */
ConInfo->CodePage = CodePage;
// PropSheet_QuerySiblings(GetParent(hDlg), IDL_CODEPAGE, 0);
ResetFontPreview(&FontPreview);
PropSheet_Changed(GetParent(hDlg), hDlg);
}
}
break;