New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIN32SS][FONT] Fix the system logical stock font data #709
Changes from 10 commits
43ec4f6
9e3e8d7
437922e
dcd5512
1f33f22
f085b21
5b18fb5
2c616a0
dad45bf
c14fb50
bb28074
f7fd3d9
f18bf2c
9ec82cb
f42c8b2
7e5acfb
618624b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,6 +160,33 @@ static const CHARSETINFO g_FontTci[MAXTCIINDEX] = | |
{ SYMBOL_CHARSET, CP_SYMBOL, {{0,0,0,0},{FS_SYMBOL,0}} } | ||
}; | ||
|
||
#ifndef CP_OEMCP | ||
#define CP_OEMCP 1 | ||
#define CP_MACCP 2 | ||
#endif | ||
|
||
BYTE FASTCALL IntCharSetFromCodePage(UINT uCodePage) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would suggest to add a comment that refers to gdi/gdi32/objects/font.c!TranslateCharsetInfo() function, in the TCI_SRCCODEPAGE case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. |
||
{ | ||
UINT i; | ||
|
||
if (uCodePage == CP_OEMCP) | ||
return OEM_CHARSET; | ||
|
||
if (uCodePage == CP_MACCP) | ||
return MAC_CHARSET; | ||
|
||
for (i = 0; i < MAXTCIINDEX; ++i) | ||
{ | ||
if (g_FontTci[i].ciACP == 0) | ||
continue; | ||
|
||
if (g_FontTci[i].ciACP == uCodePage) | ||
return g_FontTci[i].ciCharset; | ||
} | ||
|
||
return DEFAULT_CHARSET; | ||
} | ||
|
||
/* list head */ | ||
static RTL_STATIC_LIST_HEAD(g_FontSubstListHead); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,8 @@ | |
* LICENSE: GPL - See COPYING in the top level directory | ||
* FILE: win32ss/gdi/ntgdi/stockobj.c | ||
* PURPOSE: Stock objects functions | ||
* PROGRAMMER: | ||
* PROGRAMMERS: Colin Finck <colin@reactos.org> | ||
* Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com> | ||
*/ | ||
|
||
#include <win32k.h> | ||
|
@@ -67,32 +68,32 @@ static LOGFONTW OEMFixedFont = | |
}; | ||
|
||
static LOGFONTW AnsiFixedFont = | ||
{ 14, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, | ||
{ 12, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, | ||
OUT_DEFAULT_PRECIS, /*CLIP_DEFAULT_PRECIS*/ CLIP_STROKE_PRECIS, /*DEFAULT_QUALITY*/ PROOF_QUALITY, FF_DONTCARE | FIXED_PITCH, L"Courier" | ||
}; | ||
|
||
static LOGFONTW AnsiVarFont = | ||
{ 11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, | ||
{ 12, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, | ||
OUT_DEFAULT_PRECIS, /*CLIP_DEFAULT_PRECIS*/ CLIP_STROKE_PRECIS, /*DEFAULT_QUALITY*/ PROOF_QUALITY, FF_DONTCARE | VARIABLE_PITCH, L"MS Sans Serif" | ||
}; | ||
|
||
static LOGFONTW SystemFont = | ||
{ 12, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, ANSI_CHARSET, | ||
{ 16, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, DEFAULT_CHARSET, | ||
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE | VARIABLE_PITCH, L"System" | ||
}; | ||
|
||
static LOGFONTW DeviceDefaultFont = | ||
{ 12, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, ANSI_CHARSET, | ||
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE | VARIABLE_PITCH, L"System" | ||
{ 16, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, ANSI_CHARSET, | ||
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_SWISS | VARIABLE_PITCH, L"System" | ||
}; | ||
|
||
static LOGFONTW SystemFixedFont = | ||
{ 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, | ||
{ 15, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, | ||
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE | FIXED_PITCH, L"Fixedsys" | ||
}; | ||
|
||
static LOGFONTW DefaultGuiFont = | ||
{ 11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, | ||
{ -11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, | ||
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, /*DEFAULT_QUALITY*/ PROOF_QUALITY, VARIABLE_PITCH | FF_SWISS, L"MS Shell Dlg" | ||
}; | ||
|
||
|
@@ -140,6 +141,87 @@ IntCreateStockPen(DWORD dwPenStyle, | |
return hPen; | ||
} | ||
|
||
static VOID FASTCALL | ||
CreateStockFonts(void) | ||
{ | ||
USHORT ActiveCodePage, OemCodePage; | ||
BYTE bActiveCharSet, bOemCharSet; | ||
static const WCHAR SimSun[] = { 0x5B8B, 0x4F53, 0 }; | ||
static const WCHAR MingLiU[] = { 0x7D30, 0x660E, 0x9AD4 }; | ||
static const WCHAR Batang[] = { 0xBC14, 0xD0D5 }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both MingLiU and Batang need a null-terminator, if they are used with wcscpy. |
||
|
||
RtlGetDefaultCodePage(&ActiveCodePage, &OemCodePage); | ||
bActiveCharSet = IntCharSetFromCodePage(ActiveCodePage); | ||
bOemCharSet = IntCharSetFromCodePage(OemCodePage); | ||
|
||
if (bOemCharSet == DEFAULT_CHARSET) | ||
bOemCharSet = OEM_CHARSET; | ||
|
||
switch (ActiveCodePage) | ||
{ | ||
case 936: | ||
/* Simplified Chinese */ | ||
wcscpy(DefaultGuiFont.lfFaceName, SimSun); | ||
DefaultGuiFont.lfHeight = -12; | ||
SystemFont.lfPitchAndFamily = FF_DONTCARE | VARIABLE_PITCH; | ||
SystemFixedFont.lfPitchAndFamily = FF_DONTCARE | FIXED_PITCH; | ||
OEMFixedFont.lfPitchAndFamily = FF_DONTCARE | FIXED_PITCH; | ||
break; | ||
|
||
case 950: | ||
/* Traditional Chinese */ | ||
/* MingLiU */ | ||
wcscpy(DefaultGuiFont.lfFaceName, MingLiU); | ||
DefaultGuiFont.lfHeight = -12; | ||
SystemFont.lfPitchAndFamily = FF_DONTCARE | VARIABLE_PITCH; | ||
SystemFixedFont.lfPitchAndFamily = FF_DONTCARE | FIXED_PITCH; | ||
OEMFixedFont.lfPitchAndFamily = FF_DONTCARE | FIXED_PITCH; | ||
break; | ||
|
||
case 932: | ||
/* Japanese */ | ||
wcscpy(DefaultGuiFont.lfFaceName, L"MS UI Gothic"); | ||
DefaultGuiFont.lfHeight = -12; | ||
SystemFont.lfPitchAndFamily = FF_DONTCARE | VARIABLE_PITCH; | ||
SystemFixedFont.lfPitchAndFamily = FF_DONTCARE | FIXED_PITCH; | ||
OEMFixedFont.lfPitchAndFamily = FF_DONTCARE | FIXED_PITCH; | ||
break; | ||
|
||
case 949: | ||
case 1361: | ||
/* Korean */ | ||
wcscpy(DefaultGuiFont.lfFaceName, Batang); | ||
DefaultGuiFont.lfHeight = -12; | ||
SystemFont.lfPitchAndFamily = FF_DONTCARE | VARIABLE_PITCH; | ||
SystemFixedFont.lfPitchAndFamily = FF_DONTCARE | FIXED_PITCH; | ||
OEMFixedFont.lfPitchAndFamily = FF_DONTCARE | FIXED_PITCH; | ||
break; | ||
|
||
default: | ||
/* Otherwise */ | ||
wcscpy(DefaultGuiFont.lfFaceName, L"Tahoma"); | ||
DefaultGuiFont.lfHeight = -11; | ||
SystemFont.lfPitchAndFamily = FF_SWISS | VARIABLE_PITCH; | ||
SystemFixedFont.lfPitchAndFamily = FF_MODERN | FIXED_PITCH; | ||
OEMFixedFont.lfPitchAndFamily = FF_MODERN | FIXED_PITCH; | ||
break; | ||
} | ||
|
||
OEMFixedFont.lfCharSet = bOemCharSet; | ||
SystemFont.lfCharSet = bActiveCharSet; | ||
DeviceDefaultFont.lfCharSet = bActiveCharSet; | ||
SystemFixedFont.lfCharSet = bActiveCharSet; | ||
DefaultGuiFont.lfCharSet = bActiveCharSet; | ||
|
||
TextIntCreateFontIndirect(&OEMFixedFont, (HFONT*)&StockObjects[OEM_FIXED_FONT]); | ||
TextIntCreateFontIndirect(&AnsiFixedFont, (HFONT*)&StockObjects[ANSI_FIXED_FONT]); | ||
TextIntCreateFontIndirect(&AnsiVarFont, (HFONT*)&StockObjects[ANSI_VAR_FONT]); | ||
TextIntCreateFontIndirect(&SystemFont, (HFONT*)&StockObjects[SYSTEM_FONT]); | ||
TextIntCreateFontIndirect(&DeviceDefaultFont, (HFONT*)&StockObjects[DEVICE_DEFAULT_FONT]); | ||
TextIntCreateFontIndirect(&SystemFixedFont, (HFONT*)&StockObjects[SYSTEM_FIXED_FONT]); | ||
TextIntCreateFontIndirect(&DefaultGuiFont, (HFONT*)&StockObjects[DEFAULT_GUI_FONT]); | ||
} | ||
|
||
/*! | ||
* Creates a bunch of stock objects: brushes, pens, fonts. | ||
*/ | ||
|
@@ -168,13 +250,7 @@ CreateStockObjects(void) | |
StockObjects[20] = NULL; /* TODO: Unknown internal stock object */ | ||
StockObjects[DEFAULT_BITMAP] = GreCreateBitmap(1, 1, 1, 1, NULL); | ||
|
||
(void) TextIntCreateFontIndirect(&OEMFixedFont, (HFONT*)&StockObjects[OEM_FIXED_FONT]); | ||
(void) TextIntCreateFontIndirect(&AnsiFixedFont, (HFONT*)&StockObjects[ANSI_FIXED_FONT]); | ||
(void) TextIntCreateFontIndirect(&AnsiVarFont, (HFONT*)&StockObjects[ANSI_VAR_FONT]); | ||
(void) TextIntCreateFontIndirect(&SystemFont, (HFONT*)&StockObjects[SYSTEM_FONT]); | ||
(void) TextIntCreateFontIndirect(&DeviceDefaultFont, (HFONT*)&StockObjects[DEVICE_DEFAULT_FONT]); | ||
(void) TextIntCreateFontIndirect(&SystemFixedFont, (HFONT*)&StockObjects[SYSTEM_FIXED_FONT]); | ||
(void) TextIntCreateFontIndirect(&DefaultGuiFont, (HFONT*)&StockObjects[DEFAULT_GUI_FONT]); | ||
CreateStockFonts(); | ||
|
||
StockObjects[DEFAULT_PALETTE] = (HGDIOBJ)gppalDefault->BaseObject.hHmgr; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I was thinking about adding the comment in IntCharSetFromCodePage(), not here.