summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2022-05-31 22:10:59 +0200
committerDaniel Friesel <derf@finalrewind.org>2022-05-31 22:10:59 +0200
commitfb3373297f7dacc6f20d1d87f683d3976f02daf2 (patch)
treeee1a95d1b5865426a4d29caac77a9f6181f5c770
parentc46bc484c57b47514b1442504cdb7fe4dff01601 (diff)
support fonts with height > 8px
-rw-r--r--framebuffer.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/framebuffer.lua b/framebuffer.lua
index 6b588b2..92e90f6 100644
--- a/framebuffer.lua
+++ b/framebuffer.lua
@@ -37,10 +37,13 @@ function fb.put(font, c)
fb.scroll()
end
local glyph = font.glyphs[c - 31]
+ local fh = font.height/8
for i = 1, table.getn(glyph) do
- fb.buf[fb.y/8 + (fb.x + i-1) * (fb.h/8) + 1] = glyph[i]
+ local x1 = (i-1) / fh
+ local y8 = (i-1) % fh
+ fb.buf[fb.y/8+y8 + (fb.x+x1) * (fb.h/8) + 1] = glyph[i]
end
- fb.x = fb.x + table.getn(glyph) + 2
+ fb.x = fb.x + table.getn(glyph) / fh + 2
if fb.x > fb.w then
fb.put(font, 10)
end