abi>>forums

abi>>forums (http://www.anythingbutipod.com/forum/index.php)
-   Zen X-Fi2 Applications & Development (http://www.anythingbutipod.com/forum/forumdisplay.php?f=221)
-   -   ISO-8859-1 Character issues (http://www.anythingbutipod.com/forum/showthread.php?t=66971)

Habhome 12-10-2011 03:03 PM

ISO-8859-1 Character issues
 
Hi fellow devs!
(Though, I guess it's just pretty much jbob, bret and me left here...)

Today during a 2h train ride I scripted something which I call "Easy Clock". I encountered an issue though, as I try to use the characters , and . As previously described in this thread those are either not displayed at all, or is displayed as a Kanji sign.

Did anyone ever figure out a fix for this? I couldn't dig anything up by searching the forums.

~Hab

jbob182 12-10-2011 03:15 PM

I will test if the player can handle those characters in 1 easy line of code.

--------------------------------------------------------------------------
The player does in-fact know that character, it has a byte value of 197 so try using text.draw("Font test: " .. string.char(197))

Its the character:

-------------------------------------------------------------------------------------------------------------------

After further testing, the font does not have that character, if you would like to help me, then we can make a custom font engine. I just need a program that will give me the offsets, width, and height of letters. Though it will not support font size.

Habhome 12-10-2011 04:03 PM

I can try to help, but tomorrow evening when I have more time. What exactly is it you'd need help with? I didn't quite follow you with that sparse specification.

Kalle Kula 12-10-2011 04:21 PM

the player is UTF-8
and it's happy about what.
for the rest of the world...well...

jbob182 12-10-2011 04:24 PM

Sorry about that, I need a file like this:

times new roman.font

char(157);offset(5,3);rect(157,93,20,20);advance(7 );image("numbers.png");
ect


char: the byte number ( use string.byte("some character") to get the number) of a character
offset: the number of pixel you have to add to the glyph coordinates so that the glyph properly aligns with the rest of the characters
(empty space isn't present in the glyphs, thus offset is needed)
rect: is the position of the glyph in the image
advance: the number of pixel to move forward for the next char
image: the image which the character is located on, there will have to be several since there is a height limit of images, or we can use one long image with only one row of characters


I will also need a transparent image of all of the characters that the .font file will refer to.

If you would like some help, refer to the original Pingus, they use a similar setup in fonts ( I just copied most of the explanation on the line with a few edits from a conversation about fonts with one of the original developers of Pingus)


Here is a link to a newer version of Pingus with source, (they state somewhere what tool they use for the font):

http://code.google.com/p/pingus/downloads/list

https://mail.google.com/mail/images/cleardot.gif

jbob182 12-10-2011 06:03 PM

Here is the proper link:

http://code.google.com/p/pingus/sour...ac240d65650231


view the readme to get a link to the tools used.

Habhome 12-10-2011 06:29 PM

Hm okay.. I think I get it, only the offset(5,3) I'm not quite grasping what it represents. Problem is I had intended to make this translated into as many languages as I could, meaning lots of custom font things. And also needing to have them at different size, since you said that engine of yours didn't support font sizes.

Sorry if I seem slow to understand right now, but I got some personal issues, which are also the reason for me needing to develop this app, so my mind is kind of elsewhere at the moment.

EDIT: Also, I can't open the .png's to get a look on what they look like. Windows photo viewer claim corrupt files, and photoshop also complained about something... And YIKES, that's a lot of rows in the .font file... That'd take some time to type up.

jbob182 12-10-2011 07:21 PM

Hmm, ok. I can simplify all of this for you, all i need is a picture of those characters in the player's font, and they can even be in a row: ie: fonts 1-25 of in one image.
If you can do that, then the lua code should not take to long.

As for the offset, let me explain. When you type two ie: , I need to know how far away to space them apart to represent a space between characters. So it should really be offset(3) for 3 pixels.


Also, sorry if my thoughts seemed mixed up and misleading, I am concentrating mostly on Pingus. The lua code is so close to completion, and only has a few things left. As you can imagine, this is quite exciting; finishing a project that I started over a year ago, and it was thought to be impossible, even by myself at times.

Habhome 12-11-2011 09:42 AM

Quote:

Originally Posted by jbob182 (Post 588174)
Hmm, ok. I can simplify all of this for you, all i need is a picture of those characters in the player's font, and they can even be in a row: ie: fonts 1-25 of in one image.
If you can do that, then the lua code should not take to long.

As for the offset, let me explain. When you type two ie: , I need to know how far away to space them apart to represent a space between characters. So it should really be offset(3) for 3 pixels.


Also, sorry if my thoughts seemed mixed up and misleading, I am concentrating mostly on Pingus. The lua code is so close to completion, and only has a few things left. As you can imagine, this is quite exciting; finishing a project that I started over a year ago, and it was thought to be impossible, even by myself at times.

Hm ok. So you mean the .png should look like:



But placed so that they are directly adjacent? And the rectangle in the .font file should specify exactly a square around the corresponding character?

X = ""-Bytecode
char(X);offset(3);rect(0,15,10,10);advance(10);ima ge("font.png"); --Size 10 ""
char(X);offset(3);rect(10,10,15,15);advance(15);im age("font.png"); --Size 15 ""

I'm not entirely sure how that "advance" one specifies either. If you have a char in the specified rect, then why do you need to know how far to the next one? Doesn't the rect already specify the character's width?

And do you happen to know which font is used by default? Or do I have to try and match them up? From memory I believe it looks like Arial though...

jbob182 12-11-2011 10:01 AM

I am not sure which font it is, so I would suggest:
http://www.identifont.com/

As for the .font file, just include the byte code, the rect value, and a new value called size ie: size(12) referring to the font size.

And that is the correct layout for the png you provided.


All times are GMT -5. The time now is 04:29 PM.