Paint.NET v3.5 – Better font handling, and performance. Again.

Last Thursday I release a new alpha of Paint.NET v3.5, build 3450. I have rewritten the way that fonts are handled for and by the Text tool. Even if you don’t use the Text tool much, you will still notice some improvements! (see the bulleted list below)

In previous versions of Paint.NET, there are two forms of text rendering supported. The first and the default is called “Smooth”, which utilizes GDI+* to render text. The second is called “Sharp”, and uses GDI. For both, GDI+ is used for font enumeration through the classes in the System.Drawing namespace. Over time, GDI+ has proven to be a poor system for font handling. It has been the cause of many crashes, as GDI+ has a tendency to crash or trample on memory when it encounters fonts that are “bad” (although bad is relative – the font itself may be perfectly fine!). This has led to some people being completely unable to use Paint.NET through no fault of their own.

As a result, I have banished GDI+ from the Text tool. The new builds of Paint.NET are using GDI exclusively for font discovery and text rendering, a change that was substantial in the amount of code that was required and the amount of research that had to be done to make sense of it all. If you’d like to get an appreciation of the depth of the subject, you should check out chapters 14, “Fonts”, and 15, “Text”, of the book, Windows Graphics Programming: Win32 GDI and DirectDraw (Hewlett-Packard Professional Books).

The new typography system in Paint.NET has been designed so that I can plug new text rendering technologies into it. Right now it only supports GDI. For the meantime this means that the choice between “Sharp” and “Smooth” is not available. My next step is to add support for two more text rendering systems, FreeType and DirectWrite (for Windows 7 users**). The former will step in to provide the “Smooth” renderer, and the latter will be added under the name “Enhanced” (or some appropriate name).

In the meantime, you’ll still realize the following benefits in the latest alpha:

  • No more “missing” fonts. GDI+ doesn’t support some fonts, notably bitmap, vector, and certain OpenType fonts. I don’t know why. You’ll notice that the new versions of Paint.NET now has a “complete” font list.
  • Improved startup performance. It’s ironic that I was telling my manager at work the other day, “Paint.NET v1.0 had poor startup performance – in fact, it was enumerating all the system fonts at system startup, but it no longer does.” Well, because of a bug in my layout code for the toolbar, Paint.NET v3.36 was still doing this! I fixed the bug, and Paint.NET v3.5 now properly defers this to later. I’ve measured the improvement in startup performance at about 15%*** on my systems, and if you have a “lot” of fonts you will no doubt see an even bigger improvement. This is in addition to the already improved startup performance of v3.5 versus v3.36!
  • Improved stability. Like I mentioned earlier, GDI+ often crashes when it runs into “bad” fonts (subject to GDI+’s definition of “bad”). Or, it has bugs that lead it to trample on memory it does not own, resulting in crashes which get attributed to the wrong code. GDI does not have this problem. Or, at the very least, if it runs into “bad” fonts, I now control the code that deals with this. I can then make it do something other than crash.
  • Installing new fonts. Previously, Paint.NET needed to be restarted for it to recognize any new (or deleted) fonts. I now place a FileSystemWatcher object on the system fonts directory and refresh the toolbar’s font list when changes are detected. There is also a shortcut in the Utilities menu to open the Fonts directory, which will be very useful for helping answer the question that is asked with surprising frequency on the forum: “How do I add fonts?”

* The Wikipedia article states that in the Windows XP timeframe, GDI was deprecated in favor of GDI+. This is not true, although it may have been the altruistic intent at the time.

** This will eventually be supported on Windows Vista as well. 

*** On my personal system, the difference is 0.577 seconds versus 0.405 seconds, as reported by Process Explorer. This is not a formal or exhaustive performance analysis. The precision and accuracy of Process Explorer is not at the millisecond level, hence me rounding all the way down to 15%. The system is an Intel Core i7 920 overclocked to 3.6GHz running Windows 7 RC build 7100. Another system, a Core 2 Quad Q6600 2.4GHz system running Windows 7, reported values of 1.0 second versus about 0.8 seconds, respectively.

Advertisements

