Re: [Nautilus-list] Xft Anti-aliasing, Libart antialiasing?



On Thu, 13 Dec 2001, Moses Lei wrote:

> Alex Larsson wrote:
> > > This is, of course, subjective, but it is obvious to me that 1) the output
> > > is not identical and 2) the output on the right is smoother and more
> > > readable. Look especially at the curve of the capital G.
> >
> > It looks like the gdkxft font is hinted, but the Nautilus one is rendered
> > completely unhinted. You can tell that especially by looking at the i's
> > and the l's. In the Xft rendering these are completely non-aa, since the
> > hinting made them the grid-aligned. The nautilus one is instead blurry on
> > the sides, because the letters are really slightly wider than 1 pixel.
> >
> > I dunno which is best. I'd say the nautilus output looks smother, but the
> > Xft output is more readable. I mean, look at the second 't' in nautilus.
> > It's mostly a blob.
> 
> I think the "mostly a blob" comment is due in part to the jpeg being quite
> lossy and blurry. Take a look at the png.

No no. I was looking at the png. Use xmag and look at the second 't' in 
the Nautilus version. Due to heavy aa the stem of the 't' is almost two 
equally dark pixels, while the horizontal part that is outside the stem is 
very light, making it hard to see.
 
> Hinted and unhinted certainly seems like a plausible reason for the
> difference. What could be the cause of this discrepancy (between hinting
> and no hinting)?

Let me describe what hinting a font means. I'll start from the view of 
non-AA fonts, because that is the origin of font hinting. Scalable fonts 
are specified in a much higher resolution than the screen they are 
rendered in, so if you render for instance an 'm' you can think about 
an infinite precision m being drawn on top of a paper with a grid, and 
then filling in all the grid-rectangles where the center of the rectangle 
is inside the ideal m.

Consider an m where the stems (the veritcal parts) are 1.6 pixels wide, 
and the distance between the stems is 2.1 pixels. This means that the 
first stem is from 0 to 1.6, the second one from 3.7 to 5.3, and the third 
one from 7.4 to 9. Draw this on a paper with grids and you'll see that the 
first stem will be two pixels (0 and 1) the second one one pixel (4) and 
the third one two pixels (8 and 9). This sort of thing makes the font look 
really ugly, because the middle stem looks really thin. In order to fix 
this you encode hints in the fonts. The hints my say for instance that the 
three stems in the m should be the same width, so when rendering the m you 
tweak the original font layout a bit so that it will render with the stems 
the same width.

Another hint that is very easy to see in the image is that it tries to 
keep vertical lines the right width by moving them so that they fit better 
to the grid. Take the 'l's for instance. Say they are 1.1 pixel wide, but 
happen to be on a position in the middle of the a pixel. This means they 
will span half of two pixels, and fill both of them. But by moving it 
slightly you can make it only fill one pixel. Take a look at the l's or 
the i's in the nautilus picture. See how they cover a small percentage of 
the neighbouring pixels, and not only the center one, while the Xft ones 
are precisely one pixel.

> Going back to David's earlier comment that the Nautilus rendering looked
> like a paper rendition, I am interested to know if the hints are dependent
> on the resolution of the medium, i.e. Would a 12pt Arial on paper be
> hinted the same way as a 12pt on screen?

Hints are really only needed when rendering at a low resolution (i.e. on 
a screen). When the resolution is high the grid size of the target doesn't 
affect the rendering much, since it's hard to see if one of the stems is 
one pixel wider. Normally you don't hint printed fonts at all.
 
> Now, the biggest question for me is: which causes more eye-strain? IMO
> this should be the deciding factor in choosing which is the "right" way.

Many people believe the blurred out look of AA fonts is harder on the eye, 
because it fools the brain to think the fonts are out of focus, and the 
eye keeps trying to focus in on them.
 
> So when the letters are hinted, they are hinted in a way that 1) optimizes
> them for readability as aliased, monochrome text and 2) optimizes them for
> that specific screen resolution. But when the antialiasing is done on top
> of these hinted letters, the net effect that one would want to generate is
> to focus the eye as if the screen was at a *higher* resolution. Thus, the
> eye is trying to see the letter in two resolutions at once, generating eye
> strain.

Ummm. I don't quite follow this. But it is true that hinting is normally 
done targeting aliased rendering. And it is still a matter of debate 
whether you should hint antialiased fonts, and if so, how you should do 
it.
 
My take is that we should probably let this be configurable somewhere and 
experiment with it.

/ Alex






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]