freetype-devel
[Top][All Lists]
Advanced

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

RE: [Devel] losing less when calculating root->units_per_EM


From: Erik Strik
Subject: RE: [Devel] losing less when calculating root->units_per_EM
Date: Wed, 29 Aug 2001 17:58:32 +0200

Dear Tom,

I send this mail on behalf of Martin Muskens.

The fonts are indeed originally TrueType fonts that are set to a non-1000-EM
(indeed 2048 which is the TT standard). This happens with embedded fonts in
PDF files.

Kind regards,

Erik Strik
Aurelon

-----Original Message-----
From: Tom Kacvinsky [mailto:address@hidden
Sent: dinsdag 28 augustus 2001 16:05
To: address@hidden
Subject: Re: [Devel] losing less when calculating root->units_per_EM


How is it not precise enough?  Is it becuase of the multiple dvisions?  Did
you try this with TT fonts that were autoconverted to Type 1 fonts, so that
the units per EM is something like 2048?  Do you get the correct value for
that?  Etc, etc...

On Tue, 28 Aug 2001, Martin Muskens wrote:

> Hi all,
>
> in the file t1load.c the calculation of root->units_per_EM is not precise
> enough.
> I think this is a better solution:
>
> bye
> Martin Muskens
> Aurelon
>
>
> #ifdef AURELON
> #define       Int2Fixed( x )  ( (FT_Fixed)( x ) << 16 )
> #endif
>
>   static void
>   parse_font_matrix( T1_Face     face,
>                      T1_Loader*  loader )
>   {
>     T1_ParserRec*  parser = &loader->parser;
>     FT_Matrix*     matrix = &face->type1.font_matrix;
>     FT_Vector*     offset = &face->type1.font_offset;
>     FT_Face        root   = (FT_Face)&face->root;
>     FT_Fixed       temp[6];
>     FT_Fixed       temp_scale;
>
>
>     if ( matrix->xx || matrix->yx )
>       /*  with synthetic fonts, it's possible we get here twice  */
>       return;
>
>     (void)T1_ToFixedArray( parser, 6, temp, 3 );
>
>     temp_scale = ABS( temp[3] );
>
>     /* Set Units per EM based on FontMatrix values. We set the value to */
>     /* 1000 / temp_scale, because temp_scale was already multiplied by  */
>     /* 1000 (in t1_tofixed, from psobjs.c).                             */
>
> #ifdef AURELON
>       root->units_per_EM = (FT_UShort)( FT_DivFix( Int2Fixed( 1000 ),
> temp_scale ) >> 16 );
> #else
>     root->units_per_EM = (FT_UShort)FT_DivFix( 0x10000L,
>                                                FT_DivFix( temp_scale, 1000
)
> );
> #endif
>
>     /* we need to scale the values by 1.0/temp_scale */
>     if ( temp_scale != 0x10000L )
>     {
>       temp[0] = FT_DivFix( temp[0], temp_scale );
>       temp[1] = FT_DivFix( temp[1], temp_scale );
>       temp[2] = FT_DivFix( temp[2], temp_scale );
>       temp[4] = FT_DivFix( temp[4], temp_scale );
>       temp[5] = FT_DivFix( temp[5], temp_scale );
>       temp[3] = 0x10000L;
>     }
>
>     matrix->xx = temp[0];
>     matrix->yx = temp[1];
>     matrix->xy = temp[2];
>     matrix->yy = temp[3];
>
>     /* note that the offsets must be expressed in integer font units */
>     offset->x  = temp[4] >> 16;
>     offset->y  = temp[5] >> 16;
>   }
>
> _______________________________________________
> Devel mailing list
> address@hidden
> http://www.freetype.org/mailman/listinfo/devel
>


_______________________________________________
Devel mailing list
address@hidden
http://www.freetype.org/mailman/listinfo/devel



reply via email to

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