39 thoughts on “Paint.NET v3.5 – Better font handling, and performance. Again.

  1. spritemoney says:

    I have a suggestion!!! when PDN crashes can it restore the images, especially when i forget to save the images! please add this feature to 3.5 or 4

  2. Olivier says:

    Great improvement! One nice thing for font handling would be to have the possibility to modifiy text blocks once you have switched to another tool. Right now, you need to remove and retype the text if you made an error and you have swtiched to another tool. I understand that this kind of feature may not be easy to implement 😉

  3. Brad says:

    “How do I add fonts?”

    Maybe there could also be Effects and File Types folder links.

  4. Wilfred says:

    Have you badgered the GDI+ folk about this? Seems a shame to have so many dependencies just for fonts.

    Anyway just thought I’d also say really impressed by Paint.net

  5. Matt says:

    Wow, these sound like really beneficial improvements. I can’t wait for the release. 🙂

  6. Ryan says:

    @Olivier: I agree.
    Of course, this is beyond image editors, but imagine if each text field, shape etc. was an object after placed down?

  7. Grijan says:

    What you (Olivier, DaSilva and Ryan) are proposing would be part of a vector drawing engine. Maybe it could be implemented in Paint.NET 4.0 as a new kind of layer (vector layer?), of course. But the question is: there are excellent vector drawing programs that are free/open source (like Inkscape), so is it worth the development time? If I had to decide between vector layers and effect layers (because both can’t be done in a reasonable timeframe with limited development effort), I would choose the later. If I want vectors, I can always create an SVG in Inkscape, export it as a transparent PNG, and import it as a layer in PDN. I can’t say the same for effect layers.

  8. Thomas says:

    What has the choice between GDI/GDI+ to do with the availability of smooth/sharp? Both (gdi/gdi+) can handle fonts with sharp and smooth fonts. In GDI it’s the “fdwQuality”-parameter of the CreateFont-fuction which changes between smooth and sharp edges and in GDI+ it’s the Graphics.TextRenderingHint property which gives you the choice. So at least from my (very) naive point of view it should be easy to support both rendering types. It’s just, that a smoothed font in GDI looks different from a smoothed font in GDI+ (same for sharp edges), but this doesn’t matter.

  9. Timo says:

    Great progress! Hope we’ll soon see the 1st public beta…

    Anyhow, I wonder if it will be possible to *edit* placed text in 3.5 or 4.0…?

  10. Rick Brewster says:

    Thomas — It was a heuristic choice of terms for the layperson. GDI+ seemed to draw ‘smoother’ text so it was called ‘Smooth’. No normal person knows what GDI or GDI+ are, so I wasn’t about to put those into the drop down list.

    Olivier, Timo, Matt, Ryan — Editable-after-the-fact text is NOT in the works. Please discuss it somewhere other than this blog post.

  11. Johannes Rössel says:

    As for the text tool … I found a minor bug: You can scroll and zoom just fine when using the text tool (using the mousewheel). However, when zooming, this means holding Ctrl down while moving the mouse wheel. When zoomed far in this (holding down Ctrl) leads to heavy flickering due to the nub appearing and disappearing rapidly. The currently visible image region seems to change whenever the nub is toggled.

  12. Harold says:

    Those startup times are just crazy. On my system, which aint that slow either (3.3GHz quad, 4GB ram) the old version (3.36) takes at least 5 seconds if started cold (6 if you count the time till usable instead of time till fully displayed)
    Of course it’s somewhere around 1 second if it isn’t cold, but who cares about non-cold times?
    I’m not complaining btw.

    Anyway, the big difference can only mean that it does a lot of disk I/O that gets cached.. and perhaps it would be faster to have less separate assemblies..

  13. Mandy Ng says:

    Hi!

    I would like to know if this software still free for commercial use since I can’t go to paint.net at present.

    Pls kindly advise, thanks!

  14. James says:

    FileSystemWatcher is OK, I guess, if you don’t care about occasionally missing events.

    We didn’t have that luxury and had to write our own polling-based version for our server product.

  15. Kluyg says:

    Rectangle selection used to use CPU for 65-70% (Core2Duo 1.8Ghz) at version 3.36 (all this CPU was used just to render the line of selection rectangle!). Glad to hear that this bug was fixed course it was VERY annoying.

  16. Drazick says:

    This is great news!
    I think in Pain.Net 4 you should drop XP and start using all the technologies Vista and 7 introduced in replacements of GDI and GDI+.

  17. Jotaf says:

    I’m on XP, and last time I checked it still accounted for most of the installed systems worldwide. Not everyone is wanting to keep up with the latest fashion – it’s a damn OS.

    Anyway I understand that PDN is not vector based, it’s been stated from the beginning and everyone should be happy at that. Some basic support at the layer level *could* be possible, but I’d like effects layers and plugins with real brushes before that 🙂 Excellent work!!

  18. Rick Brewster says:

    Jotaf — Sorry, not going to happen. Text layers maybe, but not vectors. That’s just a huge can of worms … the moment you add simple support, you immediately have need for a slew of more advanced features. I’d much rather just point people to InkScape or whatever. Let me focus on doing 1 or 2 things well, not 9 or 10 🙂

  19. Anna Hung says:

    Is there a feature that is similiar to Adobe’s Len Correction feature? I wanted to put a dark fading ring around the edge of the photo where the center is the focus.

  20. GoodThings2Life says:

    Since you’re running Windows 7, any chance you can make sure that PDN3.5 takes full advantage of “Default Programs” functionality in Vista/Win7 ? 🙂

  21. Johannes says:

    GoodThings2Life: Basic recent documents support for the jump list is already there, automatically even for the current version. I don’t see much use for other options ni the jump list, though.

  22. samantha says:

    reeditable text like the photoshop feature would be great. And also the pen tool had to be improved. I dont know but it seems youre the onlyone to work on the project, i wonder if they are other people around the world to give you a helping hand.

  23. Rodrigo says:

    Could take the form of rendering sources of paint.net 3.36, I like. It could also be a way to render more like the windows (the current), etc … all together

    Sorry for bad English, I’m Brazilian

  24. Troy Martin says:

    I love you guys. I use Fixedsys as the dialogue font for my upcoming webcomic and I use Paint.NET for the drawing. With v3.5 I don’t have to copy my drawings into MSPaint and add the text there.

    Thank you so much.

  25. Nilesh Tailor says:

    Hey guys i was wondering if we could get the text functionality to the standards of Photoshop…. such as the ability to reedit the text, as well as allow one to add shadows and emboss etc.. i know that one of the main reasons i love photoshop is because of the text configuring functionality.
    i would personally love to help in creating this utility.. i understand you have short dev. time and staff (plus i could use the experience….)

  26. Kyle says:

    Weird..I was planning on using the font “Dotum” on some graphics for my band, but with the upgrade, the font changed.

    At font size 26, the original was only a little different, but definitely more pleasing to the eye.

    At font size 10, the original looks COMPLETELY different. Check it out:

    Both examples were done with default settings.

  27. rm2kpro says:

    I would like to see some more things to do to text other than setting it bold or italic — I especially would like to adjust the line spacing.

  28. schlub says:

    What the heck? When is the “sharp” font feature coming back? It’s one of the features I use most when making buttons with text on them. I might have to use photoshop instead *shudder*

Comments are closed.