Creating a BaseFont for file cambria.ttc (which ships with Vista) generates a
DocumentException. The specific code is:

BaseFont bf = BaseFont.createFont( fontFilename, "winansi",
BaseFont.NOT_EMBEDDED);

where fontFilename is the full path and filename for cambria.ttc Note that
this code works without a problem for all .ttf and .otf files.

Based on the source code in BaseFont.java, the only relevant test that I can
see that this fails (and thereby leads to the DocumentException) is the test
for ".ttc,".

TIA,

---mr. bean


Xavier Le Vourch wrote:
> 
> mister bean wrote:
>> Creating BaseFonts from .ttc files give spurious DocumentException
>> errors.
>> This appears to be caused by this error at the end of line 567 of
>> com.lowagie.text.pdf.BaseFont.java:
>> 
>> [...] || nameBase.toLowerCase().indexOf(".ttc,")
>> 
>> The literal for the ending of the file name should be ".ttc" not ".ttc," 
>> 
>> That is, there should be no comma.
>> 
>> Unless I'm crazy (always a possibility!) can this be fixed?
> 
> Based on the javadoc for the method, font names can be of the form
> "msgothic.ttc,1" so it seems that the indexOf() should do the job fine
> at least for the part detecting the type of font used.
> 
> Could you provide more info on how you're using the method and what's
> causing the exception? The full stack trace and a small self contained
> example would also be helpful.
> 
> 
> Thanks,
> 
> Xavier
> 
> -- 
> Xavier Le Vourch
> Brittany Software, Inc.
> <xav...@brittanysoftware.com>
> 
> PGP Key (ID 0x896C5947): http://brittanysoftware.com/gpg_key.asc
> Key fingerprint: 73B3 6370 B8C5 4325 F2D8  4115 0372 5805 896C 5947
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 
> Buy the iText book: http://www.1t3xt.com/docs/book.php
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Found-bug-in-BaseFont%27s-handling-of-.ttc-fonts-tp21188543p21190271.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to