Add support for the new glyphs

The 194 is because in UTF-8, 128 to 191 get encoded as \194\###
This commit is contained in:
gamax92 2016-08-05 23:38:19 -06:00
parent 6ecee00c59
commit 05e8ba8401
3 changed files with 5 additions and 2 deletions

View File

@ -105,7 +105,7 @@ function api.print(str, x, y, col)
pico8.cursor[2]=flr(tonumber(y) or 0)
end
love.graphics.setShader(pico8.text_shader)
love.graphics.print(tostring(str):gsub("[%z\1-\31\127-\255]", " "), pico8.cursor[1], pico8.cursor[2])
love.graphics.print(tostring(str):gsub("[%z\1-\31\154-\255]", " "):gsub("[\128-\153]", "\194%1"), pico8.cursor[1], pico8.cursor[2])
love.graphics.setShader(pico8.draw_shader)
if not x and not y then
pico8.cursor[1]=0

BIN
font.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 605 B

After

Width:  |  Height:  |  Size: 486 B

View File

@ -215,9 +215,12 @@ function love.load(argv)
pico8.screen:setFilter('linear', 'nearest')
local glyphs=""
for i=32, 126 do
for i=32, 127 do
glyphs=glyphs..string.char(i)
end
for i=128, 153 do
glyphs=glyphs..string.char(194, i)
end
local font=love.graphics.newImageFont("font.png", glyphs, 1)
love.graphics.setFont(font)
font:setFilter('nearest', 'nearest')