freetype-devel
[Top][All Lists]
Advanced

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

[ft-devel] [PATCH] Type1 parsing


From: Jens Claudius
Subject: [ft-devel] [PATCH] Type1 parsing
Date: Tue, 28 Feb 2006 11:38:02 -0800 (PST)

Hi everybody,

I've encountered some problems with Freetype's Type 1
parser and prepared a patch to address some of the
problems. The patch is against 2.2.0-RC3 and
unfortunately quite large.


1) Top-level procedures are now skipped by the parser,
   e.g., /foo { /FontName (X) def } def has no effect;
   this is an admittedly contrived example, not so
   contrived is Freetype's crash on Adobe Jenson
   because it pokes around in the font's shareddict.

2) The Type 1 decoder now stores the operands on
   the stack as 16.16 values. This is necessary
because
   a charstring can have sequences like
   9 2 div hlineto. Also OtherSubr no 28 ("rand") can
   push a real number between 0 and 1 onto the stack.

   However, the extra precision is currently thrown
   when building the outline (see
1_builder_add_point()
   in src/psaux/psobjs.c). Furthermore, an FT_Fixed
   might be to small to store all values that can
   be specified in a charstring.

3) Preliminary support for multiple master fonts like
   Adobe Jenson. This has two additional keywords
   (/NDV and /CDV) in its Private dict whose values
   are indices of subroutines. These are *Type 2*
   charstrings which are used as the
   NormalizeDesignVector and ConvertDesignVector
   routines.

   Fonts can also has a /BuildCharArray in their
   Private dict which is an array and used as a
   scratch space to hold temporary during charstring
   execution.

   For complete support it would be necessary to pull
   in the Type 2 machinery into the Type 1 decoder,
   which I haven't managed yet.

4) Added support for OtherSubrs 19 -- 25, 27, and 28,
   used by some multiple master fonts. Also a more
   generic implementation for handling unknown
   OtherSubrs.

5) The pop(s) to a callothersubr can now be part of
   a subroutine
   (e.g., 555 1 3 callothersubr 666 callsubr is OK
   if subr 666 starts with pop); needed for
   Monotype Garamond Swash and others.


Still open:

A) There are still instances where characters are not
   skipped although they are part of a string,
comment,
   or procedure.

B) Multiple Master support is still broken. 

C) If a glyph of Type 1 or Type 2 font uses random
   numbers, its rendered bitmap must not be cached.
   This must also be communicated to the application
   so that it does not cache the bitmap on its own.

D) Finish support for non-integral coordinates in
   Type 1 (and Type 2) charstrings.

Regards,
Jens

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Attachment: t1parse_and_othersubrs.diff
Description: 3854577328-t1parse_and_othersubrs.diff


reply via email to

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