[gs-commits] rev 11425 - trunk/gs/base
ken at ghostscript.com
ken at ghostscript.com
Wed Jun 23 15:56:40 UTC 2010
Author: ken
Date: 2010-06-23 15:56:39 +0000 (Wed, 23 Jun 2010)
New Revision: 11425
Modified:
trunk/gs/base/gdevpsft.c
Log:
This patch adds limited support for TrueType collection fonts to pdfwrite and ps2write.
In the PostScript world TTC fonts are never passed down to pdfwrite, we only ever see
TrueType fonts. XPS, however, can pass back TrueType collection SNFTS data. This patch
uses the first font from the TrueType collection and writes that to the output file.
This may be too limited and may require further work in future.
Expected Differences
fts_5400.xps and fts_5401.xps should now produce working PDF files with the pdfwrite
device, and the patterns should even render correctly. There may be other differences.
Modified: trunk/gs/base/gdevpsft.c
===================================================================
--- trunk/gs/base/gdevpsft.c 2010-06-23 14:33:08 UTC (rev 11424)
+++ trunk/gs/base/gdevpsft.c 2010-06-23 15:56:39 UTC (rev 11425)
@@ -793,6 +793,7 @@
int start_position = stell(s);
int enlarged_numGlyphs = 0;
int code;
+ int TTCFontOffset = 0;
memset(&subtable_positions, 0, sizeof(subtable_positions));
have_hvhea[0] = have_hvhea[1] = 0;
@@ -808,7 +809,18 @@
* table directory.
*/
+#define W(a,b,c,d)\
+ ( ((a) << 24) + ((b) << 16) + ((c) << 8) + (d))
+
READ_SFNTS(pfont, 0, 12, OffsetTable);
+ if (u32(OffsetTable) == W('t','t','c','f')) {
+ int version = u32(&OffsetTable[4]);
+ int num_fonts = u32(&OffsetTable[8]);
+
+ READ_SFNTS(pfont, 12, 4, OffsetTable);
+ TTCFontOffset = u32(OffsetTable);
+ READ_SFNTS(pfont, TTCFontOffset, 12, OffsetTable);
+ }
numTables_stored = U16(OffsetTable + 4);
for (i = numTables = 0; i < numTables_stored; ++i) {
byte tab[16];
@@ -818,15 +830,12 @@
if (numTables == MAX_NUM_TT_TABLES)
return_error(gs_error_limitcheck);
- READ_SFNTS(pfont, 12 + i * 16, 16, tab);
+ READ_SFNTS(pfont, TTCFontOffset + 12 + i * 16, 16, tab);
start = u32(tab + 8);
length = u32(tab + 12);
/* Copy the table data now (a rudiment of old code). */
memcpy(&tables[numTables * 16], tab, 16);
-#define W(a,b,c,d)\
- ( ((a) << 24) + ((b) << 16) + ((c) << 8) + (d))
-
switch (u32(tab)) {
case W('h','e','a','d'):
if (length < 54)
More information about the gs-commits
mailing list