blob: de6bc1957ce4eeb7f0fd548887a865da1a8c4c50 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#include "font.h"
static const void *font_rom_get(const struct fmdsp_font *font,
uint16_t jis, enum fmdsp_font_type type) {
const uint8_t *fontdata = font->data;
const uint8_t *fontptr;
if (type == FMDSP_FONT_ANK) {
fontptr = fontdata + 0x800 + (jis<<4);
} else {
uint8_t row = jis >> 8;
uint8_t cell = jis;
fontptr = fontdata + (0x800 + (0x60*16*2*(row-0x20)) + (cell<<5));
if (type == FMDSP_FONT_JIS_RIGHT) fontptr += 16;
}
if ((fontptr + (16*16/8)) > (fontdata + FONT_ROM_FILESIZE)) fontptr = 0;
return fontptr;
}
void fmdsp_font_from_font_rom(struct fmdsp_font *font, const void *data) {
font->data = data;
font->width_half = 8;
font->height = 16;
font->get = font_rom_get;
}
|