diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-12-21 13:08:34 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-12-21 13:08:34 -0500 |
commit | 26119af7a6bcac01cbd3999daf0e32eba2148b4d (patch) | |
tree | a66820fc1cc04bfdfef437f4293b84b11775cdae /gsk/gskrendernodeparser.c | |
parent | 478d1f71e3fef0cb94ee26201b67a45088150cc2 (diff) | |
download | gtk+-26119af7a6bcac01cbd3999daf0e32eba2148b4d.tar.gz |
gsk: Improve glyph serialization
The special case for ASCII glyphs is unfortunately not
working very well, because of an oversight in pango:
When I added subpixel positioning, I made pango_shape()
default to not rounding, and make PangoLayout call
pango_shape_with_flags() and pass the rounding information
down. The upshot is that we need to use the _with_flags
variant here and tell it to round position, so it matches
what the text node contains.
Diffstat (limited to 'gsk/gskrendernodeparser.c')
-rw-r--r-- | gsk/gskrendernodeparser.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/gsk/gskrendernodeparser.c b/gsk/gskrendernodeparser.c index a77e8a5a9a..45b500dc42 100644 --- a/gsk/gskrendernodeparser.c +++ b/gsk/gskrendernodeparser.c @@ -688,10 +688,16 @@ create_ascii_glyphs (PangoFont *font) glyph_string = pango_glyph_string_new (); for (i = MIN_ASCII_GLYPH; i < MAX_ASCII_GLYPH; i++) { - pango_shape ((char[2]) { i, 0 }, - 1, - ¬_a_hack, - glyph_string); + const char text[2] = { i, 0 }; + + pango_shape_with_flags (text, + 1, + text, + 1, + ¬_a_hack, + glyph_string, + PANGO_SHAPE_ROUND_POSITIONS); + if (glyph_string->num_glyphs != 1) { pango_glyph_string_free (glyph_string); |