How to know whether to go with the old or the new?

by Michael S. Kaplan, published on 2005/10/11 03:31 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2005/10/11/479438.aspx


I believe I have mentioned before (perhaps in passing) about how WinForms 2.0 is not locked into using GDI+ for it text rendering.

This is really a good thing since the GDI+ text shaping engines have not been updated for some time, and every new lanaguage requiring a rendering engine added since XP SP2 (not to mention all of the shaping engines that have been updated since then) have been unvailable in GDI+. So the world is moving ahead and should not be held back here.

With that said, although I am 100% in favor of progress and getting the latest language support, I am not dumb enough to think that this is the only consideration. :-)

Luckily for all of us, the WinForms team isn't either!

In order to know who wins the battle for which method to call:

there is a (settable!) UseCompatibleTextRendering property on the various WinForms controls that tells the .NET Framework whether to be compatible with what was or to embrace what is and what will be.

And as a bonus (this info from the inestimable Jessica Fosler!), you can use Label.GetPreferredSize(proposedConstraints) to correctly switch between GDI/Uniscribe and GDI+.

And Bravo to all of the folks on the WinForms team for developing an clever and innovative solution with the ability to support full backwards compatibility....

Awesome!

 

This post brought to you by "" (U+1826, MONGOLIAN LETTER UE)
A letter whose WinForms story is significantly enhanced when combining version 2.0 and Vista!


# Mike on 11 Oct 2005 10:30 AM:

Also, according to the help page you mentioned, UseCompatibleTextRendering is a compiler switch, which is even better so you don't have to muck around with setting individual properties on each control.

# Mike on 11 Oct 2005 10:37 AM:

or another way of doing it:

Application.SetCompatibleTextRenderingDefault will change the default for every control in the application.

# Michael S. Kaplan on 11 Oct 2005 10:49 AM:

Ah, two excellent points, Mike -- they definitely make the global setting story easier to manage!

# Jerry Pisk on 11 Oct 2005 12:20 PM:

So doest GDI+ is a dead end project that has already been abandoned and our code would be better off never to use it?

# Michael S. Kaplan on 11 Oct 2005 12:26 PM:

Hi Jerry,

I cannot speak to that knowledgeably, because I am not involved with that team's plans. But the GIFT team builds the shaping engines consumed by both GDI/Uniscribe and Avalon -- and there is no move to update the shaping engines. There may be other aspects of GDI+ unrelated to text that are incredibly useful?

Please consider a donation to keep this archive running, maintained and free of advertising.
Donate €20 or more to receive an offline copy of the whole archive including all images.

referenced by

2006/05/28 Mirror, mirror... before whom I fuss, does mirroring work well in GDI+?

go to newer or older post, or back to index or month or day