GRAPHICS: Expose SJIS font chunk calculation

This commit is contained in:
Eugene Sandulenko 2020-08-31 23:45:19 +02:00
parent a5b3bd2c5c
commit b0c2bbb789
2 changed files with 96 additions and 89 deletions

View file

@ -344,10 +344,7 @@ bool FontTowns::loadData() {
return retValue;
}
const uint8 *FontTowns::getCharData(uint16 ch) const {
if (ch < kFont8x16Chars) {
return _fontData8x16 + ch * 16;
} else {
int FontTowns::getCharFMTChunk(uint16 ch) {
uint8 f = ch & 0xFF;
uint8 s = ch >> 8;
@ -432,13 +429,20 @@ const uint8 *FontTowns::getCharData(uint16 ch) const {
}
debug(6, "Kanji: %c%c f 0x%x s 0x%x base 0x%x c %d p %d chunk %d cr %d index %d", f, s, f, s, base, c, p, chunk, cr, ((chunk_f + chunk) * 32 + (s - base)) + cr);
const int chunkNum = (((chunk_f + chunk) * 32 + (s - base)) + cr);
return (((chunk_f + chunk) * 32 + (s - base)) + cr);
}
const uint8 *FontTowns::getCharData(uint16 ch) const {
if (ch < kFont8x16Chars)
return _fontData8x16 + ch * 16;
int chunkNum = getCharFMTChunk(ch);
if (chunkNum < 0 || chunkNum >= kFont16x16Chars)
return 0;
else
return _fontData16x16 + chunkNum * 32;
}
}
bool FontTowns::hasFeature(int feat) const {
static const int features = kFeatDefault | kFeatOutline | kFeatShadow | kFeatFMTownsShadow | kFeatFlipped | kFeatFatPrint;

View file

@ -208,6 +208,9 @@ public:
* Loads the ROM data from "FMT_FNT.ROM".
*/
bool loadData();
static int getCharFMTChunk(uint16 ch);
private:
enum {
kFont16x16Chars = 7808,