Have you tried entering the text in the program itself using a Textbox
widget? You can also try using literal UTF-8 code units in your program,
like this:
        AG_TextMsg(AG_MSG_INFO,
            "\xE6\xB1\x89\xE8\xAF\xAD\x2F"
            "\xE6\xBC\xA2\xE8\xAA\x9E\x0A");

I've obtained the sequences from: http://rishida.net/tools/conversion/;
this renders correctly using HAN NOM B.ttf, but not under MSYH.ttf.

Agar calls Freetype to render text so you probably won't find anything
relevant to this issue in the Agar code. Agar simply converts the strings
from UTF-8 to UCS-4 and passes them to Freetype as-is.

On Thu, Jul 09, 2009 at 09:13:07AM +0800, Gang Tang wrote:
> emm, I tried that. But up to set it doesn't meet my need.
> The characters displayed on label are not my expectations, similar
> with "I want to A, but get V".
> 
> I am ready to deep into agar's code to find something, will you give
> me some help when needed. :)
> 
> On Wed, Jul 8, 2009 at 10:18 AM, Julien Nadeau<[email protected]> wrote:
> >
> > I suggest you try the Han Nom font set, available from:
> > http://vietunicode.sourceforge.net/fonts/fonts_hannom.html.
> >
> > Attached screenshot is from the "hello world" demo using the
> > "HAN NOM B.ttf" font. Those characters were missing from msyh.ttf
> >
> > On Thu, Jul 02, 2009 at 08:11:17PM +0800, Gang Tang wrote:
> >> Dear Nadeau,
> >>
> >> I have to ask for further help.
> >>
> >> I have modified the code as you supplied. It seems like follows:
> >>
> >>         AG_SetString(agConfig, "font-path", "/root/.fonts/");
> >>         AG_Font *font = AG_FetchFont("msyh.ttf", 24, 0);
> >>         printf("0x%x.\n", font);
> >>         if (font != NULL)
> >>              AG_TextFont(font);
> >>         my->mySurface = AG_WidgetMapSurface(my,
> >>                     AG_TextRender("?????????Custom widget! ??????!"));
> >>
> >> compile and run it, it pop a SDL window, display like follows:
> >>
> >>
> >> ?????????Custom widget!?????????
> >>
> >> that means the Chinese characters are all been displayed as blank
> >> rectangles. Why?
> >>
> >> Because SDL lib has function SDL_EnableUNICODE to support utf8 characters, 
> >> I
> >> want to ask whether there is a corresponding funciton to that?
> >>
> >> Fanally, how I shoud do to display them correctly?
> >>
> >> Thank you, very much.
> >> On Thu, Jul 2, 2009 at 4:51 PM, Julien Nadeau <[email protected]> 
> >> wrote:
> >>
> >> >
> >> > Sorry, AG_SetDefaultFont() is only in 1.3.4-beta, but in 1.3.3 you
> >> > can still do:
> >> >
> >> >        agDefaultFont = font;
> >> >
> >> > On Thu, Jul 02, 2009 at 04:00:02PM +0800, Gang Tang wrote:
> >> > > Thanks for your rapid reply. But I cann't find this function:
> >> > > AG_SetDefaultFont in agar lib, is there something wrong?
> >> > >
> >> > > 3ks.
> >> > >
> >> > > -----------------------
> >> > > Using AG_FetchFont() in your program initialization:
> >> > >
> >> > >        AG_Font *font = AG_FetchFont("msyh.ttf", 12, 0);
> >> > >        if (font != NULL)
> >> > >                AG_SetDefaultFont(font);
> >> > >
> >> > > See http://libagar.org/man3/AG_Text for details. AG_FetchFont() will
> >> > scan
> >> > > the "font-path" directories for the ttf file. You'll probably want to
> >> > > edit the font-path before setting the font:
> >> > >
> >> > >        AG_SetString(agConfig, "font-path", "/path/to/fontdir");
> >> > >
> >> > > _______________________________________________
> >> > > Agar mailing list
> >> > > [email protected]
> >> > > http://libagar.org/lists.html
> >> >
> >

_______________________________________________
Agar mailing list
[email protected]
http://libagar.org/lists.html

Reply via email to