freetype
[Top][All Lists]
Advanced

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

Re: Help,please !!!!!!!


From: David Turner
Subject: Re: Help,please !!!!!!!
Date: Wed, 28 Jun 2000 19:09:08 +0200

Hi Lidia,

Sorry for taking so long to answer, but I thought someone else would
do it on the list..

Lidia Mirkin a écrit :
> 
>      Hello !
>  I use freetype library in order to extract some information from ttf files
>  and use it to embedd ttf file into pdf.
>  In particular,I need to know char widths.My code is following:
> 
> > for (i=0;i<n;i++)
> >  {
> >   if (error=TT_Get_CharMap_ID( face, i, &platform, &encoding ))
> >    goto done_face;
> >   if ( (platform == 3 && encoding == 1 ) )
> >   {
> >    TT_Get_CharMap( face, i, &charMap );
> >    break;
> >   }
> > ....
> >  }
> >  for (i=0;i<=255;i++)
> >  {
> >   unsigned short char_index=TT_Char_Index( charMap, i );
> >   TT_Get_Face_Metrics( face,
> >                        char_index,
> >                        char_index,
> >                        NULL,
> >                        temp,
> >                        NULL,
> >                        NULL );
> >
> >   font->widths[i]=(int)(temp[0]*scale_factor+0.5);
> >  }
> >
> For some fonts (for example , for Tahoma ) TT_Char_Index returns 0 ( unknown
>  glyph)  for i>125 to 160 and as result , TT_Get_Face_Metrics returns 1000
>  default
> > width ).
> But I did embedding of  this font into pfd using FreeHand .
> Result is that for 160,161,162 widths are 1000 , but there are some other
> values for next entries.
> Does somebody know how can I extract these char widths ?
> 

It's important to distinguish which fonts you're talking about..

  - taking a "stock" font like tahoma.ttf, some **character codes** in the
    125 to 160 range correspond to glyph index 0 (this is normal
    for Latin-1 based encodings like Unicode).

  - you compute the size of such characters as the one of glyph 0,
    which is here 1000

  - when embedding the font with FreeHand, then reading it from the
    PDF (right ???), the same character codes will produce different
    widths !!

My question is this:

- Do these character codes map to glyph index 0 or not ?
  If not, FreeHand has modified the charmap within the font, and
  you're not reading the original font..

- Do the embedded font still have a (3,1) charmap, or something
  different ??

> ttf2pt1(ttf2pfa) get valid values....
>

Does it get the "valid values" from the original font, or the
embedded one. It's really hard to see what you're speaking about,
we need a bit of clarification :-)

Cheers,

- David

>      thanks ,Lidia.



reply via email to

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