0

I am trying to support korean font in my Allegro project.

I've converted ttf to fnt format with many sorts of programs, and check to see whether it works the way I expect it to. However, it never did.

PALETTE pal;
FONT * font10;
font10 =  load_font("korean.fnt", NULL, NULL);
textout_ex(screen,font10,"안녕하세요", 32, 32,
             makecol(255, 0, 255), -1);

Could anyone point me in the right direction?

Makoto
  • 104,088
  • 27
  • 192
  • 230
kim taeyun
  • 1,837
  • 2
  • 24
  • 49

1 Answers1

1

Save your source code with UTF-8 encoding. Call this function before trying to use strings:

set_uformat(U_UTF8);

From the manual:

Generally you should only call set_uformat() once, before allegro_init(), and then leave it on the same setting for the duration of your program.

Check out the exunicode.c example that comes with Allegro for more information.

Alternatively, you may want to consider Allegro 5 if you are just starting out.

Matthew
  • 47,584
  • 11
  • 86
  • 98