How GLBasic does its kerning internally?

Previous topic - Next topic

nabz32

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 )?


kanonet

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 is quite popular in the community, as far as I know. Also check his website.
  • Personally I fond Qedo's work 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.
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

nabz32

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.


nabz32

I solved the kerning issue with this approach =D.
Tomorrow I can finally start to experiment with the vector fonts for effects.