PC Engine Homebrew News: The duo that brought you FX-Unit Yuki returns! A demo for "Nyanja!" is available, an action platformer akin to games like Bubble Bobble & Snow Bros in gameplay style.
Main Menu

System Card Font Fix

Started by dshadoff, 01/02/2019, 01:57 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dshadoff

I should have done this 25 years ago.  Anyway, a long time ago, as soon as I was able...

I was playing a lot of games lately, and I was revolted by the font used by several of the American releases, as a substitute for the Japanese font.

The 8x8 fonts are usually good, but the built-in 12x12 and 16x16 fonts shatter the psyche with problems such as:
- lack of descenders
- mismatched characters within the font
- misaligned baselines
- etc.

Even fan translations avoid the built-in fonts because they're unacceptable.

So I finally took it upon myself to ameliorate these problems.
(I'm not claiming that they're all solved... but anyway, they're better than before).

I have included screenshots of an early screen on the American release of Exile (before and after); this should give a clear indication of whether this patch is for you.

I'll submit it to Romhacking.net tomorrow, and if I can get NightWolve to upload the ZIP file, I'll provide a more detailed explanation of how I did it in this thread.


gilbert

#1
I'm not familiar with English systems, but AFAIK they also play Japanese games without any problem(or so I've heard), so the Japanese font should be included in the western system cards as well.
So, does it mean that the western system cards included the original Japanese font, but somehow changed the English font for whatever reasons (copyright issues, maybe)?
Edit: Or do you mean that the English fonts in the system cards suck (regardless of region), but it's only less annoying when most of the text are in Japanese?

I think for whatever reasons, the English font in Japanese system card 3.0 is a bit different from those in 1.x as well (don't know when it was changed, either from v1 -> v2, or v2 -> v3), as the screenshots in game manuals of non-super CD games usually show letters that are a bit different from playing the game with system 3.0.
Edit: If Wikipedia is to be trusted, the 12x12 and 16x16 fonts were changed in Super System Card(i.e. since v3) to add more symbols and enhance readibility. Maybe for unknown reasons the western system card v3 still uses the old fonts?

dshadoff

Quote from: gilbert on 01/02/2019, 03:25 AMOr do you mean that the English fonts in the system cards suck (regardless of region), but it's only less annoying when most of the text are in Japanese?

I think for whatever reasons, the English font in Japanese system card 3.0 is a bit different from those in 1.x as well (don't know when it was changed, either from v1 -> v2, or v2 -> v3), as the screenshots in game manuals of non-super CD games usually show letters that are a bit different from playing the game with system 3.0.
Edit: If Wikipedia is to be trusted, the 12x12 and 16x16 fonts were changed in Super System Card(i.e. since v3) to add more symbols and enhance readibility. Maybe for unknown reasons the western system card v3 still uses the old fonts?
I should have been more clear with the scope of my change - I only changed:
1) Upper and lower-case letters from A-Z
2) Numbers from 0-9
3) The '?' and '!' punctuation marks

...And the American cards contain all the same font information as their corresponding Japanese cards (to the best of my knowledge).


System Card 3.0 probably does have more symbols, but that wasn't the focus of my studies.
If I can get the ZIP file uploaded to the board, there is a utility in there to browse the characters sets.

I just checked what you mentioned about the updated font, and it appears that they did make a couple of changes:

