[gs-commits] rev 10880 - trunk/gs/psi

ken at ghostscript.com ken at ghostscript.com
Mon Mar 8 16:20:54 UTC 2010

Author: ken
Date: 2010-03-08 16:20:53 +0000 (Mon, 08 Mar 2010)
New Revision: 10880

Ongoing bug fixes for #690448.
The FreeType code will synthesize vertical metrics for TrueType (Type 42) fonts which do
not contain a vmtx table. This includes the vertical advance, which will be returned
to the FAPI code, and used even if there were originally no vertical metrics and the
font should not have any vertical advance.

Modified the metrics override callback, called by FT, so that if the font is a TT font,
and this is a vertical metrics call, we set the advance to 0. This prevents the
synthesized metrics from incorrectly advancing the glyph vertically.

This may eventually be a problem if we find a CIDFont with Type42 outlines which relies
on the vmtx table in the font rather than the Metrics2 or CDevProc overrides to position
the glyphs. Since this facility was only added in CPSI 3011 it is unlikely we will ever
encounter such a font. THis has not been done at present, as the information (WMode=1)
is not currently available to the code called from FreeType to override the metrics, 
and would need to be added.

Also, fixed an issue where the 'advance_v' member of the metrics structure was left
uninitialised if a horizontal override took place. This could cause glyphs to be
mis-positioned vertically.

Modified: trunk/gs/psi/fapi_ft.c
--- trunk/gs/psi/fapi_ft.c	2010-03-08 15:41:20 UTC (rev 10879)
+++ trunk/gs/psi/fapi_ft.c	2010-03-08 16:20:53 UTC (rev 10880)
@@ -199,7 +199,13 @@
 get_fapi_glyph_metrics(FT_Incremental a_info, FT_UInt a_glyph_index,
 	FT_Bool bVertical, FT_Incremental_MetricsRec *a_metrics)
-    /* fixme : bVertical is not implemented. */
+    /* FreeType will create synthetic vertical metrics, including a vertical
+     * advance, if none is present. We don't want this, so if the font is a type 42
+     * and the WMode is not 1 (vertical) we ignore the advance by setting it to 0
+     */
+    if (bVertical && !a_info->fapi_font->is_type1 && !a_info->fapi_font->is_cid)
+	a_metrics->advance = 0;
     if (a_info->glyph_metrics_index == a_glyph_index)
 	switch (a_info->metrics_type)
@@ -212,6 +218,8 @@
 		*a_metrics = a_info->glyph_metrics;
+		/* We are replacing the horizontal metrics, so the vertical must be 0 */
+		a_metrics->advance_v = 0;
 		/* This can't happen. */

More information about the gs-commits mailing list