freetype-devel
[Top][All Lists]
Advanced

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

[ft-devel] fundamental problem with composite TT glyphs & B/W rasterizer


From: Werner LEMBERG
Subject: [ft-devel] fundamental problem with composite TT glyphs & B/W rasterizer
Date: Wed, 17 Jun 2009 10:02:59 +0200 (CEST)

I've recently discovered a fundamental problem with the B/W
rasterization of composite TrueType glyphs.  Consider the attached
images.  The first one shows glyph `R' at 15ppem from font pala.ttf.
The second one shows glyph `Rcaron', which is a composite of letter
`R' and the `caron' glyph.  As can easily be seen, the two `R' shapes
render differently at the lower right!

Reason for this behaviour is that the bytecode for glyph `R' calls
SCANMODE to control the handling of drop-outs.  Normally, this
instruction (if present) is located in the `prep' table only and thus
valid for all glyphs.  For `Rcaron', however, the `caron' and `R'
glyphs use different rendering modes since the rendering state gets
reset for each subglyph.

FreeType collects the hinted outlines from all subglyphs, then it
sends the data to the rasterizer.  It also sends the drop-out mode --
after hinting has been applied -- and here is the error: It sends the
drop-out mode of the last subglyph only; drop-out modes of all other
subglyphs are lost.

There are two solutions:

  1. Rasterize the subglyphs separately and compose the final glyph
     afterwards.

  2. Add the drop-out mode to each contour and change the rasterizer
     accordingly.

I prefer the latter; it's rather straightforward to reserve three bits
in the outline's `tags' field; for example, the first point of each
contour could hold the drop-out mode.

The question is what to do with these three outline flags (defined in
ftimage.h):

  FT_OUTLINE_IGNORE_DROPOUTS
  FT_OUTLINE_SMART_DROPOUTS
  FT_OUTLINE_INCLUDE_STUBS

It's obvious now that they are not sufficient for handling composite
TrueType glyphs.  I'm going to make them informative only, this is,
the rasterizer ignores them completely if it finds the corresponding
bits in the `tags' field.

Comments?


    Werner

PNG image

PNG image


reply via email to

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