From 22e970a23e8667aeb0ff6ac1c59ac659ad71059a Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 20 Sep 2008 12:20:21 +0000 Subject: [PATCH] Formatting, minor code fixes. --- ChangeLog | 12 +++++++----- docs/CHANGES | 14 ++++++++++---- docs/formats.txt | 18 +++++++++++------- src/base/ftmac.c | 19 +++++++++++-------- src/base/ftobjs.c | 19 +++++++++++-------- src/smooth/ftgrays.c | 4 ++++ 6 files changed, 54 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3232716bf..8e1d85245 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,8 @@ * src/base/ftadvanc.c (FT_Get_Advance, FT_Get_Advances): Use FT_ERROR_BASE. + * docs/formats.txt: Updated. + 2008-09-19 suzuki toshiya * src/base/ftmac.c: Import sfnt-wrapped Type1 and sfnt-wrapped @@ -32,17 +34,17 @@ 2008-09-19 suzuki toshiya - * src/base/ftobjs.c (Mac_Read_sfnt_Resource): Fix double free bug - in sfnt-wrapped Type1 and sfnt-wrapped CID-keyed font support code. - open_face_from_buffer() frees the passed buffer when it cannot - open a face from the buffer, so the caller must not free it. + * src/base/ftobjs.c (Mac_Read_sfnt_Resource): Fix double free bug in + sfnt-wrapped Type1 and sfnt-wrapped CID-keyed font support code. + `open_face_from_buffer' frees the passed buffer if it cannot open a + face from the buffer, so the caller must not free it. 2008-09-19 suzuki toshiya * src/base/ftobjs.c (Mac_Read_sfnt_Resource): Add initial support for sfnt-wrapped Type1 and sfnt-wrapped CID-keyed font. (ft_lookup_PS_in_sfnt): New function to look up `TYP1' or `CID ' - table in sfnt table directory. It is used before loading TrueType + table in sfnt table directory. It is used before loading TrueType font driver. * docs/CHANGES: Add note about the current status of sfnt-wrapped diff --git a/docs/CHANGES b/docs/CHANGES index 0966816a2..530b9517e 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -2,10 +2,16 @@ CHANGES BETWEEN 2.3.8 and 2.3.7 I. IMPORTANT BUG FIXES - - PS Type1 and CID-keyed fonts in an SFNT wrapper were not loaded. - In version 2.3.8, the core tables `TYP1' or `CID ' are passed to - PS Type1 or CID-keyed font drivers, other tables (`ALMX', `BBOX' - etc) are not supported yet. + - CID-keyed fonts in an SFNT wrapper were not handled correctly. + + + II. IMPORTANT CHANGES + + - Rudimentary support for Type 1 fonts and CID-keyed Type 1 fonts + in an SFNT wrapper has been added -- such fonts are used on the + Mac. The core SFNT tables `TYP1' and `CID ' are passed to the + PS Type 1 and CID-keyed PS font drivers; other tables (`ALMX', + `BBOX', etc.) are not supported yet. ====================================================================== diff --git a/docs/formats.txt b/docs/formats.txt index 2f7c3d94e..69719b4bf 100644 --- a/docs/formats.txt +++ b/docs/formats.txt @@ -51,12 +51,14 @@ type format format type access driver documents --- --- BDF --- --- bdf 5005.BDF_Spec.pdf, X11 ---- SFNT PS TYPE_1 --- --- Type 1 GX Font Format - (for the Mac) -MAC SFNT PS TYPE_1 --- --- Type 1 GX Font Format - (for the Mac) ---- SFNT PS TYPE_1 CID --- 5180.sfnt.pdf (for the Mac) -MAC SFNT PS TYPE_1 CID --- 5180.sfnt.pdf (for the Mac) +--- SFNT PS TYPE_1 --- type1 Type 1 GX Font Format + (for the Mac) [3] +MAC SFNT PS TYPE_1 --- type1 Type 1 GX Font Format + (for the Mac) [3] +--- SFNT PS TYPE_1 CID cid 5180.sfnt.pdf (for the Mac) + [3] +MAC SFNT PS TYPE_1 CID cid 5180.sfnt.pdf (for the Mac) + [3] --- SFNT PS CFF --- cff OT spec, 5176.CFF.pdf (`OTTO' format) MAC SFNT PS CFF --- cff OT spec, 5176.CFF.pdf @@ -139,9 +141,11 @@ MAC --- PS TYPE_1 --- type1 T1_SPEC.pdf (free registration required). +[3] Support is rudimentary currently; some tables are not loaded yet. + ------------------------------------------------------------------------ -Copyright 2004, 2005 by +Copyright 2004, 2005, 2008 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/src/base/ftmac.c b/src/base/ftmac.c index 92c346926..257bf9b9d 100644 --- a/src/base/ftmac.c +++ b/src/base/ftmac.c @@ -829,13 +829,14 @@ } - /* Look up `TYP1' or `CID ' table from sfnt table directory. */ - /* offset & length must exclude the binary header in tables. */ + /* Look up `TYP1' or `CID ' table from sfnt table directory. */ + /* `offset' and `length' must exclude the binary header in tables. */ - /* For proper support, PS Type1 and CID-keyed font drivers */ - /* should recognize sfnt-wrapped format. Here, yet TrueType */ - /* font driver is not loaded, we must parse by ourselves. */ - /* We only care the name of table and offset. */ + /* Type 1 and CID-keyed font drivers should recognize sfnt-wrapped */ + /* format too. Here, since we can't expect that the TrueType font */ + /* driver is loaded unconditially, we must parse the font by */ + /* ourselves. We are only interested in the name of the table and */ + /* the offset. */ static FT_Error ft_lookup_PS_in_sfnt( FT_Byte* sfnt, @@ -847,7 +848,8 @@ FT_UShort numTables = FT_NEXT_USHORT( p ); - p += ( 2 * 3 ); /* skip binary search header */ + p += 2 * 3; /* skip binary search header */ + for ( ; numTables > 0 ; numTables -- ) { FT_ULong tag = FT_NEXT_ULONG( p ); @@ -866,7 +868,7 @@ return FT_Err_Ok; } - /* see Apple "The Type 1 GX Font Format" */ + /* see Apple's `The Type 1 GX Font Format' */ if ( tag == FT_MAKE_TAG( 'T', 'Y', 'P', '1' ) ) { *offset += 24; @@ -945,6 +947,7 @@ goto Exit; } } + Try_OpenType: error = open_face_from_buffer( library, sfnt_data, diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 26ab73700..026691ed7 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -1415,13 +1415,14 @@ } - /* Look up `TYP1' or `CID ' table from sfnt table directory. */ - /* offset & length must exclude the binary header in tables. */ + /* Look up `TYP1' or `CID ' table from sfnt table directory. */ + /* `offset' and `length' must exclude the binary header in tables. */ - /* For proper support, PS Type1 and CID-keyed font drivers */ - /* should recognize sfnt-wrapped format. Here, yet TrueType */ - /* font driver is not loaded, we must parse by ourselves. */ - /* We only care the name of table and offset. */ + /* Type 1 and CID-keyed font drivers should recognize sfnt-wrapped */ + /* format too. Here, since we can't expect that the TrueType font */ + /* driver is loaded unconditially, we must parse the font by */ + /* ourselves. We are only interested in the name of the table and */ + /* the offset. */ static FT_Error ft_lookup_PS_in_sfnt( FT_Byte* sfnt, @@ -1433,7 +1434,8 @@ FT_UShort numTables = FT_NEXT_USHORT( p ); - p += ( 2 * 3 ); /* skip binary search header */ + p += 2 * 3; /* skip binary search header */ + for ( ; numTables > 0 ; numTables -- ) { FT_ULong tag = FT_NEXT_ULONG( p ); @@ -1452,7 +1454,7 @@ return FT_Err_Ok; } - /* see Apple "The Type 1 GX Font Format" */ + /* see Apple's `The Type 1 GX Font Format' */ if ( tag == FT_MAKE_TAG( 'T', 'Y', 'P', '1' ) ) { *offset += 24; @@ -1546,6 +1548,7 @@ goto Exit; } } + Try_OpenType: error = open_face_from_buffer( library, sfnt_data, diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index a409562da..4345fbd54 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -1338,6 +1338,8 @@ ras.num_gray_spans = 0; + FT_TRACE7(( "gray_sweep: start\n" )); + for ( yindex = 0; yindex < ras.ycount; yindex++ ) { PCell cell = ras.ycells[yindex]; @@ -1371,6 +1373,8 @@ if ( ras.render_span && ras.num_gray_spans > 0 ) ras.render_span( ras.span_y, ras.num_gray_spans, ras.gray_spans, ras.render_span_data ); + + FT_TRACE7(( "gray_sweep: end\n" )); }