On 28 Jan, Werner LEMBERG wrote:
>> > I suspect a problem with CID handling.
>>
>> The TrueType fonts in question have broken table directories. [...]
>
> Hmm. Would it be helpful to make xpdf as generous as Acroread is?
> The latter can display those fonts...
You're probably right. I hate writing code to work around broken fonts,
but it certainly wouldn't be the first time.
Anyway, it turned out to be pretty simple - I'm attaching a patch file.
- Derek
Index: FoFiTrueType.cc
===================================================================
RCS file: /home/derekn/src/cvs/fofi/FoFiTrueType.cc,v
retrieving revision 1.32
diff -c -r1.32 FoFiTrueType.cc
*** FoFiTrueType.cc 26 Apr 2007 21:33:53 -0000 1.32
--- FoFiTrueType.cc 28 Jan 2008 19:59:45 -0000
***************
*** 1857,1873 ****
}
tables = (TrueTypeTable *)gmallocn(nTables, sizeof(TrueTypeTable));
pos += 12;
for (i = 0; i < nTables; ++i) {
! tables[i].tag = getU32BE(pos, &parsedOk);
! tables[i].checksum = getU32BE(pos + 4, &parsedOk);
! tables[i].offset = (int)getU32BE(pos + 8, &parsedOk);
! tables[i].len = (int)getU32BE(pos + 12, &parsedOk);
! if (tables[i].offset + tables[i].len < tables[i].offset ||
! tables[i].offset + tables[i].len > len) {
! parsedOk = gFalse;
}
pos += 16;
}
if (!parsedOk) {
return;
}
--- 1857,1876 ----
}
tables = (TrueTypeTable *)gmallocn(nTables, sizeof(TrueTypeTable));
pos += 12;
+ j = 0;
for (i = 0; i < nTables; ++i) {
! tables[j].tag = getU32BE(pos, &parsedOk);
! tables[j].checksum = getU32BE(pos + 4, &parsedOk);
! tables[j].offset = (int)getU32BE(pos + 8, &parsedOk);
! tables[j].len = (int)getU32BE(pos + 12, &parsedOk);
! if (tables[j].offset + tables[j].len >= tables[j].offset &&
! tables[j].offset + tables[j].len <= len) {
! // ignore any bogus entries in the table directory
! ++j;
}
pos += 16;
}
+ nTables = j;
if (!parsedOk) {
return;
}
_______________________________________________
Freetype mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/freetype