[gs-commits] rev 12332 - trunk/ghostpdl/xps
tor at ghostscript.com
tor at ghostscript.com
Wed Mar 30 11:13:37 UTC 2011
Author: tor
Date: 2011-03-30 11:13:37 +0000 (Wed, 30 Mar 2011)
New Revision: 12332
Modified:
trunk/ghostpdl/xps/xpsglyphs.c
Log:
xps: Fix bug when parsing cluster mappings.
We incorrectly encoded and emitted all characters in a
Many-to-One cluster mapping, resulting in extraneous characters
where ligatures were used. A (2:1) cluster map for the ligature
"fi" has two characters (f, i) and one glyph (fi). We showed it
as two glyphs (fi, i) instead of skipping the second character
while decoding the cluster map.
This fixes multiple errors in MXDW/TypeSamples.xps
Modified: trunk/ghostpdl/xps/xpsglyphs.c
===================================================================
--- trunk/ghostpdl/xps/xpsglyphs.c 2011-03-30 10:17:57 UTC (rev 12331)
+++ trunk/ghostpdl/xps/xpsglyphs.c 2011-03-30 11:13:37 UTC (rev 12332)
@@ -320,6 +320,7 @@
while ((us && un > 0) || (is && *is))
{
+ int char_code = '?';
int code_count = 1;
int glyph_count = 1;
@@ -333,23 +334,8 @@
if (glyph_count < 1)
glyph_count = 1;
- while (code_count > 0 || glyph_count > 0)
+ while (code_count--)
{
- int char_code = '?';
- int glyph_index = -1;
- float u_offset = 0.0;
- float v_offset = 0.0;
- float advance;
-
- if (glyph_count)
- {
- if (is && *is)
- is = xps_parse_glyph_index(is, &glyph_index);
- glyph_count --;
- }
-
- if (code_count)
- {
if (us && un > 0)
{
int t = xps_utf8_to_ucs(&char_code, us, un);
@@ -357,9 +343,18 @@
return gs_rethrow(-1, "error decoding UTF-8 string");
us += t; un -= t;
}
- code_count --;
}
+ while (glyph_count--)
+ {
+ int glyph_index = -1;
+ float u_offset = 0.0;
+ float v_offset = 0.0;
+ float advance;
+
+ if (is && *is)
+ is = xps_parse_glyph_index(is, &glyph_index);
+
if (glyph_index == -1)
glyph_index = xps_encode_font_char(font, char_code);
@@ -378,12 +373,6 @@
is ++;
}
-#if 0
- dprintf6("glyph mapping (%d:%d)%d,%g,%g,%g\n",
- code_count, glyph_count, glyph_index,
- advance, u_offset, v_offset);
-#endif
-
if (bidi_level & 1)
u_offset = -mtx.hadv * 100 - u_offset;
More information about the gs-commits
mailing list