On Thu, Jul 02, 2009 at 02:40:38PM +0800, Gang Tang wrote:
> Dear all,
>
> I am ready to use agar in my project, I am in China,
> and want to render Chinese using msyh.ttf (which is a
> beautiful vector Chinese font file released by Microsoft).
>
> At this moment, I am working under debian lenny linux
> with UTF8 as default system environment code. here I
> want to ask:
>
> 1. How to load an existing ttf file from file system in agar?
> which API?
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");
> 2. Does agar support UTF8 char code? I know freetype
> support it.
Yes, Agar recognizes and displays UTF8 characters by default. The
AG_Textbox and AG_Editable widgets can edit UTF8 encoded strings
using AG_TextboxBindUTF8() / AG_EditableBindUTF8().
_______________________________________________
Agar mailing list
[email protected]
http://libagar.org/lists.html