ref: b01676b223a16461acf508e9bb3d68ba8c8ae532
parent: c01c90424939a4b60edce9900cbfed09a9bfacdf
author: Werner Lemberg <[email protected]>
date: Mon Apr 18 03:13:07 EDT 2005
* 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.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2005-04-16 Werner Lemberg <[email protected]>
+
+ * 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 <[email protected]>
* include/freetype/freetype.h (FT_Vector_Transform),
--- a/docs/formats.txt
+++ b/docs/formats.txt
@@ -39,9 +39,9 @@
Please send additions and/or corrections to [email protected] 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 [email protected] (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 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;
--- 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 */
--- 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,11 +536,11 @@
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 );
cffface->underline_thickness =
@@ -683,6 +684,32 @@
flags |= FT_STYLE_FLAG_BOLD;
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