Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Glyph Keeper

This thread is locked; no one can reply to it. rss feed Print
Glyph Keeper
cmoibenlepro
Member #7,961
November 2006

For my project, I need to be able to show accented letters (e.g. éèàô).
Before I used allegro built-in font renderer with set_uformat(U_ASCII); and everything worked fine (even if it's a bit ugly...)

Now, I'm trying to start using glyph keeper, but accents don't seem to be rendered at all...

For example, if I type:
gk_render_line_utf8(screen,rend,"ÉÀôâïè!",50,220);

After compiling, I got only questions marks...
Is it normal? ???

Matthew Dalrymple
Member #7,922
October 2006
avatar

Have you tried setting the format to UNICODE or UTF8? That should fix the problem. If Glyph Keeper is using ASCII then those really shouldn't show up. Seeing the question marks is normal when trying to view a character that is not in a character table. ASCII only allows for 256 unique characters, most of those are used by english characters and specific keystrokes. While such formats as Unicode and UTF are meant to allow for other characters other than the ones in the English language.

Edit:
gk_render_line_utf8(screen,rend,"ÉÀôâïè!",50,220);
Now I see the function you called is UTF8 so scratch that,... try a function for ASCII and then try a unicode one. See what happens. And do you still have the line: set_uformat(U_ASCII);?

=-----===-----===-----=
I like signatures that only the signer would understand. Inside jokes are always the best, because they exclude everyone else.

cmoibenlepro
Member #7,961
November 2006

Yes I still have the line set_uformat(U_ASCII);

According to the documentation, there is no support for ascii and unicode yet in glyph maker...:-/

Matthew Dalrymple
Member #7,922
October 2006
avatar

Try removing set_uformat(U_ASCII); It may be conflicting with Glyph Maker and then maybe try setting using set_uformat(U_UTF8); Just do some trial and error trying to get it to work.

=-----===-----===-----=
I like signatures that only the signer would understand. Inside jokes are always the best, because they exclude everyone else.

Thomas Fjellstrom
Member #476
June 2000
avatar

You might also want to know that putting in non ASCII chars in C/C++ code is against the language's specs. Its not ever guaranteed to work, ever.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

cmoibenlepro
Member #7,961
November 2006

Quote:

You might also want to know that putting in non ASCII chars in C/C++ code is against the language's specs. Its not ever guaranteed to work, ever.

I know, but I'm not talking about Cyrillic or Greek letters nor other Unicode symbols...
You might also want to know that accented letters are ASCII chars. For example "é" is ASCII char number 130. Check this page: http://www.computerhope.com/jargon/a/ascii.htm

But finally I found a way to bypass my problem... I convert the glyph keeper font to an allegro one and then I can use accented letters like I did before...
If someone is interested, here is an example of my code (it's also in the manual):

GLYPH_FACE* face;
GLYPH_REND* rend;
face = gk_load_face_from_file("arial.ttf",0);
rend = gk_create_renderer(face,0);
gk_rend_set_size_pixels(rend,12,12);
font = gk_create_allegro_font(rend);

And if you want to do things that glyph keeper can do but good old allegro can't, just use words that don't contain accented letters ;D

Thomas Fjellstrom
Member #476
June 2000
avatar

I'm not certian, but when they say ASCII, they don't mean the full 8bit code table. Just the common 7bit range.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

cmoibenlepro
Member #7,961
November 2006

Maybe, but it works under both mingw and msvc.. maybe they don't follow standards (which I'm not surprised for msvc, but I thought that mingw would follow standards since it's based on gcc... ??? )

I don't know why, but it works...

Thomas Fjellstrom
Member #476
June 2000
avatar

It "may" work. thats what "undefined" behavior is all about. One minute it might work, the next you'll get pulled into a blackhole crushing you out of existence.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

cmoibenlepro
Member #7,961
November 2006

Quote:

It "may" work. thats what "undefined" behavior is all about. One minute it might work, the next you'll get pulled into a blackhole crushing you out of existence.

hahaha ;D

So I will rush to finish my project for the time it works before I get swallowed by a black hole.

(EDIT)
By the way, is it possible to save a .ttf font into a dat file using grabber?

Go to: