support STDFONT.15 for dosv=tw

This commit is contained in:
Wengier
2021-07-14 22:09:40 -04:00
parent 5e41a63613
commit 8b22015909
6 changed files with 56 additions and 23 deletions

View File

@@ -22,9 +22,10 @@
VGA fonts rather than 16-pixel VGA fonts for SBCS
characters to look better. (Wengier)
- You can now also load HZK14/HZK16 font files (for
14- and 16-pixel height) via the "fontxdbcs" and
"fontxdbcs14" options for the Simplified Chinese
DOS/V (dosv=cn) emulation. (Wengier)
14- and 16-pixel height) and STDFONT.15 font file
via the "fontxdbcs" and "fontxdbcs14" options for
Simplified Chinese DOS/V (dosv=cn) and Traditional
Chinese DOS/V (dosv=tw) emulations. (Wengier)
- Improved the DOS/V font acquisition function on
the Linux platform (both SDL1 & SDL2). A config
option "getsysfont" is added which when set to

View File

@@ -672,9 +672,11 @@ pc-98 anex86 font =
#DOSBOX-X-ADV:# fontxsbcs16: FONTX2 file used to rendering SBCS characters (8x16) in DOS/V mode.
#DOSBOX-X-ADV:# fontxsbcs24: FONTX2 file used to rendering SBCS characters (12x24) in DOS/V mode.
# fontxdbcs: FONTX2 file used to rendering DBCS characters (16x16) in DOS/V or JEGA mode. If not specified, the default one will be used.
# Loading the HZK16 font file (https://github.com/aguegu/BitmapFont/tree/master/font) is also supported for Simplified Chinese DOS/V.
# For Simplified Chinese DOS/V, loading the HZK16 font file (https://github.com/aguegu/BitmapFont/tree/master/font) is also supported.
# For Traditional Chinese DOS/V, loading the STDFONT.15 font file from the ETen Chinese DOS system is also supported.
#DOSBOX-X-ADV:# fontxdbcs14: FONTX2 file used to rendering SBCS characters (14x14) for the Configuration Tool. If not specified, the default one will be used.
#DOSBOX-X-ADV:# Loading the HZK14 font file (https://github.com/aguegu/BitmapFont/tree/master/font) is also supported for Simplified Chinese DOS/V.
#DOSBOX-X-ADV:# For Simplified Chinese DOS/V, loading the HZK14 font file (https://github.com/aguegu/BitmapFont/tree/master/font) is also supported.
#DOSBOX-X-ADV:# For Traditional Chinese DOS/V, loading the STDFONT.15 font file from the ETen Chinese DOS system is also supported.
#DOSBOX-X-ADV:# fontxdbcs24: FONTX2 file used to rendering SBCS characters (24x24) in DOS/V mode.
# gbk: Enables the GBK extension (in addition to the standard GB2312 charset) for the Simplified Chinese DOS/V emulation or TTF output.
# yen: Enables the yen symbol (¥) at 5ch if it is found at 7fh in a custom SBCS font for the Japanese DOS/V or JEGA emulation.

View File

@@ -309,7 +309,8 @@ pc-98 anex86 font =
# getsysfont: If enabled, DOSBox-X will try to get and use the system fonts on Windows and Linux platforms for the DOS/V emulation.
# fontxsbcs: FONTX2 file used to rendering SBCS characters (8x19) in DOS/V or JEGA mode. If not specified, the default one will be used.
# fontxdbcs: FONTX2 file used to rendering DBCS characters (16x16) in DOS/V or JEGA mode. If not specified, the default one will be used.
# Loading the HZK16 font file (https://github.com/aguegu/BitmapFont/tree/master/font) is also supported for Simplified Chinese DOS/V.
# For Simplified Chinese DOS/V, loading the HZK16 font file (https://github.com/aguegu/BitmapFont/tree/master/font) is also supported.
# For Traditional Chinese DOS/V, loading the STDFONT.15 font file from the ETen Chinese DOS system is also supported.
# gbk: Enables the GBK extension (in addition to the standard GB2312 charset) for the Simplified Chinese DOS/V emulation or TTF output.
# yen: Enables the yen symbol (¥) at 5ch if it is found at 7fh in a custom SBCS font for the Japanese DOS/V or JEGA emulation.
# fepcontrol: FEP control API for the DOS/V emulation.

View File

@@ -652,9 +652,11 @@ pc-98 show graphics layer on initialize = true
# fontxsbcs16: FONTX2 file used to rendering SBCS characters (8x16) in DOS/V mode.
# fontxsbcs24: FONTX2 file used to rendering SBCS characters (12x24) in DOS/V mode.
# fontxdbcs: FONTX2 file used to rendering DBCS characters (16x16) in DOS/V or JEGA mode. If not specified, the default one will be used.
# Loading the HZK16 font file (https://github.com/aguegu/BitmapFont/tree/master/font) is also supported for Simplified Chinese DOS/V.
# For Simplified Chinese DOS/V, loading the HZK16 font file (https://github.com/aguegu/BitmapFont/tree/master/font) is also supported.
# For Traditional Chinese DOS/V, loading the STDFONT.15 font file from the ETen Chinese DOS system is also supported.
# fontxdbcs14: FONTX2 file used to rendering SBCS characters (14x14) for the Configuration Tool. If not specified, the default one will be used.
# Loading the HZK14 font file (https://github.com/aguegu/BitmapFont/tree/master/font) is also supported for Simplified Chinese DOS/V.
# For Simplified Chinese DOS/V, loading the HZK14 font file (https://github.com/aguegu/BitmapFont/tree/master/font) is also supported.
# For Traditional Chinese DOS/V, loading the STDFONT.15 font file from the ETen Chinese DOS system is also supported.
# fontxdbcs24: FONTX2 file used to rendering SBCS characters (24x24) in DOS/V mode.
# gbk: Enables the GBK extension (in addition to the standard GB2312 charset) for the Simplified Chinese DOS/V emulation or TTF output.
# yen: Enables the yen symbol (¥) at 5ch if it is found at 7fh in a custom SBCS font for the Japanese DOS/V or JEGA emulation.

View File

@@ -2049,12 +2049,14 @@ void DOSBOX_SetupConfigSections(void) {
Pstring = secprop->Add_path("fontxdbcs",Property::Changeable::OnlyAtStart,"");
Pstring->Set_help("FONTX2 file used to rendering DBCS characters (16x16) in DOS/V or JEGA mode. If not specified, the default one will be used.\n"
"Loading the HZK16 font file (https://github.com/aguegu/BitmapFont/tree/master/font) is also supported for Simplified Chinese DOS/V.");
"For Simplified Chinese DOS/V, loading the HZK16 font file (https://github.com/aguegu/BitmapFont/tree/master/font) is also supported.\n"
"For Traditional Chinese DOS/V, loading the STDFONT.15 font file from the ETen Chinese DOS system is also supported.");
Pstring->SetBasic(true);
Pstring = secprop->Add_path("fontxdbcs14",Property::Changeable::OnlyAtStart,"");
Pstring->Set_help("FONTX2 file used to rendering SBCS characters (14x14) for the Configuration Tool. If not specified, the default one will be used.\n"
"Loading the HZK14 font file (https://github.com/aguegu/BitmapFont/tree/master/font) is also supported for Simplified Chinese DOS/V.");
"For Simplified Chinese DOS/V, loading the HZK14 font file (https://github.com/aguegu/BitmapFont/tree/master/font) is also supported.\n"
"For Traditional Chinese DOS/V, loading the STDFONT.15 font file from the ETen Chinese DOS system is also supported.");
Pstring = secprop->Add_path("fontxdbcs24",Property::Changeable::OnlyAtStart,"");
Pstring->Set_help("FONTX2 file used to rendering SBCS characters (24x24) in DOS/V mode.");

View File

@@ -190,16 +190,19 @@ static bool LoadFontxFile(const char *fname, int height = 16) {
#endif
}
if (getfontx2header(mfile, &head) != 0) {
if (dos.loaded_codepage == 936) {
long int sz = 0;
if (dos.loaded_codepage == 936 || dos.loaded_codepage == 950) {
fseek(mfile, 0L, SEEK_END);
long int sz = ftell(mfile);
rewind(mfile);
if (height==14) {
if (!sz||(sz%14)&&(sz%15)) {fclose(mfile);return false;}
fontdata14 = (uint8_t *)malloc(sizeof(uint8_t)*sz);
if (!fontdata14) {fclose(mfile);return false;}
fread(fontdata14, sizeof(uint8_t), sz, mfile);
fontsize14 = sizeof(uint8_t)*sz;
} else if (height==16) {
if (!sz||(sz%15)&&(sz%16)) {fclose(mfile);return false;}
fontdata16 = (uint8_t *)malloc(sizeof(uint8_t)*sz);
if (!fontdata16) {fclose(mfile);return false;}
fread(fontdata16, sizeof(uint8_t), sz, mfile);
@@ -481,13 +484,24 @@ uint8_t *GetDbcsFont(Bitu code)
memcpy(&jfont_dbcs_16[code * 32], jfont_dbcs, 32);
jfont_cache_dbcs_16[code] = 1;
} else {
if (dos.loaded_codepage == 936 && (code/0x100)>0xa0 && (code/0x100)<0xff && fontdata16) {
if (fontdata16) {
if (dos.loaded_codepage == 936 && !(fontsize16%16) && (code/0x100)>0xa0 && (code/0x100)<0xff) {
int offset = (94 * (unsigned int)((code/0x100) - 0xa0 - 1) + ((code%0x100) - 0xa0 - 1)) * 32;
if (offset + 32 <= fontsize16) {
memcpy(&jfont_dbcs_16[code * 32], fontdata16+offset, 32);
jfont_cache_dbcs_16[code] = 1;
return &jfont_dbcs_16[code * 32];
}
} else if (dos.loaded_codepage == 950 && !(fontsize16%15) && isKanji1(code/0x100)) {
int offset = -1, ser = (code/0x100 - 161) * 157 + ((code%0x100) - ((code%0x100)>160?161:64)) + ((code%0x100)>160?64:1);
if (ser >= 472 && ser <= 5872) offset = (ser-472)*30;
else if (ser >= 6281 && ser <= 13973) offset = (ser-6281)*30+162030;
if (offset>-1) {
memcpy(&jfont_dbcs_16[code * 32], fontdata16+offset, 30);
jfont_cache_dbcs_16[code] = 1;
return &jfont_dbcs_16[code * 32];
}
}
}
if (!IS_JDOSV && (dos.loaded_codepage == 936 || dos.loaded_codepage == 949 || dos.loaded_codepage == 950))
code = GetConvertedCode(code);
@@ -527,13 +541,24 @@ uint8_t *GetDbcs14Font(Bitu code, bool &is14)
is14 = true;
return jfont_dbcs;
} else {
if (dos.loaded_codepage == 936 && (code/0x100)>0xa0 && (code/0x100)<0xff && fontdata14) {
if (fontdata14) {
if (dos.loaded_codepage == 936 && !(fontsize14%14) && (code/0x100)>0xa0 && (code/0x100)<0xff) {
int offset = (94 * (unsigned int)((code/0x100) - 0xa0 - 1) + ((code%0x100) - 0xa0 - 1)) * 28;
if (offset + 28 <= fontsize14) {
memcpy(&jfont_dbcs_14[code * 28], fontdata14+offset, 28);
jfont_cache_dbcs_14[code] = 1;
return &jfont_dbcs_14[code * 28];
}
} else if (dos.loaded_codepage == 950 && !(fontsize16%15) && isKanji1(code/0x100)) {
int offset = -1, ser = (code/0x100 - 161) * 157 + ((code%0x100) - ((code%0x100)>160?161:64)) + ((code%0x100)>160?64:1);
if (ser >= 472 && ser <= 5872) offset = (ser-472)*30;
else if (ser >= 6281 && ser <= 13973) offset = (ser-6281)*30+162030;
if (offset>-1) {
memcpy(&jfont_dbcs_14[code * 28], fontdata14+offset, 28);
jfont_cache_dbcs_14[code] = 1;
return &jfont_dbcs_14[code * 28];
}
}
}
if (!IS_JDOSV && (dos.loaded_codepage == 936 || dos.loaded_codepage == 949 || dos.loaded_codepage == 950))
code = GetConvertedCode(code);