diff options
Diffstat (limited to 'src/ui/dialog')
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.cpp | 3 | ||||
| -rw-r--r-- | src/ui/dialog/text-edit.cpp | 20 | ||||
| -rw-r--r-- | src/ui/dialog/text-edit.h | 1 |
3 files changed, 16 insertions, 8 deletions
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index d8db99f4e..1288b6453 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -486,9 +486,6 @@ void InkscapePreferences::initPageTools() 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*/}; _page_text.add_group_header( _("Text units")); - _font_unit_type.init( "/options/font/unitType", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), SP_CSS_UNIT_PT ); - _page_text.add_line( true, _("Text size unit type:"), _font_unit_type, "", - _("Set the type of unit used in the text toolbar and text dialogs"), false); _font_output_px.init ( _("Always output text size in pixels (px)"), "/options/font/textOutputPx", true); // _page_text.add_line( false, "", _font_output_px, "", _("Always convert the text size units above into pixels (px) before saving to file")); diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index fd8422652..e0faa68ed 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -37,6 +37,7 @@ extern "C" { #include "document-undo.h" #include "document.h" #include "inkscape.h" +#include "style.h" #include "text-editing.h" #include "verbs.h" @@ -48,8 +49,8 @@ extern "C" { #include "object/sp-textpath.h" #include "svg/css-ostringstream.h" - #include "ui/icon-names.h" +#include "ui/toolbar/text-toolbar.h" #include "ui/widget/font-selector.h" #include "util/units.h" @@ -268,7 +269,7 @@ void TextEdit::onReadSelection ( gboolean dostyle, gboolean /*docontent*/ ) 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); font_selector.update_size (size); - + selected_fontsize = size; // Update font features (variant) widget //int result_features = sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONTVARIANTS); @@ -422,18 +423,21 @@ void TextEdit::onApply() unsigned items = 0; auto item_list = desktop->getSelection()->items(); SPCSSAttr *css = fillTextStyle (); - sp_desktop_set_style(desktop, css, true); - + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); for(auto i=item_list.begin();i!=item_list.end();++i){ // apply style to the reprs of all text objects in the selection if (SP_IS_TEXT (*i) || (SP_IS_FLOWTEXT (*i)) ) { ++items; } } + if (items == 1) { + double factor = font_selector.get_fontsize() / selected_fontsize; + prefs->setDouble("/options/font/scaleLineHeightFromFontSIze", factor); + } + sp_desktop_set_style(desktop, css, true); if (items == 0) { // no text objects; apply style to prefs for new objects - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->mergeStyle("/tools/text/style", css); setasdefault_button.set_sensitive ( false ); @@ -442,6 +446,12 @@ void TextEdit::onApply() SPItem *item = SP_ACTIVE_DESKTOP->getSelection()->singleItem(); if (SP_IS_TEXT (item) || SP_IS_FLOWTEXT(item)) { updateObjectText (item); + SPStyle *item_style = item->style; + if (SP_IS_TEXT(item) && item_style->inline_size.value == 0) { + css = sp_css_attr_from_style(item_style, SP_STYLE_FLAG_IFSET); + sp_repr_css_unset_property(css, "inline-size"); + item->changeCSS(css, "style"); + } } } diff --git a/src/ui/dialog/text-edit.h b/src/ui/dialog/text-edit.h index 0d09e24b5..cef6ddfea 100644 --- a/src/ui/dialog/text-edit.h +++ b/src/ui/dialog/text-edit.h @@ -188,6 +188,7 @@ private: sigc::connection fontFeaturesChangedConn; // Other + double selected_fontsize; bool blocked; const Glib::ustring samplephrase; |
