diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2015-05-14 05:24:57 +0000 |
|---|---|---|
| committer | tavmjong-free <tavmjong@free.fr> | 2015-05-14 05:24:57 +0000 |
| commit | ffd7534dc2d5d718dbc0720c17dda56f57fcd7ed (patch) | |
| tree | f8c1c9babeae5dab727b203dfebfcb84cc6a4832 | |
| parent | Fix make check (diff) | |
| download | inkscape-ffd7534dc2d5d718dbc0720c17dda56f57fcd7ed.tar.gz inkscape-ffd7534dc2d5d718dbc0720c17dda56f57fcd7ed.zip | |
Enable setting of 'font-variant-ligatures' (rendering waits on new Pango library).
(bzr r14152)
| -rw-r--r-- | src/ui/dialog/text-edit.cpp | 5 | ||||
| -rw-r--r-- | src/ui/widget/font-variants.cpp | 28 | ||||
| -rw-r--r-- | src/ui/widget/font-variants.h | 3 |
3 files changed, 34 insertions, 2 deletions
diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index 98ea7f9f7..2726d979c 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -517,12 +517,15 @@ SPCSSAttr *TextEdit::fillTextStyle () sp_repr_css_set_property (css, "writing-mode", "tb"); } - // Note that CSS 1.1 does not support line-height; we set it for consistency, but also set + // Note that SVG 1.1 does not support line-height; we set it for consistency, but also set // sodipodi:linespacing for backwards compatibility; in 1.2 we use line-height for flowtext const gchar *sstr = gtk_combo_box_text_get_active_text ((GtkComboBoxText *) spacing_combo); sp_repr_css_set_property (css, "line-height", sstr); + // Font variants + vari_vbox.fill_css( css ); + return css; } diff --git a/src/ui/widget/font-variants.cpp b/src/ui/widget/font-variants.cpp index 46fbc2aa4..7da7662e2 100644 --- a/src/ui/widget/font-variants.cpp +++ b/src/ui/widget/font-variants.cpp @@ -27,6 +27,7 @@ #include "sp-tref.h" #include "sp-textpath.h" #include "sp-item-group.h" +#include "xml/repr.h" namespace Inkscape { namespace UI { @@ -230,6 +231,33 @@ namespace Widget { _ligatures_contextual.set_inconsistent( mix & SP_CSS_FONT_VARIANT_LIGATURES_CONTEXTUAL ); } + void + FontVariants::fill_css( SPCSSAttr *css ) { + + // Ligatures + bool common = _ligatures_common.get_active(); + bool discretionary = _ligatures_discretionary.get_active(); + bool historical = _ligatures_historical.get_active(); + bool contextual = _ligatures_contextual.get_active(); + + if( !common && !discretionary && !historical && !contextual ) { + sp_repr_css_set_property(css, "font-variant-ligatures", "none" ); + } else if ( common && !discretionary && !historical && contextual ) { + sp_repr_css_set_property(css, "font-variant-ligatures", "normal" ); + } else { + Glib::ustring css_string; + if ( !common ) + css_string += "no-common-ligatures "; + if ( discretionary ) + css_string += "discretionary-ligatures "; + if ( historical ) + css_string += "historical-ligatures "; + if ( !contextual ) + css_string += "no-contextual "; + sp_repr_css_set_property(css, "font-variant-ligatures", css_string.c_str() ); + } + } + } // namespace Widget } // namespace UI } // namespace Inkscape diff --git a/src/ui/widget/font-variants.h b/src/ui/widget/font-variants.h index bef14c4bd..f58b80f34 100644 --- a/src/ui/widget/font-variants.h +++ b/src/ui/widget/font-variants.h @@ -18,6 +18,7 @@ class SPDesktop; class SPObject; +class SPCSSAttr; namespace Inkscape { namespace UI { @@ -95,9 +96,9 @@ private: void numeric_callback(); public: - void update_recursive( SPObject *object ); void update( unsigned all, unsigned mix ); + void fill_css( SPCSSAttr* css ); }; |
