Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


[SOLVED] Where to get a Font Sheet for Direct3D 11 use?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 RoundPotato   Members   -  Reputation: 126

Like
0Likes
Like

Posted 27 July 2014 - 09:02 AM

Hi.
 
Unfortunately rastertek.com seems to have went down, so I can't even learn how font rendering is done.
 
I believe you need a Font sheet to get the characters out for mapping. Where/How does one get one?

Sponsor:

#2 unbird   Crossbones+   -  Reputation: 7160

Like
1Likes
Like

Posted 27 July 2014 - 10:14 AM

If it's just about rendering text use MakeSpriteFont and SpriteFont from DirectX Tool Kit. Open source so you can study the code.
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.

#3 RoundPotato   Members   -  Reputation: 126

Like
0Likes
Like

Posted 27 July 2014 - 11:32 AM

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.

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 ;.(



#4 RnaodmBiT   Members   -  Reputation: 831

Like
1Likes
Like

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.


#5 RoundPotato   Members   -  Reputation: 126

Like
0Likes
Like

Posted 28 July 2014 - 01:28 AM

Thanks RnaodmBiT.

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.

Right?

#6 RnaodmBiT   Members   -  Reputation: 831

Like
1Likes
Like

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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS