[SOLVED] Where to get a Font Sheet for Direct3D 11 use?
Crossbones+ - Reputation: 7490
Posted 27 July 2014 - 10:14 AM
Alternatively use FW1FontWrapper by Erik Rufelt.
Then there's Luna's article and sample code about self-rolled text rendering. At least at this point you could probably work with BMFont to generate your sheets.
Members - Reputation: 126
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 ;.(
Members - Reputation: 911
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.
Members - Reputation: 126
Posted 28 July 2014 - 01:28 AM
I somehow missed the .tga file being generated because it generated in a folder with lots of crap; and that you can change it to .dds or .png in the export settings.
I see, so I select a set of characters and export it. Doing so will provide me with the actual graphical file and a descriptor file to parse the information about extracting the graphical characters from the .dds/.png/.tga.