Re: Why does my font come out looking fuzzy?
Re: Why does my font come out looking fuzzy?
- Subject: Re: Why does my font come out looking fuzzy?
- From: Ben Haller <email@hidden>
- Date: Sun, 18 Oct 2009 09:40:46 -0400
On Oct 17, 2009, at 7:46 PM, Ben Haller wrote:
Copied the TrueType font from Instruments into my project, added
the necessary key to my Info.plist, set the font using [NSFont
fontWithName:...], and hey presto, there the font is in my app.
Only... it doesn't look as nice. It's less crisp. Kind of fuzzy.
The corners don't look sharp.
OK, this is all replying to various helpful folks who replied to
that:
On 17-Oct-09, at 10:52 PM, Kyle Sluder wrote:
You need to post a screenshot of what you're seeing.
OK:
http://www.sticksoftware.com/textrendering/
The point size in Instruments is probably 18, but I tried 19 just
in case and it doesn't look right either.
I can think of two possibilities off the top of my head:
1) You're rendering text into a CALayer (especially a CATextLayer).
Without some tweaking, CALayer can't do subpixel antialiasing (aka LCD
antialiasing), because it doesn't have the existing backing store to
composite against.
2) You're overdrawing the text and are therefore ruining the
antialiasing, producing a distorted image.
I'm using an NSTextField to do the text drawing. It certainly
renders text antialiased. In any case, the renderings do look
antialiased; the edges are not sharply on pixel boundaries (see the
top of the 5, for example). It just isn't the same appearance as in
Instruments.
On 17-Oct-09, at 11:43 PM, Clark S. Cox III wrote:
There's also the possibility that the text isn't being drawn
properly aligned to the pixel grid.
I tried making the NSTextField have a frame offset by 0.5 pixels,
just in case, but that made no visible difference to the rendering. I
suspect NSTextField corrects for such misalignment. So unless the
font is actually *designed* to be drawn misaligned to the grid, I
think I'm OK in this department.
On 18-Oct-09, at 1:32 AM, Jens Alfke wrote:
Is the point size the same? If this is a special-purpose font, it
might have some hinting for the specific point size used in
Instruments. You might need to compare the character heights up-
close with Pixie or something.
I counted pixels in Pixie, and it looks to me like Instruments is
18-point. It's a bit hard to tell with the antialiasing going on, but
they are somewhere from the 18-point rendering to the 19-point
rendering I posted (see link above).
Now I'm wondering whether Instruments is actually even using this
font. I think it might be a red herring. Note that the time view in
instruments appears to be monospaced, whereas the snapshots of my
rendering using the font show that it is not a monospaced font. And
note that their colons are centered vertically, while mine using the
font are oddly low in their position. The font may be a leftover from
a previous implementation, perhaps.
However, a troll through the images in Instruments does not reveal
any digit images. Although it is an interesting exercise anyway; many
of their button images and such are PDFs, which is intriguing.
Anyhow, I think it's probably time to abandon this quest, unless
someone has a good idea of how to proceed. Spiffy LCD-style display
on my generation counter will just have to wait.
Ben Haller
Stick Software
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden