option to load 14-pixel DBCS fonts

This commit is contained in:
Wengier
2021-06-12 04:07:34 -04:00
parent e61a970bd9
commit 46c52f2eb1
10 changed files with 66 additions and 23 deletions

View File

@@ -11,7 +11,7 @@
- Added option "turbo" in [cpu] section to enable
Turbo (Fast Forward) mode at start. You can also
change it from the command-line via CONFIG command
(e.g. config -set turbo=true). (Wengier)
(e.g. "config -set turbo=true"). (Wengier)
- For PC-98 mode, if both FONT.ROM and FREECG98.BMP
are not found, then DOSBox-X will now use internal
Japanese fonts in addition to VGA font. (Wengier)
@@ -21,9 +21,12 @@
is now enabled by default for JP mode. (Wengier)
- Added support for showing Chinese/Japanese/Korean
characters in the SDL-drawn menu (except for OpenGL
outputs) and Configuration Tool interface (so e.g.
DOS command help will show correctly). (Wengier)
- Added support for inputing Chinese/Japanese/Korean
outputs, where only SBCS code pages are supported)
and Configuration Tool interface (so for example
the DOS command help will show correctly). You can
change the DBCS font used by the Configuration Tool
interface via jdbcsfont14 config option. (Wengier)
- Added support for inputing CJK (at least Chinese)
characters using the system input method (IME) in
Windows SDL1 build. There is config option "ime" in
[dosbox] section to control it. When set to "auto"
@@ -38,8 +41,9 @@
section for the DOS/V support. (Wengier)
- Added support for Japanese EGA mode (machine=jega)
by adopting code from DOSVAX. You can optionally
set SBCS and DBCS fonts with jfontsbcs & jfontdbcs
config options in [render] section, or the default
set SBCS and DBCS fonts with jfontsbcs, jfontdbcs
(and jfontsbcs19, jfontdbcs24, etc) config options
in [render] section of config file, or the default
fonts will be used for them. (Wengier)
0.83.14
- Added support for directories on the Z drive, so

View File

@@ -10,7 +10,7 @@
<category>Emulation</category>
</categories>
<releases>
<release version="@PACKAGE_VERSION@" date="2021-6-5"/>
<release version="@PACKAGE_VERSION@" date="2021-6-12"/>
</releases>
<screenshots>
<screenshot type="default">

View File

@@ -860,6 +860,7 @@ pc-98 force ibm keyboard layout = false
#DOSBOX-X-ADV:# jfontsbcs: FONTX2 file used to rendering SBCS characters (8x19) in DOS/V or JEGA mode. If not specified, the default one will be used.
#DOSBOX-X-ADV:# jfontsbcs16: FONTX2 file used to rendering SBCS characters (8x16) in DOS/V mode.
#DOSBOX-X-ADV:# jfontdbcs: FONTX2 file used to rendering DBCS characters (16x16) in DOS/V or JEGA mode. If not specified, the default one will be used.
#DOSBOX-X-ADV:# jfontdbcs14: FONTX2 file used to rendering SBCS characters (14x14) in DOS/V mode (for Configuration Tool).
#DOSBOX-X-ADV:# jfontdbcs24: FONTX2 file used to rendering SBCS characters (24x24) in DOS/V mode.
#DOSBOX-X-ADV:# jfontsbcs24: FONTX2 file used to rendering SBCS characters (12x24) in DOS/V mode.
#DOSBOX-X-ADV:# yen: Enables the Japanese yen at 5ch in DOS/V or JEGA mode if it is found at 7fh in a custom SBCS font.
@@ -927,6 +928,7 @@ monochrome_pal = green
#DOSBOX-X-ADV:jfontsbcs =
#DOSBOX-X-ADV:jfontsbcs16 =
#DOSBOX-X-ADV:jfontdbcs =
#DOSBOX-X-ADV:jfontdbcs14 =
#DOSBOX-X-ADV:jfontdbcs24 =
#DOSBOX-X-ADV:jfontsbcs24 =
#DOSBOX-X-ADV:yen = false

View File

@@ -316,7 +316,7 @@ pc-98 force ibm keyboard layout = false
# You can also change the blinking rate by setting an interger between 1 (fastest) and 7 (slowest), or 0 for no cursor.
#
# Advanced options (see full configuration reference file [dosbox-x.reference.full.conf] for more details):
# -> alt render; xbrz slice; xbrz fixed scale factor; xbrz max scale factor; jfontsbcs; jfontsbcs16; jfontdbcs; jfontdbcs24; jfontsbcs24; yen; ttf.fontbold; ttf.fontital; ttf.fontboit; ttf.colors; ttf.wpbg; ttf.wpfg; ttf.bold; ttf.italic; ttf.underline; ttf.strikeout; ttf.char512; ttf.autodbcs; ttf.autoboxdraw; ttf.halfwidthkana
# -> alt render; xbrz slice; xbrz fixed scale factor; xbrz max scale factor; jfontsbcs; jfontsbcs16; jfontdbcs; jfontdbcs14; jfontdbcs24; jfontsbcs24; yen; ttf.fontbold; ttf.fontital; ttf.fontboit; ttf.colors; ttf.wpbg; ttf.wpfg; ttf.bold; ttf.italic; ttf.underline; ttf.strikeout; ttf.char512; ttf.autodbcs; ttf.autoboxdraw; ttf.halfwidthkana
#
frameskip = 0
aspect = false

