* Fix examples in README

This commit is contained in:
Nils Dagsson Moskopp 2023-09-05 00:27:54 +02:00
parent 62068c8368
commit 9ff46a730b
Signed by: erle
GPG Key ID: A3BC671C35191080
1 changed files with 6 additions and 6 deletions

View File

@ -20,9 +20,9 @@ If you are impatient, just copy and paste the following example code:
.. code::
local font = unicode_text.hexfont()
font.load_glyphs(io.lines("unifont.hex"))
font.load_glyphs(io.lines("unifont_upper.hex"))
local pixels = font.render_text("wð♥𐍈😀!🂐겫")
font:load_glyphs(io.lines("unifont.hex"))
font:load_glyphs(io.lines("unifont_upper.hex"))
local pixels = font:render_text("wð♥𐍈😀!🂐겫")
tga_encoder.image(pixels):save("unicode.tga")
The above code creates an 80×16 TGA file with white-on-black text.
@ -62,8 +62,8 @@ To render text, it is suggested to load glyphs, e.g. from GNU Unifont:
.. code::
font.load_glyphs(io.lines("unifont.hex"))
font.load_glyphs(io.lines("unifont_upper.hex"))
font:load_glyphs(io.lines("unifont.hex"))
font:load_glyphs(io.lines("unifont_upper.hex"))
Font Properties
+++++++++++++++
@ -104,7 +104,7 @@ A pixels table can be encoded into a file using `tga_encoder`:
.. code::
local pixels = font.render_text("wð♥𐍈😀!🂐겫")
local pixels = font:render_text("wð♥𐍈😀!🂐겫")
tga_encoder.image(pixels):save("image.tga")
The above code writes an uncompressed 80×16 grayscale bitmap.