ReactOS  0.4.13-dev-455-g28ed234
font.h
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.h
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 #pragma once
11 
12 /* DEFINES ********************************************************************/
13 
14 #define INVALID_CP ((UINT)-1)
15 
16 #define CP_SHIFTJIS 932 // Japanese Shift-JIS
17 #define CP_HANGUL 949 // Korean Hangul/Wansung
18 #define CP_JOHAB 1361 // Korean Johab
19 #define CP_GB2312 936 // Chinese Simplified (GB2312)
20 #define CP_BIG5 950 // Chinese Traditional (Big5)
21 
22 /* IsFarEastCP(CodePage) */
23 #define IsCJKCodePage(CodePage) \
24  ((CodePage) == CP_SHIFTJIS || (CodePage) == CP_HANGUL || \
25  /* (CodePage) == CP_JOHAB || */ \
26  (CodePage) == CP_BIG5 || (CodePage) == CP_GB2312)
27 
28 #if !defined(_WINGDI_) || defined(NOGDI)
29 #define SHIFTJIS_CHARSET 128
30 #define HANGEUL_CHARSET 129
31 #define HANGUL_CHARSET 129 // HANGEUL_CHARSET
32 #if(WINVER >= 0x0400)
33 #define JOHAB_CHARSET 130
34 #endif /* WINVER */
35 #define GB2312_CHARSET 134
36 #define CHINESEBIG5_CHARSET 136
37 #endif /* !defined(_WINGDI_) || defined(NOGDI) */
38 
39 /* IsAnyDBCSCharSet(CharSet) */
40 #define IsCJKCharSet(CharSet) \
41  ((CharSet) == SHIFTJIS_CHARSET || (CharSet) == HANGUL_CHARSET || \
42  /* (CharSet) == JOHAB_CHARSET || */ \
43  (CharSet) == GB2312_CHARSET || (CharSet) == CHINESEBIG5_CHARSET)
44 
45 #define IsBoldFont(Weight) \
46  ((Weight) >= FW_SEMIBOLD) /* Sometimes, just > FW_MEDIUM */
47 
48 typedef struct _TT_FONT_ENTRY
49 {
56 
57 
58 /* FUNCTIONS ******************************************************************/
59 
60 BYTE
62  IN UINT CodePage);
63 
64 HFONT
66  IN LONG Height,
67  IN LONG Width OPTIONAL,
68  IN OUT LPWSTR FaceName, // Points to a WCHAR array of LF_FACESIZE elements
70  IN ULONG FontWeight,
71  IN UINT CodePage);
72 
73 HFONT
75  IN LONG Height,
76  IN LONG Width OPTIONAL,
78 
79 HFONT
82 
83 BOOL
86  IN HFONT hFont,
87  OUT PUINT Height,
88  OUT PUINT Width);
89 
90 BOOL
92  IN PLOGFONTW lplf,
93  IN PNEWTEXTMETRICW lpntm,
94  IN DWORD FontType,
95  IN UINT CodePage);
96 
97 BOOL
99  IN LPCWSTR FaceName,
100  IN UINT CodePage);
101 
102 /*
103  * To install additional TrueType fonts to be available for the console,
104  * add entries of type REG_SZ named "0", "00" etc... in:
105  * HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont
106  * The names of the fonts listed there should match those in:
107  * HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Fonts
108  *
109  * This function initializes the cache of the fonts listed there.
110  */
111 VOID
113 
114 VOID
116 
117 VOID
119 
122  IN LPCWSTR FaceName,
123  IN UINT CodePage);
124 
125 #define IsAdditionalTTFont(FaceName) \
126  (FindCachedTTFont((FaceName), INVALID_CP) != NULL)
127 
128 #define IsAdditionalTTFontCP(FaceName, CodePage) \
129  (FindCachedTTFont((FaceName), (CodePage)) != NULL)
130 
131 /* EOF */
#define IN
Definition: typedefs.h:38
#define LF_FACESIZE
Definition: dimm.idl:39
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
BYTE CodePageToCharSet(IN UINT CodePage)
Definition: font.c:32
static HDC
Definition: imagelist.c:92
VOID InitTTFontCache(VOID)
Definition: font.c:391
BOOL GetFontCellSize(IN HDC hDC OPTIONAL, IN HFONT hFont, OUT PUINT Height, OUT PUINT Width)
Definition: font.c:113
UINT CodePage
Definition: font.h:51
HFONT hFont
Definition: main.c:53
BOOL IsValidConsoleFont(IN LPCWSTR FaceName, IN UINT CodePage)
Definition: font.c:358
unsigned int BOOL
Definition: ntddk_ex.h:94
PTT_FONT_ENTRY FindCachedTTFont(IN LPCWSTR FaceName, IN UINT CodePage)
Definition: font.c:522
long LONG
Definition: pedump.c:60
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
VOID ClearTTFontCache(VOID)
Definition: font.c:500
LIST_ENTRY Entry
Definition: font.h:50
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
struct _TT_FONT_ENTRY TT_FONT_ENTRY
WCHAR FaceName[LF_FACESIZE]
Definition: font.h:53
unsigned char BYTE
Definition: mem.h:68
Definition: typedefs.h:117
BOOL DisableBold
Definition: font.h:52
VOID RefreshTTFontCache(VOID)
Definition: font.c:515
HFONT CreateConsoleFont2(IN LONG Height, IN LONG Width OPTIONAL, IN OUT PCONSOLE_STATE_INFO ConsoleInfo)
Definition: font.c:81
static HDC hDC
Definition: 3dtext.c:33
Definition: font.h:48
struct _TT_FONT_ENTRY * PTT_FONT_ENTRY
static CONSOLE_SCREEN_BUFFER_INFO ConsoleInfo
Definition: video.c:47
BOOL IsValidConsoleFont2(IN PLOGFONTW lplf, IN PNEWTEXTMETRICW lpntm, IN DWORD FontType, IN UINT CodePage)
Definition: font.c:182
unsigned int UINT
Definition: ndis.h:50
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
WCHAR FaceNameAlt[LF_FACESIZE]
Definition: font.h:54
#define OUT
Definition: typedefs.h:39
unsigned int ULONG
Definition: retypes.h:1
HFONT CreateConsoleFont(IN OUT PCONSOLE_STATE_INFO ConsoleInfo)
Definition: font.c:95
WCHAR * LPWSTR
Definition: xmlstorage.h:184
unsigned int * PUINT
Definition: ndis.h:50
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68