* Fix examples in README
This commit is contained in:
parent
62068c8368
commit
9ff46a730b
12
README.rst
12
README.rst
|
@ -20,9 +20,9 @@ If you are impatient, just copy and paste the following example code:
|
||||||
.. code::
|
.. code::
|
||||||
|
|
||||||
local font = unicode_text.hexfont()
|
local font = unicode_text.hexfont()
|
||||||
font.load_glyphs(io.lines("unifont.hex"))
|
font:load_glyphs(io.lines("unifont.hex"))
|
||||||
font.load_glyphs(io.lines("unifont_upper.hex"))
|
font:load_glyphs(io.lines("unifont_upper.hex"))
|
||||||
local pixels = font.render_text("wð♥𐍈😀!🂐겫")
|
local pixels = font:render_text("wð♥𐍈😀!🂐겫")
|
||||||
tga_encoder.image(pixels):save("unicode.tga")
|
tga_encoder.image(pixels):save("unicode.tga")
|
||||||
|
|
||||||
The above code creates an 80×16 TGA file with white-on-black text.
|
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::
|
.. code::
|
||||||
|
|
||||||
font.load_glyphs(io.lines("unifont.hex"))
|
font:load_glyphs(io.lines("unifont.hex"))
|
||||||
font.load_glyphs(io.lines("unifont_upper.hex"))
|
font:load_glyphs(io.lines("unifont_upper.hex"))
|
||||||
|
|
||||||
Font Properties
|
Font Properties
|
||||||
+++++++++++++++
|
+++++++++++++++
|
||||||
|
@ -104,7 +104,7 @@ A pixels table can be encoded into a file using `tga_encoder`:
|
||||||
|
|
||||||
.. code::
|
.. code::
|
||||||
|
|
||||||
local pixels = font.render_text("wð♥𐍈😀!🂐겫")
|
local pixels = font:render_text("wð♥𐍈😀!🂐겫")
|
||||||
tga_encoder.image(pixels):save("image.tga")
|
tga_encoder.image(pixels):save("image.tga")
|
||||||
|
|
||||||
The above code writes an uncompressed 80×16 grayscale bitmap.
|
The above code writes an uncompressed 80×16 grayscale bitmap.
|
||||||
|
|
Loading…
Reference in New Issue