Page 1 of 1
Problems to create a Spanish Image Font
Posted: Mon Nov 04, 2013 6:02 am
by Basilisk
Hello everyone i have a problem to create a spanish Image based font, im just trying to add the ñÑáéíóúÁÉÍÓÚ characters in the code i already created edited a font to add this characters in the png file but that isnt work, all what i get is a space in white. What can i do to solve that, this is the code i used, its based on the tutorial i found in the wiki:
Code: Select all
function love.load()
Font1 = love.graphics.newImageFont("FuenteEspañol01.png",
" abcdefghijklmnopqrstuvwxyz" ..
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0" ..
"123456789.,!?-+/():;%&`'*#=[]\""..
"ñÑáéíóúÁÉÍÓÚ")
end
Re: Problems to create a Spanish Image Font
Posted: Mon Nov 04, 2013 6:29 am
by markgo
This may be of some help:
viewtopic.php?f=4&t=10203&p=61939&hilit ... 859#p61939
Summary: Your string of glyphs should be encoded according to ISO 8859-1. Then strings you want to print should be encoded according to UTF-8.
Re: Problems to create a Spanish Image Font
Posted: Wed Nov 06, 2013 12:51 am
by Basilisk
Thanks!
i solve that problem, but now i have another. The problem is that the printed text shows disordered, i put the hex value for the Ñ \91 and in screen shows the Ñ, but when i try to print the ñ \b1 it shows in screen "ñ1" and also tried whit the other characters and all of them show in disorder. What's going on?
Code: Select all
function love.load()
Font1 = love.graphics.newImageFont("FuenteEspañol01.png",
" abcdefghijklmnopqrstuvwxyz" ..
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0" ..
"123456789.,!?-+/():;%&`'*#=[]\""..
"\91\b1\81\a1\89\a9\8d\ad\93\b3\ba\9a")
end
function love.update()
end
function love.draw()
love.graphics.setFont(Font1);
love.graphics.print("\91 \b1 \81 \a1 \89 \a9 \8d \ad \93 \b3 \9a \ba",100,0)
end
Re: Problems to create a Spanish Image Font
Posted: Wed Nov 06, 2013 8:04 am
by bartbes
This is because that is not the syntax for specifying it in hexadecimal, it is indeed the syntax to specify it in decimal, so your \b1 is invalid, and actually consists of \b (bell) and 1. I should also note that as far as I remember lua 5.1 doesn't have a way to specify this in hexadecimal.