diff --git a/ChangeLog b/ChangeLog index 66f0d150..a3f1881f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2005-04-16 Werner Lemberg + + * src/cff/cffobjs.c (cff_face_init): Set default upem value in top + font dict also. + Handle font matrix settings in subfonts. + + * src/cff/cffgload.c (cff_slot_load): Use the correct font matrix + for CID-keyed fonts with subfonts. + + * docs/formats.txt: Updated. + 2005-04-14 Kirill Smelkov * include/freetype/freetype.h (FT_Vector_Transform), diff --git a/docs/formats.txt b/docs/formats.txt index b11f6c40..7d7d03e6 100644 --- a/docs/formats.txt +++ b/docs/formats.txt @@ -39,9 +39,9 @@ reference document and whether it is supported in FreeType 2. Please send additions and/or corrections to wl@gnu.org or to the -FreeType developer's list at devel@freetype (for subscribers only). If -you can provide a font example for a format which isn't supported yet -please send a mail too. +FreeType developer's list at freetype-devel@nongnu.org (for subscribers +only). If you can provide a font example for a format which isn't +supported yet please send a mail too. file wrapper font font glyph FreeType reference @@ -65,8 +65,8 @@ MAC SFNT PS CFF --- cff OT spec, 5176.CFF.pdf MAC SFNT PS CFF CID cff OT spec, 5176.CFF.pdf --- SFNT PS CFF SYNTHETIC --- OT spec, 5176.CFF.pdf MAC SFNT PS CFF SYNTHETIC --- OT spec, 5176.CFF.pdf ---- SFNT TT SBIT --- --- XFree86? (bitmaps only; - `head' table) +--- SFNT TT SBIT --- sfnt XFree86 (bitmaps only; + with `head' table) --- SFNT TT MACSBIT --- sfnt OT spec (for the Mac; bitmaps only; `bhed' table) MAC SFNT TT MACSBIT --- sfnt OT spec (for the Mac; diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 934dcb07..3c0ef6bc 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -4,7 +4,7 @@ /* */ /* OpenType Glyph Loader (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -2466,8 +2466,19 @@ #endif /* FT_CONFIG_OPTION_INCREMENTAL */ - font_matrix = cff->top_font.font_dict.font_matrix; - font_offset = cff->top_font.font_dict.font_offset; + if ( cff->num_subfonts >= 1 ) + { + FT_Byte fd_index = cff_fd_select_get( &cff->fd_select, glyph_index ); + + + font_matrix = cff->subfonts[fd_index]->font_dict.font_matrix; + font_offset = cff->subfonts[fd_index]->font_dict.font_offset; + } + else + { + font_matrix = cff->top_font.font_dict.font_matrix; + font_offset = cff->top_font.font_dict.font_offset; + } /* Now, set the metrics -- this is rather simple, as */ /* the left side bearing is the xMin, and the top side */ diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index fc0501a2..77ef88b8 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -478,6 +478,7 @@ CFF_FontRecDict dict; FT_Memory memory = cffface->memory; FT_Int32 flags; + FT_UInt i; if ( FT_NEW( cff ) ) @@ -535,10 +536,10 @@ cffface->height = (FT_Short)( ( ( cffface->ascender - cffface->descender ) * 12 ) / 10 ); - if ( dict->units_per_em ) - cffface->units_per_EM = dict->units_per_em; - else - cffface->units_per_EM = 1000; + if ( !dict->units_per_em ) + dict->units_per_em = 1000; + + cffface->units_per_EM = dict->units_per_em; cffface->underline_position = (FT_Short)( dict->underline_position >> 16 ); @@ -685,6 +686,32 @@ cffface->style_flags = flags; } + /* handle font matrix settings in subfonts (if any) */ + for ( i = cff->num_subfonts; i > 0; i-- ) + { + CFF_FontRecDict sub = &cff->subfonts[i - 1]->font_dict; + CFF_FontRecDict top = &cff->top_font.font_dict; + + + if ( sub->units_per_em ) + { + FT_Matrix scale; + + + scale.xx = scale.yy = (FT_Fixed)FT_DivFix( top->units_per_em, + sub->units_per_em ); + scale.xy = scale.yx = 0; + + FT_Matrix_Multiply( &scale, &sub->font_matrix ); + FT_Vector_Transform( &sub->font_offset, &scale ); + } + else + { + sub->font_matrix = top->font_matrix; + sub->font_offset = top->font_offset; + } + } + #ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES /* CID-keyed CFF fonts don't have glyph names -- the SFNT loader */ /* has unset this flag because of the 3.0 `post' table */