mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-04 22:18:29 +02:00
[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.
This commit is contained in:
parent
bc4d363e92
commit
38c5f0d49b
1 changed files with 5 additions and 4 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue