[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help,please !!!!!!!
From: |
David Turner |
Subject: |
Re: Help,please !!!!!!! |
Date: |
Thu, 29 Jun 2000 10:46:46 +0200 |
Hi Lidia,
I've taken a deep look at tahoma.ttf and the ttf2pt1 source
code..
When creating the encoding for the Type 1 font, ttf2pt1 remaps
some of the glyphs. Basically this means that:
- tahoma.ttf contains a valid Unicode charmap, and doesn't
define glyph images for codes 127 to 159 (this is in
accordance to the specification)
- when ttf2pt1 converts this font to Type 1, it remaps some
characters because of some stupid restrictions in the Type 1
format (i.e. no more than 256 character codes in an encoding)
Basically, it tries to look for common unicodes above 256,
see if they have a glyph, and if so, tries to place them
in the "vacant" entries of the original charmap..
For example, character code 136 in the Type 1 font ("circumflex")
does not correspond to any valid Unicode value. Its glyph is
however the same than the one for character code 0x2c6 in the
original Tahoma font..
I guess FreeHand does something similar..
The .afm file correspond to the Type 1 font, and not to the
charmap located in Tahoma.ttf. You cannot use it with a TrueType
font because of this stupid remapping thing..
The problem comes from the fact that charcodes are nearly just
useless with Type 1 fonts, you really need to look at the list
of glyph names and build a real Unicode charmap from these,
over-riding the definition of the "encoding" dictionary.
Hopefully, this is precisely what FreeType 2 does with Type 1
fonts :-)
Hope its clear..
Cheers,
- David
Lidia Mirkin a écrit :
>
> Hello !
> Thank you very much about your reply.
> Scenario is following:
> 1.I read Tahoma.ttf using FreeType.Particulary , I read char widths from
> this font,
> using code below.TT_Get_CharMap_ID returns 0 for characters in range
> 125-160.
> and therefore , I get width = 0 for these characters.
> 2.After that , I embed this font to PDF.
> 3.In FreeHand i make some example pdf with embedding the tahoma font, open
> PDF in some text editor and check character widths: for characters
> 125,126,127 they are 1000( default width) and for characters 127-160 they
> are not equal to 1000.
> 4.I used ttf2pt1 ( ttf2pfa ) tool in order to convert Tahoma.ttf to afm,pfa.
> Character widths inside .afm are same to those we get in FreeHand.
> 5.I don't read font from PDF.
> 6.I send you compiled ttf2pt1 and also project for MS-5.0.
> you can run this program by
>
> ttf2pt1.exe <path to ttf file> <path to output files/name of output files>
> <example>
> tt2pt1.exe Tahoma.ttf Tahoma
>
> 7.Also , I am sending you generated .afm file.
>
> It is clear , that I can use this program for my purposes , but I would like
> to know how
> can I do it by FreeType ( because , this library is very convenient for
> usage ).
> thak you very much , Lidia.
>
> > 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 :-)
> >
>
> Code:
> > 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);
> > > }
> > >
> > >
>
>
> ------------------------------------------------------------------------------------------------------------------------------------------------------
> Name: font_stuff.zip
> font_stuff.zip Type: Zip Compressed Data (application/x-zip-compressed)
> Encoding: base64
- Help,please !!!!!!!, Lidia Mirkin, 2000/06/28
- Re: Help,please !!!!!!!, David Turner, 2000/06/28
- Message not available
- Re: Help,please !!!!!!!,
David Turner <=
- Message not available
- Re: Help,please !!!!!!!, David Turner, 2000/06/29
- Re: Help,please !!!!!!!, Tom Kacvinsky, 2000/06/29
- Re: Help,please !!!!!!!, Just van Rossum, 2000/06/29
- Re: Help,please !!!!!!!, Tom Kacvinsky, 2000/06/29