View File

@@ -860,6 +860,7 @@ pc-98 show graphics layer on initialize = true
# jfontsbcs: FONTX2 file used to rendering SBCS characters (8x19) in DOS/V or JEGA mode. If not specified, the default one will be used.
# jfontsbcs16: FONTX2 file used to rendering SBCS characters (8x16) in DOS/V mode.
# jfontdbcs: FONTX2 file used to rendering DBCS characters (16x16) in DOS/V or JEGA mode. If not specified, the default one will be used.
# jfontdbcs14: FONTX2 file used to rendering SBCS characters (14x14) in DOS/V mode (for Configuration Tool).
# jfontdbcs24: FONTX2 file used to rendering SBCS characters (24x24) in DOS/V mode.
# jfontsbcs24: FONTX2 file used to rendering SBCS characters (12x24) in DOS/V mode.
# yen: Enables the Japanese yen at 5ch in DOS/V or JEGA mode if it is found at 7fh in a custom SBCS font.
@@ -927,6 +928,7 @@ monochrome_pal = green
jfontsbcs =
jfontsbcs16 =
jfontdbcs =
jfontdbcs14 =
jfontdbcs24 =
jfontsbcs24 =
yen = false

View File

@@ -1,4 +1,4 @@
/*auto-generated*/
#define UPDATED_STR "Jun 5, 2021 4:13:31pm"
#define GIT_COMMIT_HASH "9e8ff11"
#define UPDATED_STR "Jun 12, 2021 4:05:35am"
#define GIT_COMMIT_HASH "e61a970"
#define COPYRIGHT_END_YEAR "2021"

View File

@@ -24,7 +24,6 @@
#include "support.h"
#include "../ints/int10.h"
#include "../output/output_opengl.h"
#include "sdlmain.h"
#include "regs.h"
#include "callback.h"
#include "mapper.h"

View File

@@ -2344,6 +2344,9 @@ void DOSBOX_SetupConfigSections(void) {
Pstring = secprop->Add_path("jfontdbcs",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.");
Pstring = secprop->Add_path("jfontdbcs14",Property::Changeable::OnlyAtStart,"");
Pstring->Set_help("FONTX2 file used to rendering SBCS characters (14x14) in DOS/V mode (for Configuration Tool).");
Pstring = secprop->Add_path("jfontdbcs24",Property::Changeable::OnlyAtStart,"");
Pstring->Set_help("FONTX2 file used to rendering SBCS characters (24x24) in DOS/V mode.");

View File

@@ -42,6 +42,7 @@
#define VTEXT_MODE_COUNT 2
#define SBCS16_LEN 256 * 16
#define SBCS19_LEN 256 * 19
#define DBCS14_LEN 65536 * 28
#define DBCS16_LEN 65536 * 32
#define DBCS24_LEN 65536 * 72
#define SBCS24_LEN 256 * 48
@@ -57,11 +58,13 @@ static XFontSet font_set24;
const char jfont_name[] = "\x082\x06c\x082\x072\x020\x083\x053\x083\x056\x083\x062\x083\x04e";
static uint8_t jfont_dbcs[96];
uint8_t jfont_sbcs_19[SBCS19_LEN];//256 * 19( * 8)
uint8_t jfont_dbcs_16[DBCS16_LEN];//65536 * 16 * 2 (* 8)
uint8_t jfont_sbcs_16[SBCS16_LEN];//256 * 16( * 8)
uint8_t jfont_dbcs_24[DBCS24_LEN];//65536 * 24 * 3
uint8_t jfont_sbcs_19[SBCS19_LEN];//256 * 19( * 8)
uint8_t jfont_sbcs_24[SBCS24_LEN];//256 * 12 * 2
uint8_t jfont_dbcs_14[DBCS14_LEN];//65536 * 14 * 2 (* 8)
uint8_t jfont_dbcs_16[DBCS16_LEN];//65536 * 16 * 2 (* 8)
uint8_t jfont_dbcs_24[DBCS24_LEN];//65536 * 24 * 3
uint8_t jfont_cache_dbcs_14[65536];
uint8_t jfont_cache_dbcs_16[65536];
uint8_t jfont_cache_dbcs_24[65536];
@@ -178,7 +181,18 @@ static bool LoadFontxFile(const char *fname, int height = 16) {
}
// switch whether the font is DBCS or not
if (head.type == 1) {
if (head.width == 16 && head.height == 16) {
if (head.width == 14 && head.height == 14) {
size = getc(mfile);
table = (fontxTbl *)calloc(size, sizeof(fontxTbl));
readfontxtbl(table, size, mfile);
for (Bitu i = 0; i < size; i++) {
for (code = table[i].start; code <= table[i].end; code++) {
fread(&jfont_dbcs_14[code * 28], sizeof(uint8_t), 28, mfile);
jfont_cache_dbcs_14[code] = 1;
}
}
}
else if (head.width == 16 && head.height == 16) {
size = getc(mfile);
table = (fontxTbl *)calloc(size, sizeof(fontxTbl));
readfontxtbl(table, size, mfile);
@@ -422,6 +436,18 @@ uint8_t *GetDbcsFont(Bitu code)
return &jfont_dbcs_16[code * 32];
}
uint8_t *GetDbcs14Font(Bitu code, bool &is14)
{
memset(jfont_dbcs, 0, sizeof(jfont_dbcs));
if(jfont_cache_dbcs_14[code] == 0) {
is14 = false;
return GetDbcsFont(code);
} else {
is14 = true;
return &jfont_dbcs_14[code * 28];
}
}
uint8_t *GetDbcs24Font(Bitu code)
{
memset(jfont_dbcs, 0, sizeof(jfont_dbcs));
@@ -614,6 +640,12 @@ void JFONT_Init() {
LOG_MSG("MSG: SBCS 8x16 font file path is not specified.\n");
}
}
pathprop = section->Get_path("jfontdbcs14");
if(pathprop) {
std::string path=pathprop->realpath;
ResolvePath(path);
LoadFontxFile(path.c_str());
}
pathprop = section->Get_path("jfontdbcs24");
if(pathprop) {
std::string path=pathprop->realpath;

View File

@@ -39,7 +39,7 @@
#include <math.h> /* floor */
bool isDBCSCP();
uint8_t *GetDbcsFont(Bitu code);
uint8_t *GetDbcs14Font(Bitu code, bool &is14);
namespace GUI {
@@ -489,23 +489,24 @@ Char prvc = 0;
void BitmapFont::drawChar(Drawable *d, const Char c) const {
const unsigned char *ptr = bitmap, *optr = ptr;
int bit = 0, i = 0, w = 0, h = 0;
bool is14 = false;
if (c > last) {prvc = 0;return;}
if (IS_PC98_ARCH || IS_JEGA_ARCH || isDBCSCP()) {
if (isKanji1(c) && prvc == 0) {
prvc = c;
return;
} else if (isKanji2(c) && prvc > 1) {
optr = GetDbcsFont(prvc*0x100+c);
prvc = 1;
} else if (isKanji2(c) && prvc > 2) {
optr = GetDbcs14Font(prvc*0x100+c, is14);
prvc = is14?2:1;
} else if (prvc < 0x81)
prvc = 0;
} else
prvc = 0;
#define move(x) (ptr += (((x)+bit)/8-(((x)+bit)<0))*(prvc==1?2:1), bit = ((x)+bit+(((x)+bit)<0?8:0))%8)
#define move(x) (ptr += (((x)+bit)/8-(((x)+bit)<0))*(prvc==1||prvc==2?2:1), bit = ((x)+bit+(((x)+bit)<0?8:0))%8)
int ht = prvc==1?16:height, at = prvc==1?11:ascent;
int rs = row_step;
for (i=0; i<(prvc?2:1); i++) {
if (prvc==1)
if (prvc==1||prvc==2)
ptr = optr+i;
else if (char_position != NULL) {
ptr = char_position[i||!prvc?c:prvc];
@@ -514,8 +515,8 @@ void BitmapFont::drawChar(Drawable *d, const Char c) const {
if (i) ptr = bitmap;
move(character_step*((int)(i||!prvc?c:prvc)));
}
w = widths!=NULL && prvc!=1 ? widths[i||!prvc?c:prvc] : width;
h = ascents!=NULL && prvc!=1 ? ascents[i||!prvc?c:prvc] : ht;
w = widths!=NULL && prvc!=1 && prvc!=2 ? widths[i||!prvc?c:prvc] : width;
h = ascents!=NULL && prvc!=1 && prvc!=2 ? ascents[i||!prvc?c:prvc] : ht;
if (!i) {
if (rs == 0) rs = isign(col_step)*w;
if (rs < 0) move(-rs*(h-1));