Merge: gamnit: intro support for Angel Code bitmap font
authorJean Privat <jean@pryen.org>
Thu, 25 May 2017 14:55:20 +0000 (10:55 -0400)
committerJean Privat <jean@pryen.org>
Thu, 25 May 2017 14:55:20 +0000 (10:55 -0400)
The BMFont format supports packed textures, varying advance per character and even kernings. It can be generated by a number of tools, including:
* BMFont, free software Windows app, http://www.angelcode.com/products/bmfont/
* Littera, a web app, http://kvazars.com/littera/

This PR also generalizes the `Font` and `TextSprites` concepts, previously limited to tile set bitmap fonts. And add a new shortcut service to the excellent DOM parser used to parse the XML description.

The result is much nicer than what was previously available, you can see it in a preview of my latest project:
![screenshot from 2017-05-22 12-38-55](https://cloud.githubusercontent.com/assets/208057/26353142/eeeb29a6-3f8c-11e7-847d-b5ccc8a93822.png)

The parsing method crash easily on malformatted font description file. However, since the description file should be generated, loaded at game start and not often modified, all expected crash errors should occur in dev only. Errors that can happen in production, like a truncated file or a misplaced file, should be detected by the basic sanity checks.

If an error occurs while loading a font, there is currently no automatic fallback and it will probably lead to an unusable game. It could be remedied by adding a default font, similar to the default material and mesh. It would be very useful, even at the beginning of any projects, but there is some technical limitations to implementing it as of now.

In the future, I plan on moving up more services from `TileSetFont` and add text alignment features. The `flat` module needs to be split in a group to include more services, including fonts.

Pull-Request: #2459
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>


Trivial merge