Hello, I am in the process of writing a polyvector print function for my game, to achieve some cool effects.
I just wanted to know how GLBasic internally calculates its kerning in its PRINT function?
Does it use some kind of std kerning table ( since fonts are only loaded as .bmp / .png and not the .fnt file itself or how it is called )?
Or does it calculate a kerning table using the font.bmp data on loadfont ( by parsing each letter field with some algorythm )?
Probably the 2nd way, because thats how usually all bitmap fonts are done, when you dont have a file to load all the needed informations from.
If you want to write your own proportional bitmap font, you may also want to have a look at work that others did before:
- Moru's font lib (http://www.glbasic.com/forum/index.php?topic=2223) is quite popular in the community, as far as I know. Also check his website (http://bjornrosenthal.eu/bitmap-font-routines/157/).
- Personally I fond Qedo's work (http://www.glbasic.com/forum/index.php?topic=9108.msg82758#msg82758) very useful and a good start for my own work, especially since its is quite minimalistic and easy to follow.
- Or you look at external tutorials regarding this topic, e.g. I liked to work with Lazy Foo's tutorials (http://lazyfoo.net/tutorials/SDL/41_bitmap_fonts/index.php).
Thx for all the good links Kanonet :good:
I think I will load the font sprite into mem then, upon first use of a new font texture.
From this array I will parse each characters grids colorkeys, once from left to right and once fro right to left.
With this I will gain the real xLeft and xRight boarders of the characters in the font sprite and can store them in a fitting array.
I solved the kerning issue with this approach =D.
Tomorrow I can finally start to experiment with the vector fonts for effects.