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
Merged
Merged
Changes from 15 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
43ec4f6
[WIN32SS][FONT] Fix stock fonts
katahiromz 9e3e8d7
Merge remote-tracking branch 'upstream/master' into stock-font-fix
katahiromz 437922e
add IntCharSetFromCodePage function and update lfCharSet of stock fonts
katahiromz dcd5512
OEM_CHARSET workaround
katahiromz 1f33f22
create CreateStockFonts function and use it
katahiromz f085b21
special handling for FAR EAST
katahiromz 5b18fb5
define CP_OEMCP and CP_MACCP
katahiromz 2c616a0
fix lfPitchAndFamily values
katahiromz dad45bf
fix DeviceDefaultFont.lfCharSet
katahiromz c14fb50
add a comment for TCI_SRCCODEPAGE
katahiromz bb28074
s/Tahoma/MS Shell Dlg/
katahiromz f7fd3d9
fix DefaultGuiFont.lfPitchAndFamily
katahiromz f18bf2c
fix
katahiromz 9ec82cb
revert font.c
katahiromz f42c8b2
add comment to IntCharSetFromCodePage
katahiromz 7e5acfb
add NULs to MingLiU and Batang strings
katahiromz 618624b
delete extra newline
katahiromz File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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,33 +68,33 @@ 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, | ||
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, /*DEFAULT_QUALITY*/ PROOF_QUALITY, VARIABLE_PITCH | FF_SWISS, L"MS Shell Dlg" | ||
{ -11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, | ||
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, /*DEFAULT_QUALITY*/ PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, L"MS Shell Dlg" | ||
}; | ||
|
||
HGDIOBJ StockObjects[NB_STOCK_OBJECTS]; | ||
|
@@ -140,6 +141,106 @@ IntCreateStockPen(DWORD dwPenStyle, | |
return hPen; | ||
} | ||
|
||
static VOID FASTCALL | ||
CreateStockFonts(void) | ||
{ | ||
USHORT ActiveCodePage, OemCodePage; | ||
BYTE bActiveCharSet, bOemCharSet; | ||
BOOL bIsCJK; | ||
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 */ | ||
bIsCJK = TRUE; | ||
wcscpy(DefaultGuiFont.lfFaceName, SimSun); | ||
break; | ||
|
||
case 950: | ||
/* Traditional Chinese */ | ||
bIsCJK = TRUE; | ||
wcscpy(DefaultGuiFont.lfFaceName, MingLiU); | ||
break; | ||
|
||
case 932: | ||
/* Japanese */ | ||
bIsCJK = TRUE; | ||
wcscpy(DefaultGuiFont.lfFaceName, L"MS UI Gothic"); | ||
break; | ||
|
||
case 949: | ||
case 1361: | ||
/* Korean */ | ||
bIsCJK = TRUE; | ||
wcscpy(DefaultGuiFont.lfFaceName, Batang); | ||
break; | ||
|
||
default: | ||
/* Otherwise */ | ||
bIsCJK = FALSE; | ||
wcscpy(DefaultGuiFont.lfFaceName, L"MS Shell Dlg"); | ||
break; | ||
} | ||
|
||
if (bIsCJK) | ||
{ | ||
OEMFixedFont.lfHeight = 18; | ||
OEMFixedFont.lfPitchAndFamily = FF_DONTCARE | FIXED_PITCH; | ||
SystemFont.lfHeight = 18; | ||
SystemFont.lfPitchAndFamily = FF_DONTCARE | VARIABLE_PITCH; | ||
DeviceDefaultFont.lfHeight = 18; | ||
DeviceDefaultFont.lfPitchAndFamily = FF_DONTCARE | VARIABLE_PITCH; | ||
SystemFixedFont.lfHeight = 18; | ||
SystemFixedFont.lfPitchAndFamily = FF_DONTCARE | FIXED_PITCH; | ||
DefaultGuiFont.lfHeight = -12; | ||
} | ||
else | ||
{ | ||
OEMFixedFont.lfHeight = 12; | ||
OEMFixedFont.lfPitchAndFamily = FF_MODERN | FIXED_PITCH; | ||
SystemFont.lfHeight = 16; | ||
SystemFont.lfPitchAndFamily = FF_SWISS | VARIABLE_PITCH; | ||
DeviceDefaultFont.lfHeight = 16; | ||
DeviceDefaultFont.lfPitchAndFamily = FF_SWISS | VARIABLE_PITCH; | ||
if (bActiveCharSet == RUSSIAN_CHARSET) | ||
{ | ||
SystemFixedFont.lfHeight = 16; | ||
SystemFixedFont.lfPitchAndFamily = FF_SWISS | FIXED_PITCH; | ||
} | ||
else | ||
{ | ||
SystemFixedFont.lfHeight = 15; | ||
SystemFixedFont.lfPitchAndFamily = FF_MODERN | FIXED_PITCH; | ||
} | ||
DefaultGuiFont.lfHeight = -11; | ||
} | ||
|
||
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 +269,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; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
OK.