Commit 6f0eadeb authored by Tavmjong Bah's avatar Tavmjong Bah

Fix rounding error issues with 'pt' line-height values that prvent using...

Fix rounding error issues with 'pt' line-height values that prvent using mouse-scroll to change values.
Does not fix problem with other units (which include non-integer values in drop-down menu.
parent e8607ac0
Pipeline #66542381 failed with stages
in 146 minutes and 38 seconds
......@@ -2098,11 +2098,15 @@ TextToolbar::selection_changed(Inkscape::Selection * /*selection*/, bool subsele
int unit = prefs->getInt("/options/font/unitType", SP_CSS_UNIT_PT);
double size = sp_style_css_size_px_to_units(query.font_size.computed, unit);
//gchar size_text[G_ASCII_DTOSTR_BUF_SIZE];
//g_ascii_dtostr (size_text, sizeof (size_text), size);
Inkscape::CSSOStringStream os;
os << size;
int rounded_size = std::round(size);
if (std::abs((size - rounded_size)/size) < 0.0001) {
// We use rounded_size to avoid rounding errors when, say, converting stored 'px' values to displayed 'pt' values.
os << rounded_size;
} else {
os << size;
}
// Freeze to ignore callbacks.
//g_object_freeze_notify( G_OBJECT( fontSizeAction->combobox ) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment