ReactOS 0.4.16-dev-297-gc569aee
|
#include "precomp.h"
#include <winuser.h>
#include "settings.h"
#include "font.h"
#include <debug.h>
Go to the source code of this file.
Classes | |
struct | _FIND_SUITABLE_FONT_PROC_PARAM |
struct | _IS_VALID_CONSOLE_FONT_PARAM |
Macros | |
#define | NDEBUG |
#define | DBGFNT DPRINT |
#define | DBGFNT1 DPRINT1 |
#define | TERMINAL_FACENAME L"Terminal" |
#define | DEFAULT_NON_DBCS_FONTFACE L"Lucida Console" |
#define | DEFAULT_TT_FONT_FACENAME L"__DefaultTTFont__" |
#define | TM_IS_TT_FONT(x) (((x) & TMPF_TRUETYPE) == TMPF_TRUETYPE) |
#define | SIZE_EQUAL(s1, s2) (((s1).X == (s2).X) && ((s1).Y == (s2).Y)) |
Functions | |
BYTE | CodePageToCharSet (_In_ UINT CodePage) |
Retrieves the character set associated with a given code page. | |
static BOOL CALLBACK | FindSuitableFontProc (_In_ PLOGFONTW lplf, _In_ PNEWTEXTMETRICW lpntm, _In_ DWORD FontType, _In_ LPARAM lParam) |
EnumFontFamiliesEx() callback helper for FindSuitableFont(). | |
static BOOL | FindSuitableFont (_Inout_ PFONT_DATA FontData, _In_ UINT CodePage) |
Finds a font suitable for the given code page, based on the current font and its characteristics provided in input. | |
static HFONT | CreateConsoleFontWorker (_In_ PFONT_DATA FontData, _In_ UINT CodePage) |
Validates and creates a suitable console font based on the font characteristics given in input. | |
HFONT | CreateConsoleFontEx (_In_ LONG Height, _In_opt_ LONG Width, _Inout_updates_z_(LF_FACESIZE) PWSTR FaceName, _In_ ULONG FontWeight, _In_ ULONG FontFamily, _In_ UINT CodePage, _In_ BOOL UseDefaultFallback, _Out_ PFONT_DATA FontData) |
Validates and creates a suitable console font based on the font characteristics given in input. | |
HFONT | CreateConsoleFont2 (_In_ LONG Height, _In_opt_ LONG Width, _Inout_ PCONSOLE_STATE_INFO ConsoleInfo) |
A wrapper for CreateConsoleFontEx(). | |
HFONT | CreateConsoleFont (_Inout_ PCONSOLE_STATE_INFO ConsoleInfo) |
A wrapper for CreateConsoleFontEx(). | |
_Success_ (return) | |
Retrieves the cell size for a console font. | |
BOOL | IsValidConsoleFont2 (_In_ PLOGFONTW lplf, _In_ PNEWTEXTMETRICW lpntm, _In_ DWORD FontType, _In_ UINT CodePage) |
Validates whether a given font can be supported in the console, under the specified code page. | |
static BOOL CALLBACK | IsValidConsoleFontProc (_In_ PLOGFONTW lplf, _In_ PNEWTEXTMETRICW lpntm, _In_ DWORD FontType, _In_ LPARAM lParam) |
EnumFontFamiliesEx() callback helper for IsValidConsoleFont(). | |
BOOL | IsValidConsoleFont (_In_ PCWSTR FaceName, _In_ UINT CodePage) |
Validates whether a given font can be supported in the console, under the specified code page. | |
VOID | InitTTFontCache (VOID) |
Initializes the console TrueType font cache. | |
VOID | ClearTTFontCache (VOID) |
Clears the console TrueType font cache. | |
VOID | RefreshTTFontCache (VOID) |
Refreshes the console TrueType font cache, by clearing and re-initializing it. | |
PTT_FONT_ENTRY | FindCachedTTFont (_In_reads_or_z_opt_(LF_FACESIZE) PCWSTR FaceName, _In_ UINT CodePage) |
Searches for a font in the console TrueType font cache, with the specified code page. | |
Variables | |
SINGLE_LIST_ENTRY | TTFontCache = { NULL } |
#define TM_IS_TT_FONT | ( | x | ) | (((x) & TMPF_TRUETYPE) == TMPF_TRUETYPE) |
_Success_ | ( | return | ) |
Retrieves the cell size for a console font.
[in,opt] | hDC An optional GDI device context handle. | |
[in] | hFont | The GDI handle to the font. |
[out] | Height | In case of success, receives the cell height size (in pixels). |
[out] | Width | In case of success, receives the cell height size (in pixels). |
Definition at line 686 of file font.c.
Clears the console TrueType font cache.
Definition at line 1131 of file font.c.
Referenced by InitApplet(), and RefreshTTFontCache().
Retrieves the character set associated with a given code page.
[in] | CodePage | The code page to convert. |
Definition at line 51 of file font.c.
Referenced by CON_API(), CreateConsoleFontWorker(), FindSuitableFont(), and IsValidConsoleFont().
HFONT CreateConsoleFont | ( | _Inout_ PCONSOLE_STATE_INFO | ConsoleInfo | ) |
A wrapper for CreateConsoleFontEx().
[in,out] | ConsoleInfo | A pointer to console settings information, containing in particular (in input) the face name and characteristics of the font to create with the current console code page. In output, the font information gets updated. Note that a default fallback font is always being used in case neither the specified font nor any substitute font could be found and created for the specified code page. |
Definition at line 653 of file font.c.
Referenced by RefreshFontPreview().
HFONT CreateConsoleFont2 | ( | _In_ LONG | Height, |
_In_opt_ LONG | Width, | ||
_Inout_ PCONSOLE_STATE_INFO | ConsoleInfo | ||
) |
A wrapper for CreateConsoleFontEx().
[in] | Height | The font height in cell units (pixels). |
[in,opt] | Width The font width in cell units (pixels). | |
[in,out] | ConsoleInfo | A pointer to console settings information, containing in particular (in input) the face name and characteristics of the font to create with the current console code page. In output, the font information gets updated. Note that a default fallback font is always being used in case neither the specified font nor any substitute font could be found and created for the specified code page. |
Definition at line 609 of file font.c.
Referenced by CreateConsoleFont(), and FontSizeChange().
HFONT CreateConsoleFontEx | ( | _In_ LONG | Height, |
_In_opt_ LONG | Width, | ||
_Inout_updates_z_(LF_FACESIZE) PWSTR | FaceName, | ||
_In_ ULONG | FontWeight, | ||
_In_ ULONG | FontFamily, | ||
_In_ UINT | CodePage, | ||
_In_ BOOL | UseDefaultFallback, | ||
_Out_ PFONT_DATA | FontData | ||
) |
Validates and creates a suitable console font based on the font characteristics given in input.
[in] | Height | The font height in cell units (pixels). |
[in,opt] | Width The font width in cell units (pixels). | |
[in,out] | FaceName | A pointer to a maximally LF_FACESIZE-sized buffer. In input: The buffer contains the face name of the font to try to create. In output: The buffer receives the face name of the font that has been created, in case of success. It may, or may not be, identical to the face name provided in input, in case a substitute font has been chosen. |
[in] | FontWeight | The font weight. |
[in] | FontFamily | The font family. |
[in] | CodePage | The code page the font has to support. |
[in] | UseDefaultFallback | Whether (TRUE) or not (FALSE) to use a default fallback font in case neither the specified font nor any substitute font could be found and created for the specified code page. |
[out] | FontData | The face name and characteristics of the created font. |
Definition at line 505 of file font.c.
Referenced by CreateConsoleFont2(), and InitFonts().
|
static |
Validates and creates a suitable console font based on the font characteristics given in input.
[in] | FontData | The face name and characteristics of the font to create. |
[in] | CodePage | The code page the font has to support. |
Definition at line 424 of file font.c.
Referenced by CreateConsoleFontEx().
PTT_FONT_ENTRY FindCachedTTFont | ( | _In_reads_or_z_opt_(LF_FACESIZE) PCWSTR | FaceName, |
_In_ UINT | CodePage | ||
) |
Searches for a font in the console TrueType font cache, with the specified code page.
[in,opt] | FaceName An optional pointer to a maximally LF_FACESIZE-sized buffer. The buffer contains the face name of the font to search for. |
[in] | CodePage | The code page the font has to support, or INVALID_CP when searching a font by face name only. |
Definition at line 1183 of file font.c.
Referenced by FindSuitableFont().
|
static |
Finds a font suitable for the given code page, based on the current font and its characteristics provided in input.
[in,out] | FontData | In input: The face name and characteristics of the font to search for, possibly getting a best match. In output: The face name and characteristics of the suitable font, in case of success. |
[in] | CodePage | The code page the font has to support. |
Definition at line 307 of file font.c.
Referenced by CreateConsoleFontEx().
|
static |
EnumFontFamiliesEx() callback helper for FindSuitableFont().
Definition at line 90 of file font.c.
Referenced by FindSuitableFont().
Initializes the console TrueType font cache.
Definition at line 1013 of file font.c.
Referenced by GuiInit(), InitApplet(), and RefreshTTFontCache().
Validates whether a given font can be supported in the console, under the specified code page.
[in] | FaceName | The face name of the font to validate. |
[in] | CodePage | The code page the font has to support. |
Definition at line 974 of file font.c.
Referenced by CreateConsoleFontWorker().
BOOL IsValidConsoleFont2 | ( | _In_ PLOGFONTW | lplf, |
_In_ PNEWTEXTMETRICW | lpntm, | ||
_In_ DWORD | FontType, | ||
_In_ UINT | CodePage | ||
) |
Validates whether a given font can be supported in the console, under the specified code page.
[in] | lplf | |
[in] | lpntm | |
[in] | FontType | The GDI font characteristics of the font to validate. |
[in] | CodePage | The code page the font has to support. |
Definition at line 782 of file font.c.
Referenced by EnumFaceNamesProc(), FindSuitableFontProc(), and IsValidConsoleFontProc().
|
static |
EnumFontFamiliesEx() callback helper for IsValidConsoleFont().
Definition at line 943 of file font.c.
Referenced by IsValidConsoleFont().
Refreshes the console TrueType font cache, by clearing and re-initializing it.
Definition at line 1153 of file font.c.
Referenced by GuiApplyUserSettings().
SINGLE_LIST_ENTRY TTFontCache = { NULL } |
Definition at line 32 of file font.c.
Referenced by ClearTTFontCache(), FindCachedTTFont(), and InitTTFontCache().