The font has a table bug. I've fixed iText to work with this kind of broken
fonts. If you want to try, replace in TrueTypeFont.java:
HashMap readFormat4() throws IOException {
HashMap h = new HashMap();
int table_lenght = rf.readUnsignedShort();
rf.skipBytes(2);
int segCount = rf.readUnsignedShort() / 2;
rf.skipBytes(6);
int endCount[] = new int[segCount];
for (int k = 0; k < segCount; ++k) {
endCount[k] = rf.readUnsignedShort();
}
rf.skipBytes(2);
int startCount[] = new int[segCount];
for (int k = 0; k < segCount; ++k) {
startCount[k] = rf.readUnsignedShort();
}
int idDelta[] = new int[segCount];
for (int k = 0; k < segCount; ++k) {
idDelta[k] = rf.readUnsignedShort();
}
int idRO[] = new int[segCount];
for (int k = 0; k < segCount; ++k) {
idRO[k] = rf.readUnsignedShort();
}
int glyphId[] = new int[table_lenght / 2 - 8 - segCount * 4];
for (int k = 0; k < glyphId.length; ++k) {
glyphId[k] = rf.readUnsignedShort();
}
for (int k = 0; k < segCount; ++k) {
int glyph;
for (int j = startCount[k]; j <= endCount[k] && j != 0xFFFF;
++j) {
if (idRO[k] == 0) {
glyph = (j + idDelta[k]) & 0xFFFF;
}
else {
int idx = k + idRO[k] / 2 - segCount + j -
startCount[k];
if (idx >= glyphId.length)
continue;
glyph = (glyphId[idx] + idDelta[k]) & 0xFFFF;
}
int r[] = new int[2];
r[0] = glyph;
r[1] = getGlyphWidth(r[0]);
h.put(new Integer(j), r);
}
}
return h;
}
Best Regards,
Paulo Soares
> -----Original Message-----
> From: SRIDHARAN Aravind [SMTP:[EMAIL PROTECTED]
> Sent: Thursday, July 10, 2003 10:56
> To: Paulo Soares
> Subject: RE: Regarding exception
>
> I am attaching the mingliu font here as a zip file...
> <<mingliu.zip>>
>
> > ----------
> > From: Paulo Soares[SMTP:[EMAIL PROTECTED]
> > Sent: Thursday, July 10, 2003 3:23 PM
> > To: SRIDHARAN Aravind
> > Subject: RE: Regarding exception
> >
> > I did my tests with the mingliu font extracted from mingliu.ttc. Where
> did
> > you download your mingliu.ttf font from?
> >
> > Best Regards,
> > Paulo Soares
> >
> > > -----Original Message-----
> > > From: SRIDHARAN Aravind [SMTP:[EMAIL PROTECTED]
> > > Sent: Thursday, July 10, 2003 10:43
> > > To: [EMAIL PROTECTED]
> > > Subject: Regarding exception
> > >
> > > Paulo,
> > > I ever get this exception whenever I use mingliu.ttf.
> > >
> > > java.lang.ArrayIndexOutOfBoundsException
> > > at com.lowagie.text.pdf.TrueTypeFont.readFormat4(Unknown
> Source)
> > > at com.lowagie.text.pdf.TrueTypeFont.readCMaps(Unknown Source)
> > > at com.lowagie.text.pdf.TrueTypeFont.process(Unknown Source)
> > > at com.lowagie.text.pdf.TrueTypeFontUnicode.<init>(Unknown
> Source)
> > > at com.lowagie.text.pdf.BaseFont.createFont(Unknown Source)
> > > at com.lowagie.text.pdf.BaseFont.createFont(Unknown Source)
> > > at TestServlet.doPost(TestServlet.java:44)
> > >
> > >
> > > The other day you mentioned you didn't get this exception.
> > > For me, it comes at all times.
> > >
> > > Could you let me know when this excpetion is thrown by iText?
> > > Is there something wrong with the Chinese characters such as chinese
> > > characters coming corrupt?
> > >
> > > With the cause of exception, I can analyse my code where I went wrong.
> > > Kindly let me know under what scenarios this exception is thrown.
> > >
> > >
> > >
> > > But with other TTF files such as pmingliu.ttf or TTC like mingliu.ttc,
> it
> > > comes fine.
> > > I even downloaded mingliu.ttf and re-installed it.
> > >
> > << File: mingliu.zip >>
-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions