freetype-devel
[Top][All Lists]
Advanced

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

Re: [Devel] Suspected error in cff_parse_font_matrix


From: Tom Kacvinsky
Subject: Re: [Devel] Suspected error in cff_parse_font_matrix
Date: Thu, 3 May 2001 14:04:06 -0400 (EDT)

What is interesting about this, Sander, is that the code you are commenting out
to "fix" things is code I added to fix the exact smae problem that another
fellow (Eric Blinn) was having. ;)

I think the real problem is here:

       *upm = (FT_UShort)( FT_DivFix( 0x10000L,
                           FT_DivFix( temp, 1000 ) ) >> 16 );

and in cffload.c where units_per_EM is assigned the value of dict->units_per_em,
(if it is not zero) and 1000 otherwise.

I would need to see the font that is causing the problem.  But from what you
have written, the units per em of the font is supposed to be 2048, and if the
font is showing up at half size, that is indicative of the units per em being
set to 1000 or so.  Which is why I think the problem is with the units per em
code, not the font matrix code.

Tom

On Wed, 2 May 2001, Sander van der Wal wrote:

> I have been looking to a problem that a certain pdf file had it's
> characters being about twice as big as the should be, according to the
> sizes inside the pdf file. After some debugging, it appears that this
> increase in saze was due to this code in cffparse.c (release 2.0.2)
>
>  static
>   FT_Error  cff_parse_font_matrix( CFF_Parser*  parser )
>   {
>     CFF_Font_Dict*  dict   = (CFF_Font_Dict*)parser->object;
>     FT_Matrix*      matrix = &dict->font_matrix;
>     FT_Vector*      offset = &dict->font_offset;
>     FT_UShort*      upm    = &dict->units_per_em;
>     FT_Byte**       data   = parser->stack;
>     FT_Error        error;
>     FT_Fixed        temp;
>
>     error = CFF_Err_Stack_Underflow;
>
>     if ( parser->top >= parser->stack + 6 )
>     {
>       matrix->xx = cff_parse_fixed_thousand( data++ );
>       matrix->yx = cff_parse_fixed_thousand( data++ );
>       matrix->xy = cff_parse_fixed_thousand( data++ );
>       matrix->yy = cff_parse_fixed_thousand( data++ );
>       offset->x  = cff_parse_fixed_thousand( data++ );
>       offset->y  = cff_parse_fixed_thousand( data   );
>
>       temp = ABS( matrix->yy );
>
>       *upm = (FT_UShort)( FT_DivFix( 0x10000L,
>                           FT_DivFix( temp, 1000 ) ) >> 16 );
>
>       if ( temp != 0x10000L )
>       {
> >>>>> /* if I comment this code out, it appears to work
>         matrix->xx = FT_DivFix( matrix->xx, temp );
>         matrix->yx = FT_DivFix( matrix->yx, temp );
>         matrix->xy = FT_DivFix( matrix->xy, temp );
>         matrix->yy = FT_DivFix( matrix->yy, temp );
>         offset->x  = FT_DivFix( offset->x,  temp );
>         offset->y  = FT_DivFix( offset->y,  temp );
> >>>> */
>       }
>
> When I look at the numbers, the FontMatrix consists of the numbers
> 0.00049 0 0 0.00049 (encoded as a0 00 49 ff  etc
>
> If the commented out code isn't commented out, the matrix becomes
> 0.001 0 0 0.001.
>
> These numbers are consistent with the idea that the letters are twice
> as large on screen as they should be.
>




reply via email to

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