fontEnv = newCleanEnv() loadSnippet("#92", fontEnv)() get("#109") -- copyRect -- size of chars cw, ch = 16, 16 -- original text otext = {"!\"#$%&'()*+,-./0123456789:;<=>?@", "ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`", "abcdefghijklmnopqrstuvwxyz{|}~ " } function render(text) newtext = text or "Hello world!" width=cw*#newtext height=ch pixels={} for i=1, #newtext do j = nil for line=1, #otext do local c = newtext:sub(i, i) j = otext[line]:find(c, 1, true) --print("line="..tostring(line)..", c="..c..", j="..tostring(j)) if j then l = line; break end end if j then --print("j="..tostring(j)..", l="..tostring(l)) copyRect(fontEnv, _G, (j-1)*cw, (l-1)*ch, cw, ch, (i-1)*cw, 0) end end end