Skip to content

Commit

Permalink
[NTGDI][FREETYPE][SETUP][INF] Support FontLink (reactos#7009)
Browse files Browse the repository at this point in the history
If East Asian people were unable
to see the Latin characters, it
becomes a barrier to mutual
understanding.
FontLink will break that barrier.
JIRA issue: CORE-9616
JIRA issue: CORE-15480
- Modify font substitutes.
- Unify the lock variables.
- Add FONTLINK and
  FONTLINK_CHAIN structures.
- Add FontLink_Create and
  FontLink_Destroy functions.
- Add FontLink_Chain_Init,
  FontLink_Chain_Free,
  FontLink_Chain_LoadReg,
  FontLink_Chain_Populate, and
  FontLink_Chain_FindGlyph
  functions.
- Implement FontLink.
- Add font file DroidSansFallback.ttf
  for LiveCD.
  • Loading branch information
katahiromz authored Jun 30, 2024
1 parent f28e983 commit 0f9e889
Show file tree
Hide file tree
Showing 9 changed files with 840 additions and 103 deletions.
26 changes: 8 additions & 18 deletions base/setup/lib/muifonts.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ MUI_SUBFONT ChineseSimplifiedFonts[] =
{ L"Courier New Greek,161", L"Courier New,161" },
{ L"Courier New TUR,162", L"Courier New,162" },
{ L"Fixedsys", L"Fixedsys Excelsior 3.01-L2" },
{ L"Franklin Gothic Medium", L"Droid Sans Fallback" },
{ L"Helv", L"MS Sans Serif" },
{ L"Helvetica", L"Arial" },
{ L"MS Sans Serif", L"Droid Sans Fallback" },
Expand All @@ -161,9 +160,6 @@ MUI_SUBFONT ChineseSimplifiedFonts[] =
{ L"Segoe UI Symbol", L"Arial" },
{ L"SimHei", L"Droid Sans Fallback" },
{ L"SimSun", L"Droid Sans Fallback" },
{ L"Source Sans Pro", L"Droid Sans Fallback" },
{ L"System", L"Droid Sans Fallback" },
{ L"Tahoma", L"Droid Sans Fallback" },
{ L"Terminal", L"Lucida Console" },
{ L"Times", L"Times New Roman" },
{ L"Times New Roman Baltic,186", L"Times New Roman,186" },
Expand Down Expand Up @@ -202,7 +198,6 @@ MUI_SUBFONT ChineseTraditionalFonts[] =
{ L"DLCMingBold", L"Droid Sans Fallback" },
{ L"DLCMingMedium", L"Droid Sans Fallback" },
{ L"Fixedsys", L"Fixedsys Excelsior 3.01-L2" },
{ L"Franklin Gothic Medium", L"Droid Sans Fallback" },
{ L"Helv", L"MS Sans Serif" },
{ L"Helvetica", L"Arial" },
{ L"MS Sans Serif", L"Droid Sans Fallback" },
Expand All @@ -214,9 +209,6 @@ MUI_SUBFONT ChineseTraditionalFonts[] =
{ L"MingLiU", L"Droid Sans Fallback" },
{ L"PMingLiU", L"Droid Sans Fallback" },
{ L"Segoe UI Symbol", L"Arial" },
{ L"Source Sans Pro", L"Droid Sans Fallback" },
{ L"System", L"Droid Sans Fallback" },
{ L"Tahoma", L"Droid Sans Fallback" },
{ L"Terminal", L"Lucida Console" },
{ L"Times", L"Times New Roman" },
{ L"Times New Roman Baltic,186", L"Times New Roman,186" },
Expand Down Expand Up @@ -252,7 +244,6 @@ MUI_SUBFONT JapaneseFonts[] =
{ L"Courier New Greek,161", L"Courier New,161" },
{ L"Courier New TUR,162", L"Courier New,162" },
{ L"Fixedsys", L"Fixedsys Excelsior 3.01-L2" },
{ L"Franklin Gothic Medium", L"Droid Sans Fallback" },
{ L"Helv", L"MS Sans Serif" },
{ L"Helvetica", L"Arial" },
{ L"MS Gothic", L"Droid Sans Fallback" },
Expand All @@ -265,9 +256,6 @@ MUI_SUBFONT JapaneseFonts[] =
{ L"MS UI Gothic", L"Droid Sans Fallback" },
{ L"MS UI Gothic 2", L"Droid Sans Fallback" },
{ L"Segoe UI Symbol", L"Arial" },
{ L"Source Sans Pro", L"Droid Sans Fallback" },
{ L"System", L"Droid Sans Fallback" },
{ L"Tahoma", L"Droid Sans Fallback" },
{ L"Terminal", L"Lucida Console" },
{ L"Times", L"Times New Roman" },
{ L"Times New Roman Baltic,186", L"Times New Roman,186" },
Expand All @@ -287,10 +275,12 @@ MUI_SUBFONT JapaneseFonts[] =

WCHAR KF_LocalName0[] = {0xBC14, 0xD0D5, 0}; /* Batang */
WCHAR KF_LocalName1[] = {0xBC14, 0xD0D5, 0xCCB4, 0}; /* BatangChe */
WCHAR KF_LocalName2[] = {0xAD81, 0xC11C, 0}; /* Gungsuh */
WCHAR KF_LocalName3[] = {0xAD81, 0xC11C, 0xCCB4, 0}; /* GungsuhChe */
WCHAR KF_LocalName2[] = {0xB3CB, 0xC6C0, 0}; /* Dotum */
WCHAR KF_LocalName3[] = {0xB3CB, 0xC6C0, 0xCCB4, 0}; /* DotumChe */
WCHAR KF_LocalName4[] = {0xAD74, 0xB9BC, 0}; /* Gulim */
WCHAR KF_LocalName5[] = {0xAD74, 0xB9BC, 0xCCB4, 0}; /* GulimChe */
WCHAR KF_LocalName6[] = {0xAD81, 0xC11C, 0}; /* Gungsuh */
WCHAR KF_LocalName7[] = {0xAD81, 0xC11C, 0xCCB4, 0}; /* GungsuhChe */
MUI_SUBFONT KoreanFonts[] =
{
{ L"Arial Baltic,186", L"Arial,186" },
Expand All @@ -306,8 +296,9 @@ MUI_SUBFONT KoreanFonts[] =
{ L"Courier New CYR,204", L"Courier New,204" },
{ L"Courier New Greek,161", L"Courier New,161" },
{ L"Courier New TUR,162", L"Courier New,162" },
{ L"Dotum", L"Droid Sans Fallback" },
{ L"DotumChe", L"Droid Sans Fallback" },
{ L"Fixedsys", L"Fixedsys Excelsior 3.01-L2" },
{ L"Franklin Gothic Medium", L"Droid Sans Fallback" },
{ L"Gulim", L"Droid Sans Fallback" },
{ L"GulimChe", L"Droid Sans Fallback" },
{ L"Gungsuh", L"Droid Sans Fallback" },
Expand All @@ -320,9 +311,6 @@ MUI_SUBFONT KoreanFonts[] =
{ L"MS UI Gothic", L"Droid Sans Fallback" },
{ L"MS UI Gothic 2", L"Droid Sans Fallback" },
{ L"Segoe UI Symbol", L"Arial" },
{ L"Source Sans Pro", L"Droid Sans Fallback" },
{ L"System", L"Droid Sans Fallback" },
{ L"Tahoma", L"Droid Sans Fallback" },
{ L"Terminal", L"Lucida Console" },
{ L"Times", L"Times New Roman" },
{ L"Times New Roman Baltic,186", L"Times New Roman,186" },
Expand All @@ -339,6 +327,8 @@ MUI_SUBFONT KoreanFonts[] =
{ KF_LocalName3, L"Droid Sans Fallback" },
{ KF_LocalName4, L"Droid Sans Fallback" },
{ KF_LocalName5, L"Droid Sans Fallback" },
{ KF_LocalName6, L"Droid Sans Fallback" },
{ KF_LocalName7, L"Droid Sans Fallback" },
{ NULL, NULL }
};

Expand Down
6 changes: 4 additions & 2 deletions boot/bootdata/hivesft.inf
Original file line number Diff line number Diff line change
Expand Up @@ -627,12 +627,14 @@ HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink","Microso
"msgothic.ttc,MS UI Gothic",\
"mingliu.ttc,PMingLiU",\
"simsun.ttc,SimSun",\
"gulim.ttc,Gulim"
"gulim.ttc,Gulim",\
"tahoma.ttf,Tahoma"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink","Lucida Sans Unicode",0x00010000,\
"msgothic.ttc,MS UI Gothic",\
"mingliu.ttc,PMingLiU",\
"simsun.ttc,SimSun",\
"gulim.ttc,Gulim"
"gulim.ttc,Gulim",\
"tahoma.ttf,Tahoma"

; FontLink (Chinese to others)
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink","MingLiU",0x00010000,\
Expand Down
7 changes: 7 additions & 0 deletions boot/bootdata/hivesys.inf
Original file line number Diff line number Diff line change
Expand Up @@ -2227,6 +2227,13 @@ HKLM,"SYSTEM\Setup","SystemSetupInProgress",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Control\PriorityControl",,0x00000012
HKLM,"SYSTEM\CurrentControlSet\Control\PriorityControl","Win32PrioritySeparation",0x00010001,0x2

; FontLink settings
HKLM,"SYSTEM\CurrentControlSet\Control\FontAssoc\Associated Charset","ANSI(00)",0x00000000,"NO"
HKLM,"SYSTEM\CurrentControlSet\Control\FontAssoc\Associated Charset","OEM(FF)",0x00000000,"NO"
HKLM,"SYSTEM\CurrentControlSet\Control\FontAssoc\Associated Charset","SYMBOL(02)",0x00000000,"NO"
HKLM,"SYSTEM\CurrentControlSet\Control\FontAssoc\Associated DefaultFonts","AssocSystemFont",0x00000000,"DroidSansFallback.ttf"
HKLM,"SYSTEM\CurrentControlSet\Control\FontAssoc\Associated DefaultFonts","FontPackage",0x00000000,"Droid Sans Fallback"

[AddReg.NTarm]
; RAM Disk class driver
HKLM,"SYSTEM\CurrentControlSet\Services\Disk","ErrorControl",0x00010001,0x00000000
Expand Down
24 changes: 24 additions & 0 deletions boot/bootdata/livecd.inf
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,30 @@ HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Segoe UI Sy
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Terminal",0x00000000,"Lucida Console"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Times",0x00000000,"Times New Roman"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Tms Rmn",0x00000000,"Times New Roman"
; Font Substitution (East Asian, English names)
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Batang",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","BatangChe",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","DLCMingBold",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","DLCMingMedium",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Dotum",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","DotumChe",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Gulim",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","GulimChe",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Gungsuh",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","GungsuhChe",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","MS Gothic",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","MS Mincho",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","MS PGothic",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","MS PMincho",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","MS Song",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","MS UI Gothic",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","MS UI Gothic 2",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Ming Light",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","MingLiU",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","NSimSun",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","PMingLiU",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","SimHei",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","SimSun",0x00000000,"Droid Sans Fallback"

; FIXME: Registration

Expand Down
2 changes: 0 additions & 2 deletions media/inf/font.inf
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","MS Shell Dl
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","MS UI Gothic",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","MS UI Gothic 2",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Segoe UI Symbol",0x00000000,"Arial"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Source Sans Pro",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Tahoma",0x00000000,"Droid Sans Fallback"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Terminal",0x00000000,"Lucida Console"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Times",0x00000000,"Times New Roman"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Tms Rmn",0x00000000,"Times New Roman"
Expand Down
6 changes: 6 additions & 0 deletions modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,9 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/)
add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/${item} DESTINATION reactos/3rdParty NAME_ON_CD ${item} FOR bootcd)
endforeach(item)
endif()

# Add font file DroidSansFallback.ttf for LiveCD
# See also boot/bootdata/packages/reactos.dff.in
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/optional/DroidSansFallback.ttf)
add_cd_file(FILE "${CMAKE_CURRENT_SOURCE_DIR}/optional/DroidSansFallback.ttf" DESTINATION reactos/Fonts FOR livecd)
endif()
4 changes: 2 additions & 2 deletions win32ss/gdi/ntgdi/font.c
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ NtGdiGetOutlineTextMetricsInternalW (HDC hDC,
}
TextIntUpdateSize(dc, TextObj, FontGDI, TRUE);
TEXTOBJ_UnlockText(TextObj);
Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL);
Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL, FALSE);
if (!otm) return Size;
if (Size > Data)
{
Expand All @@ -928,7 +928,7 @@ NtGdiGetOutlineTextMetricsInternalW (HDC hDC,
return 0;
}
RtlZeroMemory(potm, Size);
IntGetOutlineTextMetrics(FontGDI, Size, potm);
IntGetOutlineTextMetrics(FontGDI, Size, potm, FALSE);

_SEH2_TRY
{
Expand Down
Loading

0 comments on commit 0f9e889

Please sign in to comment.