ReactOS  0.4.13-dev-259-g5ca9c9c
font.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS Console Server DLL
4  * FILE: win32ss/user/winsrv/concfg/font.c
5  * PURPOSE: Console Fonts Management
6  * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
7  * Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
8  */
9 
10 /* INCLUDES *******************************************************************/
11 
12 #include "precomp.h"
13 #include <winuser.h>
14 
15 #include "settings.h"
16 #include "font.h"
17 // #include "concfg.h"
18 
19 #define NDEBUG
20 #include <debug.h>
21 
22 
23 /* GLOBALS ********************************************************************/
24 
25 // RTL_STATIC_LIST_HEAD(TTFontCache);
27 
28 /* FUNCTIONS ******************************************************************/
29 
30 /* Retrieves the character set associated with a given code page */
31 BYTE
33  IN UINT CodePage)
34 {
35  CHARSETINFO CharInfo;
36  if (TranslateCharsetInfo(UlongToPtr(CodePage), &CharInfo, TCI_SRCCODEPAGE))
37  return CharInfo.ciCharset;
38  else
39  return DEFAULT_CHARSET;
40 }
41 
42 HFONT
44  IN LONG Height,
45  IN LONG Width OPTIONAL,
46  IN OUT LPWSTR FaceName, // Points to a WCHAR array of LF_FACESIZE elements
48  IN ULONG FontWeight,
49  IN UINT CodePage)
50 {
51  LOGFONTW lf;
52 
53  RtlZeroMemory(&lf, sizeof(lf));
54 
55  lf.lfHeight = Height;
56  lf.lfWidth = Width;
57 
58  lf.lfEscapement = 0;
59  lf.lfOrientation = 0; // TA_BASELINE; // TA_RTLREADING; when the console supports RTL?
60  // lf.lfItalic = lf.lfUnderline = lf.lfStrikeOut = FALSE;
61  lf.lfWeight = FontWeight;
62  lf.lfCharSet = CodePageToCharSet(CodePage);
66 
67  /* Set the mandatory flags and remove those that we do not support */
70 
71  if (!IsValidConsoleFont(FaceName, CodePage))
72  StringCchCopyW(FaceName, LF_FACESIZE, L"Terminal");
73 
75  FaceName, LF_FACESIZE);
76 
77  return CreateFontIndirectW(&lf);
78 }
79 
80 HFONT
82  IN LONG Height,
83  IN LONG Width OPTIONAL,
85 {
86  return CreateConsoleFontEx(Height,
87  Width,
88  ConsoleInfo->FaceName,
89  ConsoleInfo->FontFamily,
90  ConsoleInfo->FontWeight,
91  ConsoleInfo->CodePage);
92 }
93 
94 HFONT
97 {
98  /*
99  * Format:
100  * Width = FontSize.X = LOWORD(FontSize);
101  * Height = FontSize.Y = HIWORD(FontSize);
102  */
103  /* NOTE: FontSize is always in cell height/width units (pixels) */
104  return CreateConsoleFontEx((LONG)(ULONG)ConsoleInfo->FontSize.Y,
105  (LONG)(ULONG)ConsoleInfo->FontSize.X,
106  ConsoleInfo->FaceName,
107  ConsoleInfo->FontFamily,
108  ConsoleInfo->FontWeight,
109  ConsoleInfo->CodePage);
110 }
111 
112 BOOL
114  IN HDC hDC OPTIONAL,
115  IN HFONT hFont,
116  OUT PUINT Height,
117  OUT PUINT Width)
118 {
119  BOOL Success = FALSE;
120  HDC hOrgDC = hDC;
121  HFONT hOldFont;
122  // LONG LogSize, PointSize;
124  TEXTMETRICW tm;
125  // SIZE CharSize;
126 
127  if (!hDC)
128  hDC = GetDC(NULL);
129 
130  hOldFont = SelectObject(hDC, hFont);
131  if (hOldFont == NULL)
132  {
133  DPRINT1("GetFontCellSize: SelectObject failed\n");
134  goto Quit;
135  }
136 
137 /*
138  * See also: Display_SetTypeFace in applications/fontview/display.c
139  */
140 
141  /*
142  * Note that the method with GetObjectW just returns
143  * the original parameters with which the font was created.
144  */
145  if (!GetTextMetricsW(hDC, &tm))
146  {
147  DPRINT1("GetFontCellSize: GetTextMetrics failed\n");
148  goto Cleanup;
149  }
150 
151  CharHeight = tm.tmHeight + tm.tmExternalLeading;
152 
153 #if 0
154  /* Measure real char width more precisely if possible */
155  if (GetTextExtentPoint32W(hDC, L"R", 1, &CharSize))
156  CharWidth = CharSize.cx;
157 #else
158  CharWidth = tm.tmAveCharWidth; // tm.tmMaxCharWidth;
159 #endif
160 
161 #if 0
162  /*** Logical to Point size ***/
163  LogSize = tm.tmHeight - tm.tmInternalLeading;
164  PointSize = MulDiv(LogSize, 72, GetDeviceCaps(hDC, LOGPIXELSY));
165  /*****************************/
166 #endif
167 
168  *Height = (UINT)CharHeight;
169  *Width = (UINT)CharWidth;
170  Success = TRUE;
171 
172 Cleanup:
173  SelectObject(hDC, hOldFont);
174 Quit:
175  if (!hOrgDC)
176  ReleaseDC(NULL, hDC);
177 
178  return Success;
179 }
180 
181 BOOL
183  IN PLOGFONTW lplf,
184  IN PNEWTEXTMETRICW lpntm,
185  IN DWORD FontType,
186  IN UINT CodePage)
187 {
188  LPCWSTR FaceName = lplf->lfFaceName;
189 
190  /*
191  * According to: https://web.archive.org/web/20140901124501/http://support.microsoft.com/kb/247815
192  * "Necessary criteria for fonts to be available in a command window",
193  * the criteria for console-eligible fonts are as follows:
194  * - The font must be a fixed-pitch font.
195  * - The font cannot be an italic font.
196  * - The font cannot have a negative A or C space.
197  * - If it is a TrueType font, it must be FF_MODERN.
198  * - If it is not a TrueType font, it must be OEM_CHARSET.
199  *
200  * Non documented: vertical fonts are forbidden (their name start with a '@').
201  *
202  * Additional criteria for Asian installations:
203  * - If it is not a TrueType font, the face name must be "Terminal".
204  * - If it is an Asian TrueType font, it must also be an Asian character set.
205  *
206  * See also Raymond Chen's blog: https://devblogs.microsoft.com/oldnewthing/?p=26843
207  * and MIT-licensed Microsoft Terminal source code: https://github.com/microsoft/Terminal/blob/master/src/propsheet/misc.cpp
208  * for other details.
209  *
210  * To install additional TrueType fonts to be available for the console,
211  * add entries of type REG_SZ named "0", "00" etc... in:
212  * HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont
213  * The names of the fonts listed there should match those in:
214  * HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Fonts
215  */
216 
217  /*
218  * In ReactOS we relax some of the criteria:
219  * - We allow fixed-pitch FF_MODERN (Monospace) TrueType fonts
220  * that can be italic or have negative A or C space.
221  * - If it is not a TrueType font, it can be from another character set
222  * than OEM_CHARSET. When an Asian codepage is active however, we require
223  * that this non-TrueType font has an Asian character set.
224  */
225 
226  /* Reject variable-width fonts ... */
227  if ( ( ((lplf->lfPitchAndFamily & 0x03) != FIXED_PITCH)
228 #if 0 /* Reject italic and TrueType fonts with negative A or C space ... */
229  || (lplf->lfItalic)
230  || !(lpntm->ntmFlags & NTM_NONNEGATIVE_AC)
231 #endif
232  ) &&
233  /* ... if they are not in the list of additional TrueType fonts to include */
234  !IsAdditionalTTFont(FaceName) )
235  {
236  DPRINT1("Font '%S' rejected because it%s (lfPitchAndFamily = %d)\n",
237  FaceName,
238  !(lplf->lfPitchAndFamily & FIXED_PITCH) ? "'s not FIXED_PITCH"
239  : (!(lpntm->ntmFlags & NTM_NONNEGATIVE_AC) ? " has negative A or C space"
240  : " is broken"),
241  lplf->lfPitchAndFamily);
242  return FALSE;
243  }
244 
245  /* Reject TrueType fonts that are not FF_MODERN */
246  if ((FontType == TRUETYPE_FONTTYPE) && ((lplf->lfPitchAndFamily & 0xF0) != FF_MODERN))
247  {
248  DPRINT1("TrueType font '%S' rejected because it's not FF_MODERN (lfPitchAndFamily = %d)\n",
249  FaceName, lplf->lfPitchAndFamily);
250  return FALSE;
251  }
252 
253  /* Reject vertical fonts (tategaki) */
254  if (FaceName[0] == L'@')
255  {
256  DPRINT1("Font '%S' rejected because it's vertical\n", FaceName);
257  return FALSE;
258  }
259 
260  /* Is the current code page Chinese, Japanese or Korean? */
261  if (IsCJKCodePage(CodePage))
262  {
263  /* It's CJK */
264 
265  if (FontType == TRUETYPE_FONTTYPE)
266  {
267  /*
268  * Here we are inclusive and check for any CJK character set,
269  * instead of looking just at the current one via CodePageToCharSet().
270  */
271  if (!IsCJKCharSet(lplf->lfCharSet)
272 #if 1 // FIXME: Temporary HACK!
273  && wcscmp(FaceName, L"Terminal") != 0
274 #endif
275  )
276  {
277  DPRINT1("TrueType font '%S' rejected because it's not Asian charset (lfCharSet = %d)\n",
278  FaceName, lplf->lfCharSet);
279  return FALSE;
280  }
281 
282  /*
283  * If this is a cached TrueType font that is used only for certain
284  * code pages, verify that the charset it claims is the correct one.
285  *
286  * Since there may be multiple entries for a cached TrueType font,
287  * a general one (code page == 0) and one or more for explicit
288  * code pages, we need to perform two search queries instead of
289  * just one and retrieving the code page for this entry.
290  */
291  if (IsAdditionalTTFont(FaceName) && !IsAdditionalTTFontCP(FaceName, 0) &&
292  !IsCJKCharSet(lplf->lfCharSet))
293  {
294  DPRINT1("Cached TrueType font '%S' rejected because it claims a code page that is not Asian charset (lfCharSet = %d)\n",
295  FaceName, lplf->lfCharSet);
296  return FALSE;
297  }
298  }
299  else
300  {
301  /* Reject non-TrueType fonts that do not have an Asian character set */
302  if (!IsCJKCharSet(lplf->lfCharSet) && (lplf->lfCharSet != OEM_CHARSET))
303  {
304  DPRINT1("Non-TrueType font '%S' rejected because it's not Asian charset or OEM_CHARSET (lfCharSet = %d)\n",
305  FaceName, lplf->lfCharSet);
306  return FALSE;
307  }
308 
309  /* Reject non-TrueType fonts that are not Terminal */
310  if (wcscmp(FaceName, L"Terminal") != 0)
311  {
312  DPRINT1("Non-TrueType font '%S' rejected because it's not 'Terminal'\n", FaceName);
313  return FALSE;
314  }
315  }
316  }
317  else
318  {
319  /* Not CJK */
320 
321  /* Reject non-TrueType fonts that are not OEM or similar */
322  if ((FontType != TRUETYPE_FONTTYPE) &&
323  (lplf->lfCharSet != ANSI_CHARSET) &&
324  (lplf->lfCharSet != DEFAULT_CHARSET) &&
325  (lplf->lfCharSet != OEM_CHARSET))
326  {
327  DPRINT1("Non-TrueType font '%S' rejected because it's not ANSI_CHARSET or DEFAULT_CHARSET or OEM_CHARSET (lfCharSet = %d)\n",
328  FaceName, lplf->lfCharSet);
329  return FALSE;
330  }
331  }
332 
333  /* All good */
334  return TRUE;
335 }
336 
338 {
342 
343 static BOOL CALLBACK
345  IN PLOGFONTW lplf,
346  IN PNEWTEXTMETRICW lpntm,
347  IN DWORD FontType,
348  IN LPARAM lParam)
349 {
351  Param->IsValidFont = IsValidConsoleFont2(lplf, lpntm, FontType, Param->CodePage);
352 
353  /* Stop the enumeration now */
354  return FALSE;
355 }
356 
357 BOOL
359  IN LPCWSTR FaceName,
360  IN UINT CodePage)
361 {
363  HDC hDC;
364  LOGFONTW lf;
365 
366  Param.IsValidFont = FALSE;
367  Param.CodePage = CodePage;
368 
369  RtlZeroMemory(&lf, sizeof(lf));
370  lf.lfCharSet = DEFAULT_CHARSET; // CodePageToCharSet(CodePage);
371  // lf.lfPitchAndFamily = FIXED_PITCH | FF_MODERN;
372  StringCchCopyW(lf.lfFaceName, ARRAYSIZE(lf.lfFaceName), FaceName);
373 
374  hDC = GetDC(NULL);
376  ReleaseDC(NULL, hDC);
377 
378  return Param.IsValidFont;
379 }
380 
381 /*
382  * To install additional TrueType fonts to be available for the console,
383  * add entries of type REG_SZ named "0", "00" etc... in:
384  * HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont
385  * The names of the fonts listed there should match those in:
386  * HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Fonts
387  *
388  * This function initializes the cache of the fonts listed there.
389  */
390 VOID
392 {
394  HKEY hKeyTTFonts; // hKey;
395  DWORD dwNumValues = 0;
396  DWORD dwIndex;
397  DWORD dwType;
398  WCHAR szValueName[MAX_PATH];
399  DWORD dwValueName;
400  WCHAR szValue[LF_FACESIZE] = L"";
401  DWORD dwValue;
402  PTT_FONT_ENTRY FontEntry;
403  PWCHAR pszNext = NULL;
404  UINT CodePage;
405 
406  if (!IsListEmpty(&TTFontCache))
407  return;
408  // InitializeListHead(&TTFontCache);
409 
410  /* Open the key */
411  // "\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Console\\TrueTypeFont"
413  L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Console\\TrueTypeFont",
414  0,
415  KEY_READ,
416  &hKeyTTFonts) == ERROR_SUCCESS);
417  if (!Success)
418  return;
419 
420  /* Enumerate each value */
421  if (RegQueryInfoKeyW(hKeyTTFonts, NULL, NULL, NULL, NULL, NULL, NULL,
422  &dwNumValues, NULL, NULL, NULL, NULL) != ERROR_SUCCESS)
423  {
424  DPRINT("ConCfgReadUserSettings: RegQueryInfoKeyW failed\n");
425  RegCloseKey(hKeyTTFonts);
426  return;
427  }
428 
429  for (dwIndex = 0; dwIndex < dwNumValues; dwIndex++)
430  {
431  dwValue = sizeof(szValue);
432  dwValueName = ARRAYSIZE(szValueName);
433  if (RegEnumValueW(hKeyTTFonts, dwIndex, szValueName, &dwValueName, NULL, &dwType, (BYTE*)szValue, &dwValue) != ERROR_SUCCESS)
434  {
435  DPRINT1("InitTTFontCache: RegEnumValueW failed, continuing...\n");
436  continue;
437  }
438  /* Only (multi-)string values are supported */
439  if ((dwType != REG_SZ) && (dwType != REG_MULTI_SZ))
440  continue;
441 
442  /* The value name is a code page (in decimal), validate it */
443  CodePage = wcstoul(szValueName, &pszNext, 10);
444  if (*pszNext)
445  continue; // Non-numerical garbage followed...
446  // IsValidCodePage(CodePage);
447 
448  FontEntry = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*FontEntry));
449  if (!FontEntry)
450  {
451  DPRINT1("InitTTFontCache: Failed to allocate memory, continuing...\n");
452  continue;
453  }
454 
455  FontEntry->CodePage = CodePage;
456 
457  pszNext = szValue;
458 
459  /* Check whether bold is disabled for this font */
460  if (*pszNext == L'*')
461  {
462  FontEntry->DisableBold = TRUE;
463  ++pszNext;
464  }
465  else
466  {
467  FontEntry->DisableBold = FALSE;
468  }
469 
470  /* Copy the font name */
471  StringCchCopyNW(FontEntry->FaceName, ARRAYSIZE(FontEntry->FaceName),
472  pszNext, wcslen(pszNext));
473 
474  if (dwType == REG_MULTI_SZ)
475  {
476  /* There may be an alternate face name as the second string */
477  pszNext += wcslen(pszNext) + 1;
478 
479  /* Check whether bold is disabled for this font */
480  if (*pszNext == L'*')
481  {
482  FontEntry->DisableBold = TRUE;
483  ++pszNext;
484  }
485  // else, keep the original setting.
486 
487  /* Copy the alternate font name */
488  StringCchCopyNW(FontEntry->FaceNameAlt, ARRAYSIZE(FontEntry->FaceNameAlt),
489  pszNext, wcslen(pszNext));
490  }
491 
492  InsertTailList(&TTFontCache, &FontEntry->Entry);
493  }
494 
495  /* Close the key and quit */
496  RegCloseKey(hKeyTTFonts);
497 }
498 
499 VOID
501 {
503  PTT_FONT_ENTRY FontEntry;
504 
505  while (!IsListEmpty(&TTFontCache))
506  {
509  RtlFreeHeap(RtlGetProcessHeap(), 0, FontEntry);
510  }
512 }
513 
514 VOID
516 {
518  InitTTFontCache();
519 }
520 
523  IN LPCWSTR FaceName,
524  IN UINT CodePage)
525 {
527  PTT_FONT_ENTRY FontEntry;
528 
529  /* Search for the font in the cache */
530  for (Entry = TTFontCache.Flink;
531  Entry != &TTFontCache;
532  Entry = Entry->Flink)
533  {
535 
536  /* NOTE: The font face names are case-sensitive */
537  if ((wcscmp(FontEntry->FaceName , FaceName) == 0) ||
538  (wcscmp(FontEntry->FaceNameAlt, FaceName) == 0))
539  {
540  /* Return a match if we don't look at the code pages, or when they match */
541  if ((CodePage == INVALID_CP) || (CodePage == FontEntry->CodePage))
542  {
543  return FontEntry;
544  }
545  }
546  }
547  return NULL;
548 }
549 
550 /* EOF */
HFONT WINAPI CreateFontIndirectW(CONST LOGFONTW *lplf)
Definition: font.c:1803
#define IN
Definition: typedefs.h:38
int WINAPI EnumFontFamiliesExW(HDC hdc, LPLOGFONTW lpLogfont, FONTENUMPROCW lpEnumFontFamExProc, LPARAM lParam, DWORD dwFlags)
Definition: font.c:400
STRSAFEAPI StringCchCopyNW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:236
#define TRUE
Definition: types.h:120
#define LF_FACESIZE
Definition: dimm.idl:39
BYTE lfPitchAndFamily
Definition: dimm.idl:71
#define VARIABLE_PITCH
Definition: wingdi.h:444
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
#define IsCJKCharSet(CharSet)
Definition: font.h:40
#define ERROR_SUCCESS
Definition: deptool.c:10
#define DEFAULT_QUALITY
Definition: wingdi.h:435
#define NTM_NONNEGATIVE_AC
Definition: wingdi.h:25
struct _Entry Entry
Definition: kefuncs.h:640
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
HDC WINAPI GetDC(_In_opt_ HWND)
#define KEY_READ
Definition: nt_native.h:1023
#define FF_DECORATIVE
Definition: wingdi.h:446
LONG lfHeight
Definition: dimm.idl:59
BYTE lfCharSet
Definition: dimm.idl:67
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:603
BYTE lfClipPrecision
Definition: dimm.idl:69
static HDC
Definition: imagelist.c:92
#define CALLBACK
Definition: compat.h:27
BYTE CodePageToCharSet(IN UINT CodePage)
Definition: font.c:32
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
LONG lfEscapement
Definition: dimm.idl:61
UINT CodePage
Definition: font.h:51
uint16_t * PWCHAR
Definition: typedefs.h:54
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define InsertTailList(ListHead, Entry)
#define DEFAULT_CHARSET
Definition: wingdi.h:383
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
HFONT hFont
Definition: main.c:53
VOID InitTTFontCache(VOID)
Definition: font.c:391
#define IsAdditionalTTFont(FaceName)
Definition: font.h:125
VOID ClearTTFontCache(VOID)
Definition: font.c:500
#define IsCJKCodePage(CodePage)
Definition: font.h:23
LIST_ENTRY TTFontCache
Definition: font.c:26
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define FIXED_PITCH
Definition: wingdi.h:443
LONG lfOrientation
Definition: dimm.idl:62
#define REG_MULTI_SZ
Definition: nt_native.h:1501
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
#define CLIP_DEFAULT_PRECIS
Definition: wingdi.h:425
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
UINT ciCharset
Definition: wingdi.h:1524
unsigned char BOOLEAN
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2867
LONG lfWidth
Definition: dimm.idl:60
smooth NULL
Definition: ftsmooth.c:416
HFONT CreateConsoleFont2(IN LONG Height, IN LONG Width OPTIONAL, IN OUT PCONSOLE_STATE_INFO ConsoleInfo)
Definition: font.c:81
static BOOL CALLBACK IsValidConsoleFontProc(IN PLOGFONTW lplf, IN PNEWTEXTMETRICW lpntm, IN DWORD FontType, IN LPARAM lParam)
Definition: font.c:344
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
LONG_PTR LPARAM
Definition: windef.h:208
void DPRINT(...)
Definition: polytest.cpp:61
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define UlongToPtr(u)
Definition: config.h:106
BYTE lfOutPrecision
Definition: dimm.idl:68
BOOL GetFontCellSize(IN HDC hDC OPTIONAL, IN HFONT hFont, OUT PUINT Height, OUT PUINT Width)
Definition: font.c:113
static int CharHeight
Definition: carets.c:8
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:585
LIST_ENTRY Entry
Definition: font.h:50
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
#define OUT_DEFAULT_PRECIS
Definition: wingdi.h:414
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3704
static int CharWidth
Definition: carets.c:7
#define INVALID_CP
Definition: stream.h:53
#define OEM_CHARSET
Definition: wingdi.h:399
BYTE lfQuality
Definition: dimm.idl:70
static const WCHAR L[]
Definition: oid.c:1250
WCHAR FaceName[LF_FACESIZE]
Definition: font.h:53
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
unsigned char BYTE
Definition: mem.h:68
Definition: typedefs.h:117
Definition: time.h:76
#define FF_ROMAN
Definition: wingdi.h:449
static const WCHAR Cleanup[]
Definition: register.c:80
BOOL DisableBold
Definition: font.h:52
BOOL WINAPI TranslateCharsetInfo(LPDWORD lpSrc, LPCHARSETINFO lpCs, DWORD flags)
Definition: font.c:2186
static HDC hDC
Definition: 3dtext.c:33
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define FF_SWISS
Definition: wingdi.h:451
VOID RefreshTTFontCache(VOID)
Definition: font.c:515
Definition: font.h:48
FARPROC FONTENUMPROCW
Definition: wingdi.h:2875
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
PTT_FONT_ENTRY FindCachedTTFont(IN LPCWSTR FaceName, IN UINT CodePage)
Definition: font.c:522
static CONSOLE_SCREEN_BUFFER_INFO ConsoleInfo
Definition: video.c:47
#define FF_MODERN
Definition: wingdi.h:448
unsigned int UINT
Definition: ndis.h:50
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
HFONT CreateConsoleFontEx(IN LONG Height, IN LONG Width OPTIONAL, IN OUT LPWSTR FaceName, IN ULONG FontFamily, IN ULONG FontWeight, IN UINT CodePage)
Definition: font.c:43
struct _IS_VALID_CONSOLE_FONT_PARAM * PIS_VALID_CONSOLE_FONT_PARAM
#define FF_SCRIPT
Definition: wingdi.h:450
#define DPRINT1
Definition: precomp.h:8
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define TCI_SRCCODEPAGE
Definition: wingdi.h:961
HFONT CreateConsoleFont(IN OUT PCONSOLE_STATE_INFO ConsoleInfo)
Definition: font.c:95
BOOL IsValidConsoleFont2(IN PLOGFONTW lplf, IN PNEWTEXTMETRICW lpntm, IN DWORD FontType, IN UINT CodePage)
Definition: font.c:182
WCHAR FaceNameAlt[LF_FACESIZE]
Definition: font.h:54
#define OUT
Definition: typedefs.h:39
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
unsigned int ULONG
Definition: retypes.h:1
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define LOGPIXELSY
Definition: wingdi.h:718
struct _IS_VALID_CONSOLE_FONT_PARAM IS_VALID_CONSOLE_FONT_PARAM
LONG lfWeight
Definition: dimm.idl:63
#define ANSI_CHARSET
Definition: wingdi.h:382
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPARAM lParam
Definition: combotst.c:139
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define MulDiv(x, y, z)
Definition: gdifloat.h:86
base of all file and directory entries
Definition: entries.h:82
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
unsigned int * PUINT
Definition: ndis.h:50
BOOL IsValidConsoleFont(IN LPCWSTR FaceName, IN UINT CodePage)
Definition: font.c:358
#define TRUETYPE_FONTTYPE
Definition: wingdi.h:1091
#define IsAdditionalTTFontCP(FaceName, CodePage)
Definition: font.h:128
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68