diff options
Diffstat (limited to 'code/fe310/eos/eve/screen')
-rw-r--r-- | code/fe310/eos/eve/screen/font.c | 9 | ||||
-rw-r--r-- | code/fe310/eos/eve/screen/font.h | 3 |
2 files changed, 10 insertions, 2 deletions
diff --git a/code/fe310/eos/eve/screen/font.c b/code/fe310/eos/eve/screen/font.c index 26e7cf0..1be462d 100644 --- a/code/fe310/eos/eve/screen/font.c +++ b/code/fe310/eos/eve/screen/font.c @@ -4,14 +4,21 @@ #include "font.h" void eve_font_init(EVEFont *font, uint8_t font_id) { + uint32_t p; + + p = eve_read32(EVE_ROM_FONT_ADDR); + p += (148 * (font_id - 16)); font->id = font_id; + font->w = eve_read32(p + 136); + font->h = eve_read32(p + 140); + eve_readb(p, font->w_ch, 128); } uint16_t eve_font_string_width(EVEFont *font, char *s) { uint16_t r = 0; while (*s) { - r += font->w[*s]; + r += font->w_ch[*s]; s++; } return r; diff --git a/code/fe310/eos/eve/screen/font.h b/code/fe310/eos/eve/screen/font.h index 24b745e..a46c942 100644 --- a/code/fe310/eos/eve/screen/font.h +++ b/code/fe310/eos/eve/screen/font.h @@ -2,8 +2,9 @@ typedef struct EVEFont { uint8_t id; - uint8_t w[128]; + uint8_t w; uint8_t h; + uint8_t w_ch[128]; } EVEFont; void eve_font_init(EVEFont *font, uint8_t font_id); |