Glyph Keeper
cmoibenlepro

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

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);?

cmoibenlepro

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

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.

Thomas Fjellstrom

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.

cmoibenlepro
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

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

cmoibenlepro

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

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.

cmoibenlepro
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?

Thread #588571. Printed from Allegro.cc