diff options
| author | John Smith <john.smith7545@yahoo.com> | 2012-08-16 08:20:16 +0000 |
|---|---|---|
| committer | John Smith <john.smith7545@yahoo.com> | 2012-08-16 08:20:16 +0000 |
| commit | b61db3c2d4c3d2fb497d62b4ddb3364031f5fdec (patch) | |
| tree | 5fcd18179bd2d75c411027dcc19f4957b1b1ce2d /src/ui | |
| parent | code style (use NULL for pointers instead of 0) (diff) | |
| download | inkscape-b61db3c2d4c3d2fb497d62b4ddb3364031f5fdec.tar.gz inkscape-b61db3c2d4c3d2fb497d62b4ddb3364031f5fdec.zip | |
Fix for 168164 : Font sizes in points option
(bzr r11608)
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.cpp | 7 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.h | 1 | ||||
| -rw-r--r-- | src/ui/dialog/text-edit.cpp | 18 |
3 files changed, 21 insertions, 5 deletions
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index aab8ccc04..0e4d7fd56 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -313,6 +313,7 @@ void InkscapePreferences::initPageTools() //Selector this->AddPage(_page_selector, _("Selector"), iter_tools, PREFS_PAGE_TOOLS_SELECTOR); + AddSelcueCheckbox(_page_selector, "/tools/select", false); _page_selector.add_group_header( _("When transforming, show")); _t_sel_trans_obj.init ( _("Objects"), "/tools/select/show", "content", true, 0); @@ -441,6 +442,12 @@ void InkscapePreferences::initPageTools() _page_text.add_line( false, "", _font_dialog, "", _("Show font substitution warning dialog when requested fonts are not available on the system")); } + Glib::ustring sizeLabels[] = {_("Pixel"), _("Point"), _("Pica"), _("Millimeter"), _("Centimeter"), _("Inch"), _("Em square")/*, _("Ex square"), _("Percent")*/}; + int sizeValues[] = {SP_CSS_UNIT_PX, SP_CSS_UNIT_PT, SP_CSS_UNIT_PC, SP_CSS_UNIT_MM, SP_CSS_UNIT_CM, SP_CSS_UNIT_IN, SP_CSS_UNIT_EM/*, SP_CSS_UNIT_EX, SP_CSS_UNIT_PERCENT*/}; + + _font_unit_type.init( "/options/font/unitType", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), SP_CSS_UNIT_PT ); + _page_text.add_line( false, _("Text size unit type:"), _font_unit_type, "", + _("Set the type of unit used in the text toolbar and text dialogs"), false); this->AddNewObjectsStyle(_page_text, "/tools/text"); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index d100f74f7..6d13b9d20 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -286,6 +286,7 @@ protected: UI::Widget::PrefSlider _snap_delay; UI::Widget::PrefSlider _snap_weight; UI::Widget::PrefCheckButton _font_dialog; + UI::Widget::PrefCombo _font_unit_type; UI::Widget::PrefCheckButton _misc_comment; UI::Widget::PrefCheckButton _misc_default_metadata; diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index 791b49af9..5a983fc1a 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -316,7 +316,10 @@ void TextEdit::onReadSelection ( gboolean dostyle, gboolean /*docontent*/ ) font_instance *font = font_factory::Default()->FaceFromStyle(query); if (font) { - sp_font_selector_set_font (fsel, font, query->font_size.computed); + + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + int unit = prefs->getInt("/options/font/unitType", SP_CSS_UNIT_PT); + sp_font_selector_set_font (fsel, font, sp_style_get_css_font_size_units(query->font_size.computed, unit) ); setPreviewText(font, phrase); font->Unref(); font=NULL; @@ -362,13 +365,16 @@ void TextEdit::setPreviewText (font_instance *font, Glib::ustring phrase) } char *desc = pango_font_description_to_string(font->descr); - double size = sp_font_selector_get_size(fsel); + double unit_size = sp_font_selector_get_size(fsel); + + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + int unit = prefs->getInt("/options/font/unitType", SP_CSS_UNIT_PT); + double px_size = unit_size * (unit_size / sp_style_get_css_font_size_units(unit_size, unit)); gchar *const phrase_escaped = g_markup_escape_text(phrase.c_str(), -1); gchar *markup = g_strdup_printf("<span font=\"%s\" size=\"%d\">%s</span>", - desc, (int) (size * PANGO_SCALE), phrase_escaped); - + desc, (int) (px_size * PANGO_SCALE), phrase_escaped); preview_label.set_markup(markup); @@ -461,7 +467,9 @@ SPCSSAttr *TextEdit::getTextStyle () sp_repr_css_set_property (css, "font-variant", c); Inkscape::CSSOStringStream os; - os << sp_font_selector_get_size (fsel) << "px"; // must specify px, see inkscape bug 1221626 and 1610103 + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + int unit = prefs->getInt("/options/font/unitType", SP_CSS_UNIT_PT); + os << sp_font_selector_get_size (fsel) << sp_style_get_css_unit_string(unit); sp_repr_css_set_property (css, "font-size", os.str().c_str()); font->Unref(); |
