views:

622

answers:

4
+4  A: 

The anti-aliasing is just a feature of Silverlight; wouldn't say it looks blurry though, I quite like it.

Reference wise, I don't think there's a fully blown app sample I've seen, but if you look into Model-View-ViewModel with IPropertyNotifyChanged / ObservableCollection and have a browse through the blogs of Jesse Liberty and Shawn Wildermuth they have plenty of information on data transfer and multiple page applications - both of which you'll need to do a "business app"

Steven Robbins
+3  A: 

ClearType font rendering implementation on WPF and Silverlight is designed in such a way. Text is animated smoothly but looks blurry.

Jacek Ławrynowicz
+5  A: 

I would definitely say it looks blurry - kind of like as if you were viewing this on OSX or Linux. I too agree that this is unacceptable - together with WPF, of course, where font rendering is awful as well. Now, while Microsoft keeps on promising to fix this for .NET 4 release, fact is, many of us need to ship/sell stuff today, which leads to the following choices:

  • You can ignore common sense and just ship the software as is - making fonts bigger and what have you. So long as your customer buys, what's the problem? (not my choice, though)
  • If you are working with Silverlight, you can wait until some future release until this is fixed (same for WPF). Good luck. Look at how long WPF has been around, everyone knew about this problem and, guess what - it hasn't been fixed.
  • If you are working with WPF, you can get the perfect font rendering - an algorithm that is even marginally better than what Vista does (which, let's face it, is near-perfect). Same goes for WinForms. The algorithm for an ideal ClearType is a mixture of judicious use of subpixel rendering, antialiasing and using font hinting (where available). I have done this, and have even had fun optimizing it for SIMD and the like. It is a serious investment of your time, though.
  • Pixel fonts. I haven't tried this myself, but it should work.
  • Pre-rendered bitmaps. Oh yeah, if you want to kill the speed, go ahead. Having said that, I think it's acceptable provided you know you're taking advantage of hardware acceleration.

I guess what I'm trying to say is this: there is a solution for WPF/WinForms (yes, WinForms ClearTypeGridFit isn't the best algorithm either), but there isn't a solution for Silverlight. Yet. I wish someone would prove me wrong.

Dmitri Nesteruk
Can you provide links to articles / examples about how to get perfect font rendering with WPF?
tomo
A: 

I'll use up another answer slot, since there's a lot to say here.

I wish I could offer links to such resources :) I mean, there's no such thing out there, and I doubt the people who did do it would be forthcoming with source code of how they pulled it off. This is mainly because the sheer amount of work required is mind-boggling.

Here's how I went about it. First, I found out the ideal (or, almost) ClearType-like algorithm - something that worked specifically for me (unhinted, mind you, but given the performance cost, I couldn't be bothered). Then, I wired it into .NET so I could at least render bitmaps with text (I have a Silverlight test page that shows it in action). Consequently, I fine-tuned the algorithm to a point where it could be used instead of, e.g., a label. My app was full of labels, so I did those. (Text boxes might be a lot more trickier as you can imagine). And that was that.

As you can see from the link, it might be possible to get good ClearType-style text in Silverlight as well. I've only spent 2 days wiring a web service to render text, and it's fairly slow, but I reckon that for things like labels, there's no reason why something like this - especially with caching and other trickery - cannot be done.

Dmitri Nesteruk