News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Which consoles have "internal fonts"?  (Read 7360 times)


  • Hero Member
  • *****
  • Posts: 2022
  • 時を越えよう、そして彼女の元に戻ろう
    • View Profile
    • Apple of Eden
Re: Which consoles have "internal fonts"?
« Reply #20 on: February 09, 2014, 07:32:44 am »
As for clock tower : Does the kanji comes from the BIOS as well ? That'd be quite impressive. Still even the size of a full kanji font is negligible compared to the size of a CD-ROM...
The entire set comes from the BIOS. There is a system function called Krom2RawAdd (and the fixed Krom2RawAdd2) that takes an SJIS symbol as input and returns the address to that glyph in the BIOS. From there you have to remangle the graphics to be compatible with the VRAM format or use Krom2Tim instead, which returns an already converted 16x15 4 BPP image from a string. Most games relying on the system font simply use Krom2Add and apply transformations to it, such as 12x15, 10x15, or 8x15 resize to make the font less atrocious (SOTN and the Popolocrois series do this, and so should Mizzurna IIRC). If you have intensive memory usage, taking advantage of the BIOS font can definitively help keeping your data compact, but there are really a ton ways to make efficient caching of font data, like Valkyrie Profile does (it embeds a different font for each game section with only the required glyphs).

A brief snippet from the official docs:
Get shift-JIS font pattern addresses.

Code: [Select]
Library    Header File Introduced Documentation Date
libapi.lib libapi.h       3.0          12/14/98

Code: [Select]
unsigned long Krom2RawAdd(unsigned short sjiscode)
Gets the starting address in the font pattern kernel for the non-Kanji/Kanji level 1 character specified by the sjiscode.
Refer to the codeview sample in \psx\kanji\sjiscode for a list of usable fonts and the actual fonts themselves.

Return value
The starting address of a Kanji font pattern. If there is no font data corresponding to the specified Kanji character, a value of -1 is returned.

Bug alert:
The normal arguments are Shift-JIS code values between 0x8140~0x84BE or 0x889F~0x9872. If a Shift-JIS code within that region corresponds to a blank area in the code table, a font pattern unrelated to that code is returned as the starting address.  This problem has been corrected in Krom2RawAdd2, so we recommend using Krom2RawAdd2 to obtain the font pattern starting address.

See also

Convert SJIS character string to 4-bit CLUT Tim data.

Code: [Select]
Library    Header File Introduced Documentation Date
libgpu.lib libgpu.h       3.0          12/14/98

Code: [Select]
int Krom2Tim(u_char *sjis,  // SJIS character string
u_long *taddr,  // Tim area for storing data
int dx, int dy,  // Pixel data x,y coordinates on VRAM
int cdx, int cdy,  // Clut data x,y coordinates on VRAM
u_int fg, u_int bg)  // Character color and bg color

Converts SJIS character string to 4 bits CLUT TIM data and returns it to taddr.
The size area returned by GetTimSize() must be secured in advance.
The Kanji code must be SJIS. Full-width and half-width characters can be mixed within the character string, but when they are displayed, they area ll converted to full-width characters. Half-width characters are not supported.
To internally reserve the transfer buffer on the stack, approximately 72K is needed.

Return value
When an abnormal code is given, -1 is returned; 0 otherwise.

See also
« Last Edit: February 09, 2014, 07:53:01 am by Gemini »
I am the lord, you all know my name, now. I got it all: cash, money, and fame.