freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] Type 1C font that is not rendered correctly


From: Werner LEMBERG
Subject: Re: [ft-devel] Type 1C font that is not rendered correctly
Date: Sun, 27 Jul 2008 16:02:14 +0200 (CEST)

> > This font is buggy.  I assume that you've taken it out of a PDF
> > file, and Acroread is displaying it fine, right?
> 
> Right,

Sigh.  I really wonder whether I shall break the specification just to
support this particular font...

Can you send me the PDF (or a link to it) with this font?

> can you point which the problem is?  Just to make sure that we are
> not extracting it badly from the PDF file.

For example, the glyph of digit `4' looks like this after
desassembling

 glyph index 12:
  1000 387 hmoveto
  163 vlineto
  69 hlineto
  47 vlineto
  -69 hlineto
  449 vlineto
  -35 hlineto
  -311 -441 rlineto
  -55 vlineto
  298 hlineto
  -163 vlineto
  -207 567 vmoveto                <---
  -357 vlineto
  -251 hlineto
  endchar

(You can get this with saying `FT2_DEBUG=any:7 ftview -f 12 20 font0',
using the current CVS.)

The marked line is the bug: According to the specification, `vmoveto'
takes only single parameter, not two.  To cite 5177.Type2.pdf:

  A number, decoded from a charstring, is pushed onto the Type 2
  argument stack.  An operator expects its arguments in order from
  this argument stack with all arguments generally taken from the
  bottom of the stack (first argument bottom-most); [...]

The specification further says:

  [...], in general, arguments are not accumulated on the Type 2
  argument stack for later removal by a sequence of operators,
  arguments generally may be supplied only for the next operator.
  Notable exceptions occur with subroutine calls and with arithmetic
  and conditional operators.  [...]

  [...]

  Many operators take their arguments from the bottom-most entries in
  the Type 2 argument stack; this behavior is indicated by the stack
  bottom symbol ‘|-’ appearing to the left of the first argument.
  Operators that clear the argument stack are indicated by the stack
  bottom symbol ‘|-’ in the result position of the operator
  definition.

Finally, the `vmoveto' operator is defined like this:

  vmoveto:

    |- dy1 vmoveto   ===>   |-

And this is exactly what FreeType does: It takes the bottom-most
argument (-207) and clears the stack afterwards.


    Werner

reply via email to

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