mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[USETUP][BOOTDATA] Include optional CJK standard fonts (#2336)
This PR enables the developers to include the CJK standard fonts into ReactOS by adding them in Folder modules/optional. This feature is for test purpose only. You may not use the fonts illegally. The embeddable font files are: mingliu.ttc, simsun.ttc, mssong.ttf, msgothic.ttc, msmincho.ttc, gulim.ttc and batang.ttc. CORE-9619
This commit is contained in:
parent
c89e111c6a
commit
b539dd1c5a
7 changed files with 256 additions and 13 deletions
|
@ -31,6 +31,7 @@
|
|||
#include "muifonts.h"
|
||||
#include "muilanguages.h"
|
||||
#include "registry.h"
|
||||
#include "substset.h"
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
@ -498,17 +499,28 @@ AddFontsSettingsToRegistry(
|
|||
while (MuiSubFonts[uIndex].FontName != NULL)
|
||||
{
|
||||
RtlInitUnicodeString(&ValueName, MuiSubFonts[uIndex].FontName);
|
||||
Status = NtSetValueKey(KeyHandle,
|
||||
&ValueName,
|
||||
0,
|
||||
REG_SZ,
|
||||
(PVOID)MuiSubFonts[uIndex].SubFontName,
|
||||
(wcslen(MuiSubFonts[uIndex].SubFontName)+1) * sizeof(WCHAR));
|
||||
if (!NT_SUCCESS(Status))
|
||||
if (MuiSubFonts[uIndex].SubFontName)
|
||||
{
|
||||
DPRINT1("NtSetValueKey() failed (Status = %lx, uIndex = %d)\n", Status, uIndex);
|
||||
NtClose(KeyHandle);
|
||||
return FALSE;
|
||||
Status = NtSetValueKey(KeyHandle,
|
||||
&ValueName,
|
||||
0,
|
||||
REG_SZ,
|
||||
(PVOID)MuiSubFonts[uIndex].SubFontName,
|
||||
(wcslen(MuiSubFonts[uIndex].SubFontName)+1) * sizeof(WCHAR));
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("NtSetValueKey() failed (Status = %lx, uIndex = %d)\n", Status, uIndex);
|
||||
NtClose(KeyHandle);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = NtDeleteValueKey(KeyHandle, &ValueName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("NtDeleteValueKey failed, Status = %lx\n", Status);
|
||||
}
|
||||
}
|
||||
|
||||
uIndex++;
|
||||
|
@ -548,4 +560,53 @@ AddCodePage(
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef __REACTOS__ /* HACK */
|
||||
BOOL
|
||||
DoRegistryFontFixup(PFONTSUBSTSETTINGS pSettings, LANGID LangID)
|
||||
{
|
||||
if (pSettings->bFoundFontMINGLIU)
|
||||
AddFontsSettingsToRegistry(FontFixupMINGLIU);
|
||||
if (pSettings->bFoundFontSIMSUN)
|
||||
AddFontsSettingsToRegistry(FontFixupSIMSUN);
|
||||
if (pSettings->bFoundFontMSSONG)
|
||||
AddFontsSettingsToRegistry(FontFixupMSSONG);
|
||||
if (pSettings->bFoundFontMSGOTHIC)
|
||||
AddFontsSettingsToRegistry(FontFixupMSGOTHIC);
|
||||
if (pSettings->bFoundFontMSMINCHO)
|
||||
AddFontsSettingsToRegistry(FontFixupMSMINCHO);
|
||||
if (pSettings->bFoundFontGULIM)
|
||||
AddFontsSettingsToRegistry(FontFixupGULIM);
|
||||
if (pSettings->bFoundFontBATANG)
|
||||
AddFontsSettingsToRegistry(FontFixupBATANG);
|
||||
|
||||
switch (PRIMARYLANGID(LangID))
|
||||
{
|
||||
case LANG_CHINESE:
|
||||
if (SUBLANGID(LangID) == SUBLANG_CHINESE_SIMPLIFIED)
|
||||
{
|
||||
if (pSettings->bFoundFontSIMSUN)
|
||||
AddFontsSettingsToRegistry(SimplifiedChineseFontFixup);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pSettings->bFoundFontMINGLIU)
|
||||
AddFontsSettingsToRegistry(TraditionalChineseFontFixup);
|
||||
}
|
||||
break;
|
||||
|
||||
case LANG_JAPANESE:
|
||||
if (pSettings->bFoundFontMSGOTHIC)
|
||||
AddFontsSettingsToRegistry(JapaneseFontFixup);
|
||||
break;
|
||||
|
||||
case LANG_KOREAN:
|
||||
if (pSettings->bFoundFontBATANG)
|
||||
AddFontsSettingsToRegistry(KoreanFontFixup);
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif /* HACK */
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -407,3 +407,94 @@ MUI_SUBFONT HindiFonts[] =
|
|||
{ L"Tms Rmn", L"Times New Roman" },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
MUI_SUBFONT SimplifiedChineseFontFixup[] =
|
||||
{
|
||||
{ L"MS Shell Dlg", L"SimSun" },
|
||||
{ L"Tahoma", L"SimSun" },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
MUI_SUBFONT TraditionalChineseFontFixup[] =
|
||||
{
|
||||
{ L"MS Shell Dlg", L"PMingLiU" },
|
||||
{ L"Tahoma", L"PMingLiU" },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
MUI_SUBFONT JapaneseFontFixup[] =
|
||||
{
|
||||
{ L"MS Shell Dlg", L"MS UI Gothic" },
|
||||
{ L"Tahoma", L"MS UI Gothic" },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
MUI_SUBFONT KoreanFontFixup[] =
|
||||
{
|
||||
{ L"MS Shell Dlg", L"Batang" },
|
||||
{ L"Tahoma", L"Batang" },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
MUI_SUBFONT FontFixupMINGLIU[] =
|
||||
{
|
||||
{ L"MingLiU", NULL },
|
||||
{ L"PMingLiU", NULL },
|
||||
{ CTF_LocalName0, NULL },
|
||||
{ CTF_LocalName1, NULL },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
MUI_SUBFONT FontFixupSIMSUN[] =
|
||||
{
|
||||
{ L"NSimSun", NULL },
|
||||
{ L"SimSun", NULL },
|
||||
{ CSF_LocalName0, NULL },
|
||||
{ CSF_LocalName1, NULL },
|
||||
{ CSF_LocalName2, NULL },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
MUI_SUBFONT FontFixupMSSONG[] =
|
||||
{
|
||||
{ L"MS Song", NULL },
|
||||
{ CSF_LocalName4, NULL },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
MUI_SUBFONT FontFixupMSGOTHIC[] =
|
||||
{
|
||||
{ L"MS Gothic", NULL },
|
||||
{ L"MS PGothic", NULL },
|
||||
{ L"MS UI Gothic", NULL },
|
||||
{ JF_LocalName2, NULL },
|
||||
{ JF_LocalName3, NULL },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
MUI_SUBFONT FontFixupMSMINCHO[] =
|
||||
{
|
||||
{ L"MS Mincho", NULL },
|
||||
{ L"MS PMincho", NULL },
|
||||
{ JF_LocalName0, NULL },
|
||||
{ JF_LocalName1, NULL },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
MUI_SUBFONT FontFixupGULIM[] =
|
||||
{
|
||||
{ L"Gulim", NULL },
|
||||
{ L"GulimChe", NULL },
|
||||
{ KF_LocalName4, NULL },
|
||||
{ KF_LocalName5, NULL },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
MUI_SUBFONT FontFixupBATANG[] =
|
||||
{
|
||||
{ L"Batang", NULL},
|
||||
{ L"BatangChe", NULL},
|
||||
{ KF_LocalName0, NULL},
|
||||
{ KF_LocalName1, NULL},
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
|
|
@ -917,7 +917,8 @@ UpdateRegistry(
|
|||
/**/IN PPARTLIST PartitionList, /* HACK HACK! */
|
||||
/**/IN WCHAR DestinationDriveLetter, /* HACK HACK! */
|
||||
/**/IN PCWSTR SelectedLanguageId, /* HACK HACK! */
|
||||
IN PREGISTRY_STATUS_ROUTINE StatusRoutine OPTIONAL)
|
||||
IN PREGISTRY_STATUS_ROUTINE StatusRoutine OPTIONAL,
|
||||
IN PFONTSUBSTSETTINGS SubstSettings OPTIONAL)
|
||||
{
|
||||
ERROR_NUMBER ErrorNumber;
|
||||
NTSTATUS Status;
|
||||
|
@ -1113,6 +1114,14 @@ DoUpdate:
|
|||
SetMountedDeviceValues(PartitionList);
|
||||
}
|
||||
|
||||
#ifdef __REACTOS__
|
||||
if (SubstSettings)
|
||||
{
|
||||
/* HACK */
|
||||
DoRegistryFontFixup(SubstSettings, wcstoul(SelectedLanguageId, NULL, 16));
|
||||
}
|
||||
#endif
|
||||
|
||||
Cleanup:
|
||||
//
|
||||
// TODO: Unload all the registry stuff, perform cleanup,
|
||||
|
|
|
@ -137,6 +137,8 @@ extern BOOLEAN IsUnattendedSetup;
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
#include "substset.h"
|
||||
|
||||
VOID
|
||||
CheckUnattendedSetup(
|
||||
IN OUT PUSETUP_DATA pSetupData);
|
||||
|
@ -194,6 +196,7 @@ UpdateRegistry(
|
|||
/**/IN PPARTLIST PartitionList, /* HACK HACK! */
|
||||
/**/IN WCHAR DestinationDriveLetter, /* HACK HACK! */
|
||||
/**/IN PCWSTR SelectedLanguageId, /* HACK HACK! */
|
||||
IN PREGISTRY_STATUS_ROUTINE StatusRoutine OPTIONAL);
|
||||
IN PREGISTRY_STATUS_ROUTINE StatusRoutine OPTIONAL,
|
||||
IN PFONTSUBSTSETTINGS SubstSettings OPTIONAL);
|
||||
|
||||
/* EOF */
|
||||
|
|
15
base/setup/lib/substset.h
Normal file
15
base/setup/lib/substset.h
Normal file
|
@ -0,0 +1,15 @@
|
|||
#pragma once
|
||||
|
||||
typedef struct _FONTSUBSTSETTINGS
|
||||
{
|
||||
BOOL bFoundFontMINGLIU;
|
||||
BOOL bFoundFontSIMSUN;
|
||||
BOOL bFoundFontMSSONG;
|
||||
BOOL bFoundFontMSGOTHIC;
|
||||
BOOL bFoundFontMSMINCHO;
|
||||
BOOL bFoundFontGULIM;
|
||||
BOOL bFoundFontBATANG;
|
||||
} FONTSUBSTSETTINGS, *PFONTSUBSTSETTINGS;
|
||||
|
||||
BOOL
|
||||
DoRegistryFontFixup(PFONTSUBSTSETTINGS pSettings, LANGID LangID);
|
|
@ -87,6 +87,59 @@ static FORMATMACHINESTATE FormatState = Start;
|
|||
static PNTOS_INSTALLATION CurrentInstallation = NULL;
|
||||
static PGENERIC_LIST NtOsInstallsList = NULL;
|
||||
|
||||
#ifdef __REACTOS__ /* HACK */
|
||||
|
||||
/* FONT SUBSTITUTION WORKAROUND *************************************************/
|
||||
|
||||
/* For font file check */
|
||||
FONTSUBSTSETTINGS s_SubstSettings = { FALSE };
|
||||
|
||||
static void
|
||||
DoWatchDestFileName(LPCWSTR FileName)
|
||||
{
|
||||
if (FileName[0] == 'm' || FileName[0] == 'M')
|
||||
{
|
||||
if (wcsicmp(FileName, L"mingliu.ttc") == 0)
|
||||
{
|
||||
DPRINT("mingliu.ttc found\n");
|
||||
s_SubstSettings.bFoundFontMINGLIU = TRUE;
|
||||
}
|
||||
else if (wcsicmp(FileName, L"msgothic.ttc") == 0)
|
||||
{
|
||||
DPRINT("msgothic.ttc found\n");
|
||||
s_SubstSettings.bFoundFontMSGOTHIC = TRUE;
|
||||
}
|
||||
else if (wcsicmp(FileName, L"msmincho.ttc") == 0)
|
||||
{
|
||||
DPRINT("msmincho.ttc found\n");
|
||||
s_SubstSettings.bFoundFontMSMINCHO = TRUE;
|
||||
}
|
||||
else if (wcsicmp(FileName, L"mssong.ttf") == 0)
|
||||
{
|
||||
DPRINT("mssong.ttf found\n");
|
||||
s_SubstSettings.bFoundFontMSSONG = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wcsicmp(FileName, L"simsun.ttc") == 0)
|
||||
{
|
||||
DPRINT("simsun.ttc found\n");
|
||||
s_SubstSettings.bFoundFontSIMSUN = TRUE;
|
||||
}
|
||||
else if (wcsicmp(FileName, L"gulim.ttc") == 0)
|
||||
{
|
||||
DPRINT("gulim.ttc found\n");
|
||||
s_SubstSettings.bFoundFontGULIM = TRUE;
|
||||
}
|
||||
else if (wcsicmp(FileName, L"batang.ttc") == 0)
|
||||
{
|
||||
DPRINT("batang.ttc found\n");
|
||||
s_SubstSettings.bFoundFontBATANG = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* HACK */
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
|
@ -4060,6 +4113,9 @@ FileCopyCallback(PVOID Context,
|
|||
|
||||
CONSOLE_SetStatusText(MUIGetString(STRING_COPYING),
|
||||
DstFileName);
|
||||
#ifdef __REACTOS__ /* HACK */
|
||||
DoWatchDestFileName(DstFileName);
|
||||
#endif
|
||||
}
|
||||
|
||||
SetupUpdateMemoryInfo(CopyContext, FALSE);
|
||||
|
@ -4237,7 +4293,8 @@ RegistryPage(PINPUT_RECORD Ir)
|
|||
PartitionList,
|
||||
InstallPartition->DriveLetter,
|
||||
SelectedLanguageId,
|
||||
RegistryStatus);
|
||||
RegistryStatus,
|
||||
&s_SubstSettings);
|
||||
if (Error != ERROR_SUCCESS)
|
||||
{
|
||||
MUIDisplayError(Error, Ir, POPUP_WAIT_ENTER);
|
||||
|
|
|
@ -94,6 +94,13 @@ Signature = "$Windows NT$"
|
|||
|
||||
; Optional/proprietary files
|
||||
"modules/optional/DroidSansFallback.ttf" 4 optional
|
||||
"modules/optional/mingliu.ttc" 4 optional
|
||||
"modules/optional/simsun.ttc" 4 optional
|
||||
"modules/optional/mssong.ttf" 4 optional
|
||||
"modules/optional/msgothic.ttc" 4 optional
|
||||
"modules/optional/msmincho.ttc" 4 optional
|
||||
"modules/optional/gulim.ttc" 4 optional
|
||||
"modules/optional/batang.ttc" 4 optional
|
||||
"modules/optional/NOTICE_for_Droid_Font.txt" 1 optional
|
||||
"modules/optional/netkvm.inf" 6 optional
|
||||
"modules/optional/netkvm.cat" 6 optional
|
||||
|
|
Loading…
Reference in a new issue