From e5fcdeda041831cb326f1d1963c0651b78041788 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Fri, 12 Jun 2020 00:51:04 +0200 Subject: implemented font metrics --- code/fe310/eos/eve/screen/font.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'code/fe310/eos/eve/screen/font.c') 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; -- cgit v1.2.3