24 lines
510 B
Lua
24 lines
510 B
Lua
|
#!/usr/bin/env lua5.1
|
||
|
-- -*- coding: utf-8 -*-
|
||
|
|
||
|
dofile("init.lua")
|
||
|
|
||
|
font = unicode_text.hexfont()
|
||
|
font:load_glyphs( io.lines("/usr/share/unifont/unifont.hex") )
|
||
|
font:load_glyphs( io.lines("unifont_upper.hex") )
|
||
|
|
||
|
dofile("tga_encoder.lua")
|
||
|
local pixels = font:render_text("ABC 123 😀\
|
||
|
\
|
||
|
wð♥𐍈")
|
||
|
local image = tga_encoder.image(pixels)
|
||
|
image:save("test.tga")
|
||
|
|
||
|
local file = io.open("UTF-8-demo.txt")
|
||
|
tga_encoder.image(
|
||
|
font:render_text(
|
||
|
file:read("*all")
|
||
|
)
|
||
|
):save("UTF-8-demo.tga")
|
||
|
file:close()
|