This content has moved - please find it at https://devblog.cyotek.com.

Although these pages remain accessible, some content may not display correctly in future as the new blog evolves.

Visit https://devblog.cyotek.com.

Cyotek.Drawing.BitmapFont Version 2 Released

A screenshot of the updated demonstration application

I've slowly been picking up the reins on my languishing open source projects, and the first to get a proper release is our BMFont parsing library, Cyotek.Drawing.BitmapFont.

What's New and Improved

  • The original library targeted .NET 2.0, the new package targets .NET 3.5, 4.0, 4.5.2, 4.6.2, 4.7.2, and 4.8, .NET Standard 1.3, 2.0 and 2.1, and .NET Core 2.1, 2.2 and 3.1. Unfortunately dotnet build doesn't support .NET 2.0 as far as I can tell so I dropped that target
  • Binary support. I originally added binary support in 2017 and it sat gathering dust in a branch. Now tidied up and part of the core library - I recommend using this format where possible if you care about efficiency
  • Empty and invalid character support. The BitmapFont indexer will no longer throw if the requested character is not found, instead if the font defines the "invalid" character this be returned, otherwise an empty character definition.
  • Assorted performance improvements for loading text based fonts
  • Although not a concern for consumers of the library, the demonstration program has been fleshed out a bit more and an additional demonstration added

A new demonstration application included in the source code

There are various other smaller changes and additions, see the Release Notes page for the full details.

What's Next

Now that I have a multi-targeted mostly cross-platform version, I can now consider more drastic changes that are breaking. Tentative planning for v3 include

  • Making all structures immutable (properties on the BitmapFont class will remain read-write)
  • Changing all property values to match their binary types, e.g. rather than using int for everything, byte and short will be substituted as appropriate. This doesn't seem to result in much of a drop in memory so this one is tentative
  • Removing the reference to System.Drawing; properties such as Bounds will be removed and replaced with individual native properties (e.g. X, Y, Width, Height). Some of these properties were added in v2 and their original counterparts marked as obsolete
  • Adding concrete collections instead of exposing IDictionary which is a) tidier, and b) easier to use
  • Refactoring to move code around
  • Potentially adding the ability to save fonts in each of the 3 formats (no, I am not going to duplicate the BMFont application, but I could see potential value in being able to tweak values)

Comments and suggestions on these potential updates welcome!

Downloading the update

The library is available as a NuGet package, or you can download release binaries and/or source from GitHub.

Related articles you may be interested in

About The Author

Gravatar

The founder of Cyotek, Richard enjoys creating new blog content for the site. Much more though, he likes to develop programs, and can often found writing reams of code. A long term gamer, he has aspirations in one day creating an epic video game. Until that time, he is mostly content with adding new bugs to WebCopy and the other Cyotek products.

Leave a Comment

While we appreciate comments from our users, please follow our posting guidelines. Have you tried the Cyotek Forums for support from Cyotek and the community?

Styling with Markdown is supported