Unfortunately that wouldn’t help someone who uses a non-ascii characterset
like unicode.
The SDL_TTF2 lets you pass a unicode string (or ascii, as it will just
convert it to unicode(UTF-16) anyways) and get the resulting bitmap of the
complete string.
I should note that the fixed (static) method of pre-rendering the glyphs at
a fixed font size and then using the already rendered glyphs to construct
the string is more efficient if only one font and size is being used (and
has a fixed width and height.) This can still be extended to unicode, by
rendering only the characters you are going to use beforehand (Which would
make Chinese a nightmare IMO.)
I don’t think anyone is going to try and render the entire unicode character
set beforehand.
Most english games and most console games used bitmap fonts of fixed width
and height or they pre-render the font into whatever is going to be used (so
say a menu with a larger font size only has 6 items, the 6 items would be
more efficient than an entirely new bitmap font.)
Asian games however have typically relied on fixed fonts in the ROM of the
computer system (like PC-98) or use a font that is always present on the
system. (@MS Gothic(8MB), @MS Mincho(9MB), Arial sans Unicode(23MB).) These
fonts are huge (in comparison to similar western european fonts that fit in
the ASCII space. Most less than 500KB.)
So if your target audience is english, french, german, spanish, etc you can
get away with rendering all the glyphs and assembling the strings from the
glyphs. Otherwise rendering the string through the TTF string rendering is
the only managable way of supporting foreign character sets.
Probably the last issue is user-input. IME’s can pass the unicode, but if
you plan on displaying the unicode, you need unicode support in the font
system, you can’t guess and preload a certain set of glpyhs because you
don’t know what the user is going to use.> ----- Original Message -----
From: sdl-admin@libsdl.org [mailto:sdl-admin at libsdl.org]On Behalf Of
Shane Fausett
Sent: October 10, 2001 1:02 PM
To: sdl at libsdl.org
Subject: Re: [SDL] Text Display
At 09:29 PM 10/10/2001 +0200, you wrote:
I do all of my own text display routines … generally i drop my font into a
bitmap and then calculate all of the rectangles around it and display a
string with a function like this …
int FontBlitII(int x,int y, char* strngtoblit, SDL_Surface* pDest)
{
SDL_Rect dest;
int count=0;
int len=strlen(strngtoblit);
for (count = 0; count < len; count++)
{
dest.y=y;
dest.x=x;
SDL_BlitSurface(sdl_sprite,
&font_rects[(int)strngtoblit[count]],pDest,&dest);
x+=font_rects[(int)strngtoblit[count]].w;
}
return x;
}
Hi everyone,
Does anybody know how to display text using SDL? Is SDL_ttf
required? And
if so, where can I find the binary for BeOS. The “BeOS compatibility” icon
is shown in http://www.libsdl.org/libraries.html, but still I can find no
binary for BeOS. Any help would be appreciated.
Thanks in advance,
Mahmoud Al Gammal