Problems to create a Spanish Image Font

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Basilisk
Prole
Posts: 2
Joined: Sun Nov 03, 2013 8:23 pm

Problems to create a Spanish Image Font

Post 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
User avatar
markgo
Party member
Posts: 190
Joined: Sat Jan 05, 2013 12:21 am
Location: USA

Re: Problems to create a Spanish Image Font

Post 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.
User avatar
Basilisk
Prole
Posts: 2
Joined: Sun Nov 03, 2013 8:23 pm

Re: Problems to create a Spanish Image Font

Post 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
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Problems to create a Spanish Image Font

Post 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.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 8 guests