While I’ve mostly been taking a break from working on Paint.NET in the short term, I have been slowly working on the next minor bugfix release. The biggest change will be with how fonts are handled with DirectWrite, for all Windows 7 and many Vista users.

GDI and DirectWrite differ in the way they organize the available font families that are installed. For example, DirectWrite (and WPF and CSS) list the “Arial” font family, and include “Arial Narrow” and “Arial Black” in that bucket. You can choose those variants by varying the Weight, Style, and Stretch that you request. “Arial Narrow” would be selected by asking for the “Arial” family, and a Stretch value of “Condensed.”

GDI, however, lists “Arial Narrow” and “Arial Black” separately. This is the organization model that most software in Windows follows, starting with Notepad and going all the way to Word. Once you’ve chosen the font family, you use toggle buttons for Bold, Italics, Underline, and Strikeout. It’s a fairly simple model, and even more important is that it is well understood and people are comfortable with it.

Paint.NET now uses DirectWrite when it’s available, on both Windows 7 and Windows Vista. However, due to time constraints, the font family list is presented as-is, with no way to select font faces like Arial Narrow, and no way to configure the Weight, Style, and Stretch properties. In effect, Arial Narrow is unavailable, or “missing”.

The other difference is that DirectWrite does not handle bitmap fonts. This includes old staples like Courier, Terminal, and Fixedsys. These are of limited use in UI nowadays, but can be fun when doing image editing for certain stylistic reasons. Maybe you want to make a funny image with a talking robot, and using a font that looks like it came from a Commodore 64 helps out a lot here. Again, due to time constraints, this missing feature of DirectWrite is also projected directly into the feature set of Paint.NET.

So, I’m happy to say that in the upcoming Paint.NET v3.5.2 will “fix” all of this. For the technical minded, this is actually three fixes. The first is that Paint.NET will always ask GDI for the list of installed fonts, instead of DirectWrite. This ensures that the list in the toolbar includes Arial and Arial Narrow, etc. Second, the initialization code for the font renderer now has a fallback whereby if it asks for “Arial Narrow” and DirectWrite rejects it, that it will then ask DirectWrite to interpret it as a GDI font name (it uses CreateFontFromLOGFONT).

Third, if DirectWrite still refuses to accept the font name, then GDI will be used as an ultimate fallback renderer. This last change actually serves two purposes, the second one being an accidental but helpful corollary. First, it enables bitmap fonts in Paint.NET again. Second, there are many cases where DirectWrite has more strict error handling than GDI, and this has resulted in crashes for some users with some fonts. Now instead of a crash the user will either get GDI to render the font correctly, or GDI will render some generic substitution font like Arial. Neither is optimal, but both are highly preferable to a crash or error message.

A silly robot picture using bitmap fonts, with Arial Narrow highlighted in the font list

Other changes in Paint.NET v3.5.2 include a fix for a nasty memory leak, some bad text kerning when antialiasing is disabled, and some other functionality glitches that crept in.

Advertisements