Jump to content
Posted 27 July 2014 - 09:02 AM
Posted 27 July 2014 - 10:14 AM
Posted 27 July 2014 - 11:32 AM
I tried using BMFont, but it seems to generate a font subset as opposed to a "Font sheet". I don't think you can use that in a self-rolled rendering engine as there's simply no texture to load. Enlighten me please ;.(
Posted 27 July 2014 - 08:56 PM
When you ask for a font sheet, you need to be specific. There are several formats for identifying characters used in computers but most common are ASCII, UTF8 (encompases ASCII), and UTF16. Using UTF16 there are 1,112,064 different characters (Think about all the different languages like English, Arabic, Chinese, Japanese, etc...) so imagine trying to fit all that into a single sheet! BMFont allows you to select only the characters that you will need in your game thus reducing the size of textures needed to store the required glyphs.
When using BMFont, you select which characters you want to export, sometimes you might only want some from a certain set ie. ASCII or sometimes you want an extended set if using wide character (ie. UTF16) encoding. So you select which characters you want, probably just the basic Latin characters, they will be highlighted. Then you set the exporter options as to which descriptor file format you want (Text, XML, or Binary) and the character descriptions will be exported. Another (possibly more than one) file will be created as well. These are the glyph pages and will be in what ever texture format you selected (DDS, PNG, or TGA). When using these files you open and parse the .fnt font descriptor file which tells you basic info about the font settings (ie. Line Height, texture settings, etc.) then you load info about each individual glyph, and which character value it corresponds too, which texture page it is located on, and the texture coordinates, size, and how much to advance the drawing position when moving to the next character. These .fnt descriptors might also include kerning data which will adjust the spacing between specific character pairs such that the font renders with a nicer looking spacing.
Everything about the program and the file formats can be found in the documentation including examples on how to render some text here: http://www.angelcode.com/products/bmfont/documentation.html
As a proof of concept, I have actually just completed a font renderer using the binary file format generated by BMFont.
Note: Apologies if I have a mistake about wide character encoding, I mostly just stick to the ASCII set.
Edited by RnaodmBiT, 27 July 2014 - 08:58 PM.
Posted 28 July 2014 - 01:28 AM
Posted 28 July 2014 - 01:31 AM
Yes, the details on what you get from the fnt file is described in the link I posted above.