hi guys
i'm south korean allegro user
i am not good at english.
Sorry, but I don't speak English well.
(please understand even if you can't understand me clearly)
{"name":"xozg.jpg","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/b\/8bc80dc0dc8ee199bcb83859007c3dc6.jpg","w":923,"h":329,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/b\/8bc80dc0dc8ee199bcb83859007c3dc6"}
{"name":"pnuu.jpg","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/c\/d\/cd914853bb0fffeb967f724356fdc0d8.jpg","w":500,"h":388,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/c\/d\/cd914853bb0fffeb967f724356fdc0d8"}
I think you need to save your source file as UTF-8 before it will work.
Edgar Reynaldo// ㅜ0ㅜ im text output failed but Thank you comment
Well, al_draw_text cannot draw non-ASCII text. But al_draw_ustr will work IF you make sure the strings in your C file are in UTF-8 format. ISO-2022-KR or EUC-KR will NOT work. Allegro supports UTF-8 only.
al_draw_text cannot draw non-ASCII text
It can, but the string must be UTF-8 encoded.
Ah? I didn't know that. Thanks for mentioning that here!
It's not mentioned in the manual, it seems, so I'll see if I can contribute a patch for the manual that clarifies this.
i'm this source file is utf-8 encoding later build play but no text output (T0T)
Attach the font that you are using so I can test this on my laptop. I don't know how to get CodeBlocks to display chinese characters though, so I can't tell if I'm doing it right yet.
將您所使用的字體,所以我可以測試我的筆記本電腦上。我不知道怎麼弄碼塊雖然顯示中文字符,所以我不能告訴如果我還這樣做是正確。
Jiāng nín suǒ shǐyòng de zìtǐ, suǒyǐ wǒ kěyǐ cèshì wǒ de bǐjìběn diànnǎo shàng. Wǒ bù zhīdào zěnme nòng mǎ kuài suīrán xiǎnshì zhōngwén zìfú, suǒyǐ wǒ bùnéng gàosu rúguǒ wǒ hái zhèyàng zuò shì zhèngquè.
(Just google translate)
Edgar Reynaldo//
yes attach my font
l_10646.ttf // i employ font
맑은고딕.ttf // my country korea text font
you success please
visual00,
The font you are using, L_10646.ttf, does NOT support Korean in Allegro. Probably it does not support Unicode encoding.
I attached an open-source Korean font (which you can use freely with your program). When I use the font as in the attached program korean.c , and put it in the same directory as the program when I execute it, it works.
For Allegro, it is best to always use open source fonts, and distribute those with our program. Never use the fonts that come with Windows. Because, some people will not have that font. I hope this solves your problem.
beoran, Thank you and sorry your korean.c source i
i have questions
um...
↓↓↓ korean.c source file comfile result ↓↓↓
1.
{"name":"ovin.jpg","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/2\/9\/2911c9bf7387ead4ea008a20da65a8dc.jpg","w":1280,"h":768,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/2\/9\/2911c9bf7387ead4ea008a20da65a8dc"}
2.
{"name":"pxdz.jpg","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/3\/b35e25ee189d328ba610adf752c836e0.jpg","w":1016,"h":736,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/3\/b35e25ee189d328ba610adf752c836e0"}
korean characters be cut off why??
When I run this program (on Linux, compiled using GCC), the whole Korean string displays without problems. I think the ? means that the encoding of the korean.c file somehow isn't UTF-8 anymore.
Perhaps you should try not to use MSVC, and in stead download ad install mingw http://mingw.org/ and a good source editor, perhaps notepad++, in which you can set the source encoding on saving to UTF-8 correctly.
The problem is that it is very hard to convince MSVC output UTF-8 encoded strings unchanged in the executable. You can probably find some information about it on Korean web pages, as it is hard to explain.
One solution that works everywhere is to move your strings into an external file. For example, ex_ttf.c and ex_ttf.ini
Oh my... it seems that like Peter says, MSVC starting from 2008 does indeed miscompile UTF-8 strings. See here for more information: http://stackoverflow.com/questions/688760/how-to-create-a-utf-8-string-literal-in-visual-c-2008
I recommend switching to MINGW and a different IDE like CodeBlocks http://www.codeblocks.org/, more specifially http://www.codeblocks.org/downloads/26. Get the version that has MINGW included, it should be the easiest for you to install.
If you must use MSVC 2010, then applying this hotfix + using #pragma execution_character_set("utf-8") might help: http://support.microsoft.com/kb/980263.
Or you could try to save the file in UTF-8 without BOM. Although I read that that doesn't always work.
EDIT: I changed the korean.c program to use the attached koran.ini as config file for its text. I have a section [english] for english text and [korean] for korean text. Like this, it's easy to translate the application based on the user's language. All files go in the same directory, of course.
wow!
beoran and peter wang Thank you for teaching me
very very Thank you
solve a problem
i'm korea programming forum
Your teaching Share information with your name
real very very Thank you
You are welcome.
I hope you'll have a lot of fun learning how to program in C using Allegro.
I still can't make it work with Cyrillic text. I tried to use TTF font with Latin and Cyrillic symbols in it (70KB). In result Latin symbols is printed, but Cyrillic is only clean space... Then i tried Unicode 6.2 TTF font (22MB). I've got the same result. Even if i use ALLEGRO USTR I've got the same...
There's my recent try to discuss (only close to theme part of code):
And result: only "Crazy" printed, without "Выхухoль"
{"name":"607775","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/3\/6\/36dfd2e43de603d643aa6eca770d2903.png","w":508,"h":129,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/3\/6\/36dfd2e43de603d643aa6eca770d2903"}
By the way: i search in data files of another allegro based games and look what i found: in a game with Cyrilic text 2 files - font01.PCX (21KB) and font01.TXT with "Font01.pcx 0x22 0xFF" inside. Maybe it helps solve the problem.
Slaweek Shpachenko, I think thatyour problem is exactly the same as visual00's pronblem. That is, you're using MSVC on Windows, and MSVC from version 2008 doesn't support UTF-8 encoded text in the source code. On Linux, your code displays the Russian fine. You must use text files, or a different compiler like MINGW to get it to work.