Files
mini/tools/fonted/data/main.lua
2025-12-09 14:05:12 +01:00

68 lines
1.5 KiB
Lua

require "ui"
update = nil
protofont_surface = nil
function mini.init()
surf.cls(0)
update = any_update
ui.filedialog.show(select_file);
end
function select_file(filename)
if protofont_surface then surf.free(protofont_surface) end
protofont_surface = surf.loadex(filename)
end
function mini.update()
view.origin(0,0)
for i=0,15 do
draw.rectf(i*8, 0, 8, 8, i)
end
update()
end
function any_update()
surf.cls(0)
view.origin(4,4)
draw.rrectf(0,0,136,132,3,15)
if protofont_surface then
local w,h = surf.size(protofont_surface)
local x,y = (136-w)/2,(132-h)/2
surf.source(protofont_surface)
draw.surf(0,0,w,h,x,y,w,h)
draw.text(tostring(w)..","..tostring(h), 10, 100, 3)
end
view.origin(4,140)
draw.rrectf(0,0,136,68,3,15)
view.origin(8,144)
local x,y=0,0
for c=32,127 do
draw.rectf(x,y,7,9,12)
draw.rect(x,y,7,9,0)
draw.text(string.char(c),x+2,y+2,0)
x=x+8
if x>=128 then
x=0
y=y+10
end
end
draw.text("ÁÄÉÍÓÚáéíóúÀÈÌÒÙàèìòùñÑçÇ", x, y+8, 12)
view.origin(144,4)
draw.rrectf(0,0,21,12,3,14)
draw.text("BASE",3,2,12)
draw.rrectf(22,0,45,12,3,15)
draw.text("DIACRITICS",25,2,0)
-- acute(Á), grave(À); diaeresis(Ä), circumflex(Â); cedilla(Ç), tilde(Ñ)
draw.rrectf(68,0,49,12,3,15)
draw.text("PRECOMPOSED",71,2,0)
draw.rrectf(0,8,140,140,3,14)
end