diff options
| author | John Smith <john.smith7545@yahoo.com> | 2012-08-21 05:36:22 +0000 |
|---|---|---|
| committer | John Smith <john.smith7545@yahoo.com> | 2012-08-21 05:36:22 +0000 |
| commit | b3cb91168ba74ef510452d42697e322e27309691 (patch) | |
| tree | dd58d410639ca242ff62e03ae7242beace6679a3 /src/style.cpp | |
| parent | fix type (fixes Windows build) (diff) | |
| download | inkscape-b3cb91168ba74ef510452d42697e322e27309691.tar.gz inkscape-b3cb91168ba74ef510452d42697e322e27309691.zip | |
Fix for 168164 : Font size, always output px option
(bzr r11616)
Diffstat (limited to 'src/style.cpp')
| -rw-r--r-- | src/style.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/style.cpp b/src/style.cpp index 5c343cdf1..1709132a0 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -2470,7 +2470,7 @@ sp_style_get_css_unit_string(int unit) * Convert a size in pixels into another CSS unit size */ double -sp_style_get_css_font_size_units(double size, int unit) +sp_style_css_size_px_to_units(double size, int unit) { double unit_size = size; switch (unit) { @@ -2493,6 +2493,19 @@ sp_style_get_css_font_size_units(double size, int unit) return unit_size; } + +/* + * Convert a size in a CSS unit size to pixels + */ +double +sp_style_css_size_units_to_px(double size, int unit) +{ + if (unit == SP_CSS_UNIT_PX) { + return size; + } + //g_message("sp_style_css_size_units_to_px %f %d = %f px", size, unit, out); + return size * (size / sp_style_css_size_px_to_units(size, unit));; +} /** * */ @@ -4220,7 +4233,10 @@ sp_style_write_ifontsize(gchar *p, gint const len, gchar const *key, Inkscape::CSSOStringStream os; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int unit = prefs->getInt("/options/font/unitType", SP_CSS_UNIT_PT); - os << key << ":" << sp_style_get_css_font_size_units(val->computed, unit) << sp_style_get_css_unit_string(unit) << ";"; + if (prefs->getBool("/options/font/textOutputPx", false)) { + unit = SP_CSS_UNIT_PX; + } + os << key << ":" << sp_style_css_size_px_to_units(val->computed, unit) << sp_style_get_css_unit_string(unit) << ";"; return g_strlcpy(p, os.str().c_str(), len); } else if (val->type == SP_FONT_SIZE_PERCENTAGE) { Inkscape::CSSOStringStream os; |
