diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2008-08-08 02:18:25 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2008-08-08 03:01:18 -0400 |
commit | 38c5f0d49b2ce1a6146cbea5ec3376a52cac8e68 (patch) | |
tree | f3ec76bcf935a709e2874be9e83f8c75768160b3 | |
parent | bc4d363e9238da0908ce01d0c08c3f344bd9d34f (diff) |
[scaled-font-subsets] Fix UTF-8 mapping
Prevously all show_text_glyphs() clusters were using ActualText. This
fixes that.
I have a feeling that the following scenario is broken still though:
- show_text_glyphs maps glyph 1 to some utf8 text different from
what index_to_ucs4 will give for glyph 1. This will assign the
utf8 text to glyph 1's ToUnicode.
- show_glyphs shows glyph 1. Since cluster has no utf8 text, we
won't use ActualText and fall back to ToUnicode. But the ToUnicode
value assigned to glyph 1 is non-standard now. We should use
ActualText.
I have not verified this hypothesis though.
-rw-r--r-- | src/cairo-scaled-font-subsets.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/cairo-scaled-font-subsets.c b/src/cairo-scaled-font-subsets.c index 103e117cb..2740d631c 100644 --- a/src/cairo-scaled-font-subsets.c +++ b/src/cairo-scaled-font-subsets.c @@ -460,9 +460,10 @@ _cairo_sub_font_map_glyph (cairo_sub_font_t *sub_font, if (sub_font_glyph == NULL) return _cairo_error (CAIRO_STATUS_NO_MEMORY); - _cairo_sub_font_glyph_lookup_unicode (sub_font_glyph, - sub_font->scaled_font, - scaled_font_glyph_index); + if (utf8_len < 0) + _cairo_sub_font_glyph_lookup_unicode (sub_font_glyph, + sub_font->scaled_font, + scaled_font_glyph_index); status = _cairo_hash_table_insert (sub_font->sub_font_glyphs, &sub_font_glyph->base); if (status) { @@ -491,7 +492,7 @@ _cairo_sub_font_map_glyph (cairo_sub_font_t *sub_font, subset_glyph->is_composite = sub_font->is_composite; subset_glyph->x_advance = sub_font_glyph->x_advance; subset_glyph->y_advance = sub_font_glyph->y_advance; - subset_glyph->utf8_is_mapped = FALSE; + subset_glyph->utf8_is_mapped = _cairo_sub_font_glyph_map_to_unicode (sub_font_glyph, utf8, utf8_len); return CAIRO_STATUS_SUCCESS; } |