Lua & Encoding?

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
omicron
Prole
Posts: 1
Joined: Thu Sep 30, 2010 11:22 pm

Lua & Encoding?

Post by omicron »

Hi guys,

I'm dicking around with a 'roguelike' game and need to use certain non-ascii characters in my output. These would be: ▟ █ ▛ ░ ▒ ◎ ▎▜ ▙ Д Ѯ Ѫ ҂ Ϡ etc. etc.
Now, I'm fairly new to LUA as I began coding this project in curses with Python, but I stumbled across this library and it seems pretty fantastic. I don't have a terribly large amount of experience with LUA and documentation seems to be pretty...sparse. I can't seem to find how to print these characters; I'm sure it's a dumb question, but help would be appreciated.

Cheers
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Lua & Encoding?

Post by kikito »

I think it is going to be easier if you just make tiny images of the characters you need, and then use images of those characters instead.

LÖVE handles images better than it handles fonts & text - specially if there are unicode chars involved.

So, if it's only 10 or 20 symbols, it will be just easier with images, or maybe one single image with quads.
When I write def I mean function.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Lua & Encoding?

Post by Robin »

What kikito says is not completely true, LÖVE handles fonts and text just fine... as long as you're using ASCII. It is something that we all want fixed, but it is a bit difficult, especially since Lua doesn't support Unicode at all.
kikito wrote:So, if it's only 10 or 20 symbols, it will be just easier with images, or maybe one single image with quads.
Or an ImageFont.
Help us help you: attach a .love.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Lua & Encoding?

Post by kikito »

I just meant that right now, what he wanted to do was actually easier with just plain images - they will be easier to adjust 'pixel perfectly', for example.
When I write def I mean function.
User avatar
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Location: In your head.
Contact:

Re: Lua & Encoding?

Post by zac352 »

kikito wrote:I think it is going to be easier if you just make tiny images of the characters you need, and then use images of those characters instead.

LÖVE handles images better than it handles fonts & text - specially if there are unicode chars involved.

So, if it's only 10 or 20 symbols, it will be just easier with images, or maybe one single image with quads.
What about an image font?
Hello, I am not dead.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Lua & Encoding?

Post by kikito »

An image font could be a solution, but he would have to encode the non-ascii characters as ascii.

He would have to do something similar to what happens when you try to write on windows with the Widgets Font, where letter 'a' is a cloud and letter 'b' is a dog taking a piss (for example). He would have to remember that 'a' is the 'blocky thing' and 'b' is the 'line-like thing'. And he would have to change fonts if he wanted to output any real 'a' or 'b'.

Using images seems more straightforward for me. It also saves time for the future, if he ever wants to allow tilesets.
When I write def I mean function.
Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot] and 5 guests