From 6d896bacd03c5be09685a5ae5fca94b3347165d2 Mon Sep 17 00:00:00 2001 From: Chris Liddell Date: Wed, 31 Aug 2022 10:00:06 +0100 Subject: Bug 705831: pdfwrite drop not required TTF tables. Unlike the Postscript code, pdfi does not have a create a Type 42 font from a TTF stream, it can just use the TTF stream unchanged. This means pdfi does not "filter out" TTF tables not required for Type 42, and pdfwrite would then write out (almost) all the tables presented to it, meaning the output file size could increase significantly. This just has pdfwrite filter out TTF tables not used in TTFs embedded in PDF files. --- devices/vector/gdevpsft.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/devices/vector/gdevpsft.c b/devices/vector/gdevpsft.c index ae6600be3..4d6384f25 100644 --- a/devices/vector/gdevpsft.c +++ b/devices/vector/gdevpsft.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. +/* Copyright (C) 2001-2022 Artifex Software, Inc. All Rights Reserved. This software is provided AS-IS with no warranty, either express or @@ -845,7 +845,6 @@ psf_write_truetype_data(stream *s, gs_font_type42 *pfont, int options, length = u32(tab + 12); /* Copy the table data now (a rudiment of old code). */ memcpy(&tables[numTables * 16], tab, 16); - switch (u32(tab)) { case W('h','e','a','d'): if (length < 54) @@ -900,13 +899,16 @@ psf_write_truetype_data(stream *s, gs_font_type42 *pfont, int options, /* falls through */ case W('c','v','t',' '): case W('f','p','g','m'): - case W('g','a','s','p'): - case W('k','e','r','n'): case W('p','r','e','p'): break; /* always copy these if present */ + case W('D','S','I','G'): case W('E','B','D','T'): case W('E','B','L','C'): case W('E','B','S','C'): + case W('G','D','E','F'): + case W('G','P','O','S'): + case W('g','a','s','p'): + case W('k','e','r','n'): continue; default: if (writing_cid) -- cgit v1.2.1