unicode_text/test.lua

24 lines
510 B
Lua
Raw Normal View History

2023-03-17 03:39:41 +01:00
#!/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 😀\
\
𐍈")
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()