diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-07-21 21:43:19 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-07-21 21:43:19 +0000 |
commit | 0978052c9c61032082d60bafba6ec1961b047ce2 (patch) | |
tree | 1a4143b7770815fe987c893d6ff06b3850414cec /pango/pango-attributes.c | |
parent | 804ef7674724a1bb801778ee031fc0db261d4dfc (diff) | |
parent | d439eea5909b13a138930a668b3114a1dc4904b4 (diff) | |
download | pango-0978052c9c61032082d60bafba6ec1961b047ce2.tar.gz |
Merge branch 'approximated-sizes' into 'main'
font-desc: Use local double values to store sizes
Closes #580
See merge request GNOME/pango!377
Diffstat (limited to 'pango/pango-attributes.c')
-rw-r--r-- | pango/pango-attributes.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c index fd0df205..26d08404 100644 --- a/pango/pango-attributes.c +++ b/pango/pango-attributes.c @@ -2382,10 +2382,16 @@ pango_attr_iterator_get_font (PangoAttrIterator *iterator, if (have_scale) { + /* We need to use a local variable to ensure that the compiler won't + * implicitly cast it to integer while the result is kept in registers, + * leading to a wrong approximation in i386 (with 387 FPU) + */ + volatile double size = scale * pango_font_description_get_size (desc); + if (pango_font_description_get_size_is_absolute (desc)) - pango_font_description_set_absolute_size (desc, scale * pango_font_description_get_size (desc)); + pango_font_description_set_absolute_size (desc, size); else - pango_font_description_set_size (desc, scale * pango_font_description_get_size (desc)); + pango_font_description_set_size (desc, size); } } |