+ Add script to generate a ”screenshot” for Minetest ContentDB

This commit is contained in:
Nils Dagsson Moskopp 2023-09-10 17:49:52 +02:00
parent 27f4fe7814
commit f143894e55
Signed by: erle
GPG Key ID: A3BC671C35191080
1 changed files with 33 additions and 0 deletions

33
screenshot.lua Normal file
View File

@ -0,0 +1,33 @@
#!/usr/bin/env lua5.1
-- -*- coding: utf-8 -*-
dofile("init.lua")
dofile("../tga_encoder/init.lua")
font = unicode_text.hexfont(
{
kerning = true,
}
)
font:load_glyphs(
io.lines("unifont.hex")
)
font:load_glyphs(
io.lines("unifont_upper.hex")
)
local text = "\
\
\
\
Heizölrückstoßabdämpfung \
נקודה מודגשת \
Ξεσκεπάζω τν ψυχοφθόρα βδελυγμία \
\
qരഹ്മപുരത്ത \
В чащах юга жил бы цитрус? \
𝐛𝐨𝐥𝐝 𝖋𝖗𝖆𝖐𝖙𝖚𝖗 𝒊𝒕𝒂𝒍𝒊𝒄 𝓼𝓬𝓻𝓲𝓹𝓽 \
"
local pixels = font:render_text(text)
local image = tga_encoder.image(pixels)
image:save("screenshot.tga")