#[1]Index [2]Previous [3]Next [gs-cvs] rev 6919 - trunk/gs/src leonardo at ghostscript.com [4]leonardo at ghostscript.com Mon Jul 17 12:11:34 PDT 2006 * Previous message: [5][gs-cvs] rev 6918 - trunk/gs/src * Next message: [6][gs-cvs] rev 6920 - trunk/gs/lib * Messages sorted by: [7][ date ] [8][ thread ] [9][ subject ] [10][ author ] __________________________________________________________________ Author: leonardo Date: 2006-07-17 12:11:34 -0700 (Mon, 17 Jul 2006) New Revision: 6919 Modified: trunk/gs/src/gdevpsft.c trunk/gs/src/gxttf.h Log: Fix (pdfwrite) : Support OS/2 table version 2 in True Type fonts. DETASILS : We don't use the new fields in the 96-byte structure and continue to create 86-byre structures. The extra space is used as a buffer when we copy the structure intact. Bug 688536 "/invalidfont in --show-- when trying to convert the PDF file". Patch from Alex with an improvement against regressions. DIFFERENCES : None. Modified: trunk/gs/src/gdevpsft.c =================================================================== --- trunk/gs/src/gdevpsft.c 2006-07-13 21:35:15 UTC (rev 6918) +++ trunk/gs/src/gdevpsft.c 2006-07-17 19:11:34 UTC (rev 6919) @@ -479,7 +479,8 @@ /* ------ OS/2 ------ */ /* Write a generated OS/2 table. */ -#define OS_2_LENGTH sizeof(ttf_OS_2_t) +#define OS_2_LENGTH1 offset_of(ttf_OS_2_t, sxHeight[0]) /* OS/2 version 1. */ +#define OS_2_LENGTH2 sizeof(ttf_OS_2_t) /* OS/2 version 2. */ private void update_OS_2(ttf_OS_2_t *pos2, uint first_glyph, int num_glyphs) { @@ -504,15 +505,16 @@ * We don't bother to set most of the fields. The really important * ones, which affect character mapping, are usFirst/LastCharIndex. * We also need to set usWeightClass and usWidthClass to avoid - * crashing ttfdump. + * crashing ttfdump. Version 1 86-byte structure has all the fields + * we need. */ memset(&os2, 0, sizeof(os2)); put_u16(os2.version, 1); put_u16(os2.usWeightClass, 400); /* Normal */ put_u16(os2.usWidthClass, 5); /* Normal */ update_OS_2(&os2, first_glyph, num_glyphs); - stream_write(s, &os2, sizeof(os2)); - put_pad(s, sizeof(os2)); + stream_write(s, &os2, offset_of(ttf_OS_2_t, sxHeight[0])); + put_pad(s, offset_of(ttf_OS_2_t, sxHeight[0])); } /* ------ post ------ */ @@ -688,7 +690,7 @@ int have_hvhea[2]; uint cmap_length = 0; ulong OS_2_start = 0; - uint OS_2_length = OS_2_LENGTH; + uint OS_2_length = OS_2_LENGTH1; int code; have_hvhea[0] = have_hvhea[1] = 0; @@ -755,7 +757,7 @@ if (writing_cid) continue; have_OS_2 = true; - if (length > OS_2_LENGTH) + if (length > OS_2_LENGTH2) return_error(gs_error_invalidfont); OS_2_start = start; OS_2_length = length; Modified: trunk/gs/src/gxttf.h =================================================================== --- trunk/gs/src/gxttf.h 2006-07-13 21:35:15 UTC (rev 6918) +++ trunk/gs/src/gxttf.h 2006-07-17 19:11:34 UTC (rev 6919) @@ -134,7 +134,13 @@ sTypoLineGap[2], usWinAscent[2], usWinDescent[2], - ulCodePageRanges[8]; + ulCodePageRanges[8], + + sxHeight[2], /* version 2 */ + sCapHeight[2], + usDefaultChar[2], + usBreakChar[2], + usMaxContext[2]; } ttf_OS_2_t; /* ------ vhea ------ */ __________________________________________________________________ * Previous message: [11][gs-cvs] rev 6918 - trunk/gs/src * Next message: [12][gs-cvs] rev 6920 - trunk/gs/lib * Messages sorted by: [13][ date ] [14][ thread ] [15][ subject ] [16][ author ] __________________________________________________________________ [17]More information about the gs-cvs mailing list References 1. http://ghostscript.com/pipermail/gs-cvs/2006-July/index.html 2. http://ghostscript.com/pipermail/gs-cvs/2006-July/006676.html 3. http://ghostscript.com/pipermail/gs-cvs/2006-July/006678.html 4. mailto:gs-cvs%40ghostscript.com?Subject=%5Bgs-cvs%5D%20%20rev%206919%20-%20trunk/gs/src&In-Reply-To= 5. http://ghostscript.com/pipermail/gs-cvs/2006-July/006676.html 6. http://ghostscript.com/pipermail/gs-cvs/2006-July/006678.html 7. http://ghostscript.com/pipermail/gs-cvs/2006-July/date.html#6677 8. http://ghostscript.com/pipermail/gs-cvs/2006-July/thread.html#6677 9. http://ghostscript.com/pipermail/gs-cvs/2006-July/subject.html#6677 10. http://ghostscript.com/pipermail/gs-cvs/2006-July/author.html#6677 11. http://ghostscript.com/pipermail/gs-cvs/2006-July/006676.html 12. http://ghostscript.com/pipermail/gs-cvs/2006-July/006678.html 13. http://ghostscript.com/pipermail/gs-cvs/2006-July/date.html#6677 14. http://ghostscript.com/pipermail/gs-cvs/2006-July/thread.html#6677 15. http://ghostscript.com/pipermail/gs-cvs/2006-July/subject.html#6677 16. http://ghostscript.com/pipermail/gs-cvs/2006-July/author.html#6677 17. http://www.ghostscript.com/mailman/listinfo/gs-cvs