[AD] character length in given font |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Hi,
as I wanted to implement text wrapping functionality into my tooltip
class I needed a function which returns the size of the letter in the font
used. I found one but it is for internal use only, therefore I added the
lines:
int al_char_width(AL_CONST FONT *f, int letter)
{
return f->vtable->char_length(f,letter);
}
to the end of font.c and added
AL_FUNC(int, al_char_width, (AL_CONST FONT *f, int letter));
to the end of text.h
Which even worked (under M$DOS) just fine, under Windows the .def file needs
to be recreated as well.
Should you decide to add this/such a function officially the naming and
placing of the function is of course up to the maintainers.
This is a quick hack and I'm sure there are more elegant ways to implement
such a routine if you know more about the internals of Allegro, but
it works :-)
cu,
--
Bernd