Font Smoothing In A Bitmap
Font Smoothing In A Bitmap
- Subject: Font Smoothing In A Bitmap
- From: Perry Clarke <email@hidden>
- Date: Tue, 13 Apr 2004 17:35:49 -0700
My application renders text to an internal bitmap so it can be
displayed repeatedly without all the calculations involving font
metrics, etc having to be redone.
It all works like a charm and sped things up nicely (particularly
sideways scrolling of marquee style text). Then someone points out
that if you set the "Font smoothing style" in the Appearance System
Preferences panel to something other than "Standard" the new text is
not rendered correctly.
They are right, it isn't. The same -[NSAttributedString drawAtPoint:]
call gives different results depending on whether the target context is
the screen or an image buffer. At some fairly low level, the framework
(or the OS) is asking itself "are we drawing to the screen" and doing
something different in that case.
Alright, I think, all I need to do is set something appropriate in the
graphics context (the same thing that some level of the framework is
presumably setting when drawing to the screen) and everything will be
pixel perfect. After a search, all I can find that is apropos is:
CGContextSetShouldSmoothFonts()
Unfortunately, this only takes a boolean (not the 4 levels the user can
specify in the Appearance panel) and while setting it has *some* effect
on the text that is rendered, it's only a pale approximation of what is
seen on the screen (I'll accept an argument that all that is needed is
a boolean because the end-user gets to choose the *amount* of smoothing
but the call doesn't duplicate what's on the screen either way).
So, has anyone else run up against this? What was your solution?
Perry
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.