1
0
mirror of https://github.com/pyrollo/display_modpack.git synced 2025-07-06 10:00:42 +02:00

Add GNU Unifont

This commit is contained in:
syimyuzya
2021-12-04 13:14:47 +08:00
parent f5bd6d1046
commit 79aac655b3
5 changed files with 39 additions and 2 deletions

View File

@ -229,7 +229,7 @@ function Font:render(text, texturew, textureh, style)
return ""
end
local x, y, codepoint
local x, y, codepoint, glyph
local texture = ""
local textheight = self:get_height(#lines)
@ -258,8 +258,13 @@ function Font:render(text, texturew, textureh, style)
-- Add image only if it is visible (at least partly)
if x + self.widths[codepoint] >= 0 and x <= texturew then
if self.get_glyph == nil then
glyph = string.format("font_%s_%04x.png", self.name, codepoint)
else
glyph = self.get_glyph(codepoint):gsub("[\\^:]", "\\%0")
end
texture = texture..
string.format(":%d,%d=font_%s_%04x.png", x, y, self.name, codepoint)
string.format(":%d,%d=%s", x, y, glyph)
end
x = x + self.widths[codepoint]
end