freetype-devel
[Top][All Lists]
Advanced

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

[ft-devel] rounding bug in MS TT rasterizer


From: Werner LEMBERG
Subject: [ft-devel] rounding bug in MS TT rasterizer
Date: Fri, 31 Mar 2006 10:25:25 +0200 (CEST)

Sergej, Paul,


from time to time we from the FreeType team get reports that our
engine doesn't rasterize certain TrueType glyphs correctly.  The most
noticeable and disturbing case is glyph `W' in the font `arialuni.ttf'
(see attached image).  Careful inspection has shown that the very
problem here (and in other cases) is a rounding bug in the MS
rasterizer which the bytecode instructions of arialuni.ttf explicitly
circumvent.

Rogier van Dalen writes:

  I see the very same asymmetry on my rasterizer.  Point 25 is the
  problematic point.  I've calculated it all; Microsoft rounds the
  x-coordinate 895.455782 up to 896 (14.0) in an interpolate
  instruction.  It is then rounded to half a pixel, to 14.5 according
  to the MS interpreter, to 13.5 according to FreeType's and mine.  A
  delta instruction then moves it left to 13.5 (12.5).  To conclude,
  the MS rasterizer does faulty rounding here, and a delta instruction
  could have been spared if they had implemented it properly.

I'm quite sure that this rounding bug has historical roots and won't
be fixed -- many, many fonts would render worse.  This means that we
have to emulate the behaviour of the MS rasterizer to get `correct'
results.

Can you tell us more about this problem?  Which instructions are
affected?  What exactly is the reason for the incorrect rounding?

Since so many fonts rely on this `feature' it should be documented --
ideally in the TrueType specification.


    Werner


PS: I wonder whether Apple's rasterizer renders this glyph similar to
    MS Windows...

PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]