System Card 1.0 -> 2.0:
- replace the 12x12 numeric characters with a slightly larger, less-bold font (but this doesn't exactly match the rest of the Western characters anymore)

System Card 2.x -> 3.0
- replace at least the 12x12 uppercase alphabetic characters with new ones.

It seems that the old ones might have been too 'blocky', so they may have thought that they were making them prettier - but the replacements don't use the same baseline, so capitals sit lower than lowercase characters (which is jarring).  This would have been obvious if they had written a sentence in English, so I can't accept that it enhances readability.

IMG IMG
IMG

dshadoff

We were able to get the ZIP file put up:

https://www.pcengine-fx.com/downloads/syscard_font.zip


The ZIP file includes:
- IPS file
- test_kanji utility - source code and compiled ISO
- Description of how it was done
- all of the relevant character definitions (as 1-bit BMP files).

This is all you will need in order to put your own font in (well, you'll still need a font....).


Here's a quick overview of how I did this... a little more detail is in the HOWTO in the zip file.

Viewing the Characters:

First, I needed to see how the characters appeared, and what SJIS codes they corresponded with.
testkanji.c (and .iso) are the product of this (see ZIP file).
- The direction keys adjust the SJIS code used for the first character in the matrix.
- The 'II' key prints a matrix of SJIS characters starting with this code. 16 characters across, and 8 rows down.
- The 'I' key toggles the flag between 12x12 and 16x16 font display
- The 'SELECT' key will page forward (0x80 kanji) for convenience

If you review the whole set, you'll notice that many codes appear multiple times - they aren't really duplicated in the ROM; these are just artifacts of the calculations in the decode routine. So we'll only have to replace one copy.


Finding Where the Codes Are Stored in the ROM:

Using the 'testkanji' program, I set a breakpoint for $E060 (the EX_GETFONT function), and traced it through.  It turns out that the characters aren't stored in a compressed format, and actually take up a significant portion of the ROM. Also, for the ones I was interested in, both Japanese and American System 3 ROMs had stored those characters at the same locations, for both 12x12 and 16x16 sizes.


Extracting the Existing Fonts:

I used FEIDIAN (a PHP program which tries to be a universal font extractor/implantor... and it seems pretty good).

All of the relevant FEIDIAN commands are listed in the HOWTO file int he ZIP.


Modifying Fonts:

Honestly, I didn't attempt to repair the existing fonts; I just replaced them with another set of fonts I found here, after making minor adjustments:
www.pvv.org/~roarl/nethack/nethack.html

I used a program called Pixelformer, and output a BMP after setting the colorspace to Monochrome.
Then, I reversed the process, using FEIDIAN again.

Note: To do the same, take the appropriate command above, switch '-r' to '-i', and swap the sequence of the ROM and BMP names.

The command sequence for a ROM with header would be:
php feidian.php -i 12,12,26,2,0x30A4C insert_alphabet12.bmp syscard3.pce
php feidian.php -i 16,16,26,2,0x110C0 insert_alphabet16.bmp syscard3.pce
php feidian.php -i 12,12,10,1,0x30998 insert_num12.bmp syscard3.pce
php feidian.php -i 16,16,10,1,0x10F80 insert_num16.bmp syscard3.pce
php feidian.php -i 12,12,2,1,0x30290 insert_quest12.bmp syscard3.pce
php feidian.php -i 16,16,2,1,0x10300 insert_quest16.bmp syscard3.pce

The ZIP file includes the IPS file for "Version 3.0" Super System cards; this expects a headered ROM, but should work equally well on both Japanese and American versions, as the font information is stored at the same location in both.

Hopefully this is helpful to everybody.

Dave

NightWolve

Quote from: gilbert on 01/02/2019, 03:25 AMI'm not familiar with English systems, but AFAIK they also play Japanese games without any problem(or so I've heard), so the Japanese font should be included in the western system cards as well.
So, does it mean that the western system cards included the original Japanese font, but somehow changed the English font for whatever reasons (copyright issues, maybe)?
Edit: Or do you mean that the English fonts in the system cards suck (regardless of region), but it's only less annoying when most of the text are in Japanese?
The PCE/TG-16 System cards all have the S-JIS character set but only up to 0x9872, which covers about half the possible Japanese Kanji representation (JIS Level 1).

See: https://www.ysutopia.net/projects/s-jis/

If you look at the above S-JIS guide I left around when I first started the Xak III project in 2001, you can click on the 0x97-0x98 range to see where it ends.

S-JIS also has English, Greek and Russian characters covered, but in the case of the System card, they're stored in a really ugly 12x12 & 16x16 font as Dave demonstrated below with Exile which used 12x12.


Here's a snapshot ripped directly from a System Card 3 ROM (using fedian) below:
QuoteCmd: "php feidian.php -r 12,12,10,7,0x30998 syscard3.pce S-JIS"
For comparison, here's the even uglier 16x16 font:
QuoteCmd: "php feidian.php -r 16,16,16,15,66048 syscard3.pce S-JIS"
Dave's idea here is simply based on what if you just overwrite those English alphabet tiles in the System Card 3 ROM with a better looking font and boot a game with it ??

Before/After Results:

In the early days, you were limited to emulators, but now you can take an edited ROM file to real NEC hardware using a Turbo Everdrive flashcart which is pretty standard nowadays, and voila, you'll get to play a game with a slightly better font or even other possibilities...

Unfortunately, as you can see, there's only mild improvement, only so much you can do for a fixed-width 12x12 (or 16x16) English font, it'd be more ideal to switch the game over to an 8x12 or 8x16 font, but that would involve extensive hacking work on the ROM of the game itself...


This is a bit of a tangent, the Xak III tangent if you will, but same concept that can be applied to *SOME* PC Engine CDs and HuCards if-and-ONLY-if the font tiles are not compressed as is the case for the System Card ROM! You must find the offset in the data track where the font tiles are and simply overwrite them with other font tile sprites and voila, you can change the font into something better!

Xak III was the perfect candidate because it was ready-to-go with nice English 8x16 font support built-in with no font compression, no expert hackers necessary! Just take tile data from one game, even SNES, and overwrite it at the correct offset(s) and you can accomplish this:

https://www.ysutopia.net/images/xak3/font.html
Lufia [SNES] 8x16Lagoon [SNES] 8x16Neutopia [PCE] 8x16
IMGIMGIMG

Es magnifique my friend, es magnifique!  :bonkthis: