[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft-devel] units_per_em in CFF/CID FDArray
From: |
Werner LEMBERG |
Subject: |
Re: [ft-devel] units_per_em in CFF/CID FDArray |
Date: |
Sat, 16 Apr 2005 08:53:33 +0200 (CEST) |
> Today I ran across a CFF CID font in a PDF file where the FontMatrix
> / units_per_em is 2048 instead of 1000, except FontMatrix is
> specified in the FDArray for the subfont, not in the top dict.
>
> Here is the patch against the latest CVS [...]
After some investigation I think this is the wrong approach. Note
that each CID subfont can have a different FontMatrix value! For the
user, only the top dict's entry should be returned.
The right approach IMHO is to select the subfont's FontMatrix in
cff_slot_load, similar to the code in the CID module.
Below is an untested patch which I ask you to verify (and fix if
necessary :-).
Werner
======================================================================
--- cffgload.c.old 2004-05-13 23:59:17.000000000 +0200
+++ cffgload.c 2005-04-16 08:50:39.691961336 +0200
@@ -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,20 @@
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
- font_matrix = cff->top_font.font_dict.font_matrix;
- font_offset = cff->top_font.font_dict.font_offset;
+ /* use the subfont's font matrix if available */
+ 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 */