king514jy / purepdf

Automatically exported from code.google.com/p/purepdf
0 stars 0 forks source link

Unicode Japanese .ttc files fail to embed. #32

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Try to embed a Unicode TTF File, such as MS Mincho or Meiryo.
2. Sample embed code:
FontsResourceFactory.getInstance().registerFont(FONTNAME, ByteArrayAsset(new 
FONTCLASS()));
var font = BaseFont.createFont(FONTNAME.ttc, $codePage, BaseFont.EMBEDDED);
3. NB the font file extension is .ttc and not .ttf

What is the expected output? What do you see instead?
Expect font to be registered and then BaseFont created.. Instead get error:

[Fault] exception, information=Error: My_Meiryo__Regular.ttc is not a valid ttf 
or otf file

Error seems to stem from TrueTypeFont.as, Line 530:

var ttId: int = rf.readInt();
if ( ttId != 0x00010000 && ttId != 0x4F54544F )
throw new DocumentError( fileName + " is not a valid ttf or otf file" );

Original issue reported on code.google.com by jcfxj...@gmail.com on 2 Feb 2012 at 4:04