|
TTF and ASCII |
Wagner Soares
Member #9,011
September 2007
|
I want to use TTF in Allegro, and need ASCII support at the same time (characters like á, ã, ç). SConstruct:4: *** missing separator. Stop. So what should I do!?!?! and I forgot something, I used set_uformat ( U_ASCII ) whith glyph keeper and nothing changed. thanx anyway, and sorry if I wrote anything wrong, cause I'm brazilian!! |
gnolam
Member #2,030
March 2002
|
Quote: I want to use TTF in Allegro, and need ASCII support at the same time (characters like á, ã, ç). Those aren't ASCII (the ASCII extensions are a mess of incompatible code pages). You want U_UTF8, not U_ASCII. -- |
Wagner Soares
Member #9,011
September 2007
|
I tried U_UTF8, and I get a ^ in place of those chars. I didn't understand what u meant with "the ASCII extensions are a mess of incompatible code pages". |
Thomas Fjellstrom
Member #476
June 2000
|
Quote: I tried U_UTF8, and I get a ^ in place of those chars. That means allegro couldn't find the char in the font. Make sure your font has them, and in the right place. -- |
Wagner Soares
Member #9,011
September 2007
|
Quote: That means allegro couldn't find the char in the font. Make sure your font has them, and in the right place.
I wasn't using BITMAP fonts, I was using glyph keeper, and loading a TTF (Monotype Corsiva). glyph keeper has other function (gk_create_allegro_bitmap_font_for_range) but with that, the application stops to respond. So I'm asking for alternative ways to use TTF (not image fonts) in my project, and support those chars. I was thinking about make my own BITMAP fonts and functions, but I don't want to lose performance. |
Kirr
Member #5,060
September 2004
|
Hi Wagner. Can you post a short program that demonstrates low performance with Glyph Keeper? Glyph Keeper is all about performance. If it works slowly it is probably because you are not using glyph cache, or because you render translucent text onto a 8-bit bitmap, or some other problem like this.. Do Glyph Keeper examples also work slowly for you? Especially the benchmark? Please post more information and I'll try to help. -- |
Wagner Soares
Member #9,011
September 2007
|
GLYPH_FACE *face; face = gk_load_face_from_file("MTCORSVA.ttf", 0); and when I use mtcorsva with: textprintf ( Tela, mtcorsva, 10, 10, makecol(255, 255, 255), "(áãç FPS: %d", Fps); or textout ( Tela, mtcorsva, "Testando acentos com Glyph Keeper áãç", 10, 30, makecol(255,255,255) ); I get a consederable drop at the game speed, but only if I use FONT *mtcorsva with Allegro functions. |
Kirr
Member #5,060
September 2004
|
Please try this: GLYPH_FACE *face; GLYPH_REND *rend; GLYPH_KEEP *keep; FONT *mtcorsva; keep = gk_create_keeper(0,1*1024*1024); face = gk_load_face_from_file("MTCORSVA.ttf", 0); rend = gk_create_renderer(face, keep); mtcorsva = gk_create_allegro_font(rend); and tell me if it helped. Also, Glyph Keeper certainly supports "áãçâ and others like that", you just have to use one of the Unicode Transformation Formats for your text for them to work. (UTF-8 or UTF-16). Use any Unicode text editor to save your text in such format. Allegro Unicode routines can be useful too. This way you are getting one step closer to writing an internationalizable program. -- |
Wagner Soares
Member #9,011
September 2007
|
thanx, this solves the problem, but I didn't understand how. I have one last question, glyph keeper has textout function like textprintf from Allegro, if I want to print a variable. |
Kirr
Member #5,060
September 2004
|
Glad that it worked. Now you are caching the glyphs instead of rendering them every time you need them. Quote: I have one last question, glyph keeper has textout function like textprintf from Allegro, if I want to print a variable. No Glyph Keeper does not have such function. You can use sprintf (or better snprintf) to format your text. -- |
|