summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2015-06-22 14:13:38 +0000
committertavmjong-free <tavmjong@free.fr>2015-06-22 14:13:38 +0000
commit00a70f10f4c5c273a783f87f61e9d98b9d79deca (patch)
treefef6df9bffc2ef710e1b5f78680fee128eebd0d1 /src/ui
parentEnable rendering of 'font-feature-settings' and 'font-variant-east-asian'. (diff)
downloadinkscape-00a70f10f4c5c273a783f87f61e9d98b9d79deca.tar.gz
inkscape-00a70f10f4c5c273a783f87f61e9d98b9d79deca.zip
Add simple GUI for 'font-feature-settings'.
(bzr r14208)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/dialog/text-edit.cpp4
-rw-r--r--src/ui/widget/font-variants.cpp46
-rw-r--r--src/ui/widget/font-variants.h12
3 files changed, 59 insertions, 3 deletions
diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp
index 1a696c820..b850b2453 100644
--- a/src/ui/dialog/text-edit.cpp
+++ b/src/ui/dialog/text-edit.cpp
@@ -391,7 +391,9 @@ void TextEdit::onReadSelection ( gboolean dostyle, gboolean /*docontent*/ )
// Update font variant widget
//int result_variants =
sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONTVARIANTS);
- vari_vbox.update( &query );
+ int result_features =
+ sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONTFEATURESETTINGS);
+ vari_vbox.update( &query, result_features == QUERY_STYLE_MULTIPLE_DIFFERENT );
}
blocked = false;
diff --git a/src/ui/widget/font-variants.cpp b/src/ui/widget/font-variants.cpp
index 637631fda..7a1e02839 100644
--- a/src/ui/widget/font-variants.cpp
+++ b/src/ui/widget/font-variants.cpp
@@ -68,6 +68,9 @@ namespace Widget {
_numeric_ordinal ( Glib::ustring(_("Ordinal" )) ),
_numeric_slashed_zero ( Glib::ustring(_("Slashed Zero" )) ),
+ _feature_frame ( Glib::ustring(_("Feature Settings")) ),
+ _feature_label ( Glib::ustring(_("Selection has different Feature Settings!")) ),
+
_ligatures_changed( false ),
_position_changed( false ),
_caps_changed( false ),
@@ -231,6 +234,21 @@ namespace Widget {
add( _numeric_frame );
+ // Feature settings ---------------------
+
+ // Add tooltips
+ _feature_entry.set_tooltip_text( _("Feature settings in CSS form. No sanity checking is performed."));
+
+ // Add to frame
+ _feature_vbox.add( _feature_entry );
+ _feature_vbox.add( _feature_label );
+ _feature_frame.add( _feature_vbox );
+ add( _feature_frame );
+
+ // Add signals
+ //_feature_entry.signal_key_press_event().connect ( sigc::mem_fun(*this, &FontVariants::feature_callback) );
+ _feature_entry.signal_changed().connect( sigc::mem_fun(*this, &FontVariants::feature_callback) );
+
show_all_children();
}
@@ -283,9 +301,21 @@ namespace Widget {
_changed_signal.emit();
}
+ void
+ FontVariants::feature_init() {
+ // std::cout << "FontVariants::feature_init()" << std::endl;
+ }
+
+ void
+ FontVariants::feature_callback() {
+ // std::cout << "FontVariants::feature_callback()" << std::endl;
+ _feature_changed = true;
+ _changed_signal.emit();
+ }
+
// Update GUI based on query.
void
- FontVariants::update( SPStyle const *query ) {
+ FontVariants::update( SPStyle const *query, bool different_features ) {
_ligatures_all = query->font_variant_ligatures.computed;
_ligatures_mix = query->font_variant_ligatures.value;
@@ -370,10 +400,19 @@ namespace Widget {
_numeric_ordinal.set_inconsistent( _numeric_mix & SP_CSS_FONT_VARIANT_NUMERIC_ORDINAL );
_numeric_slashed_zero.set_inconsistent( _numeric_mix & SP_CSS_FONT_VARIANT_NUMERIC_SLASHED_ZERO );
+ if( query->font_feature_settings.value )
+ _feature_entry.set_text( query->font_feature_settings.value );
+ if( different_features ) {
+ _feature_label.show();
+ } else {
+ _feature_label.hide();
+ }
+
_ligatures_changed = false;
_position_changed = false;
_caps_changed = false;
_numeric_changed = false;
+ _feature_changed = false;
}
void
@@ -494,6 +533,11 @@ namespace Widget {
sp_repr_css_set_property(css, "font-variant-numeric", css_string.c_str() );
}
+ // Feature settings
+ Glib::ustring feature_string = _feature_entry.get_text();
+ if( !feature_string.empty() || feature_string.compare( "normal" ) ) {
+ sp_repr_css_set_property(css, "font-feature-settings", feature_string.c_str());
+ }
}
} // namespace Widget
diff --git a/src/ui/widget/font-variants.h b/src/ui/widget/font-variants.h
index e6a9dd68b..ca41c050b 100644
--- a/src/ui/widget/font-variants.h
+++ b/src/ui/widget/font-variants.h
@@ -13,6 +13,7 @@
#include <gtkmm/expander.h>
#include <gtkmm/checkbutton.h>
#include <gtkmm/radiobutton.h>
+#include <gtkmm/entry.h>
class SPDesktop;
class SPObject;
@@ -81,6 +82,11 @@ protected:
Gtk::CheckButton _numeric_ordinal;
Gtk::CheckButton _numeric_slashed_zero;
+ Gtk::Expander _feature_frame;
+ Gtk::VBox _feature_vbox;
+ Gtk::Entry _feature_entry;
+ Gtk::Label _feature_label;
+
private:
void ligatures_init();
void ligatures_callback();
@@ -94,6 +100,9 @@ private:
void numeric_init();
void numeric_callback();
+ void feature_init();
+ void feature_callback();
+
// To determine if we need to write out property (may not be necessary)
unsigned _ligatures_all;
unsigned _position_all;
@@ -109,6 +118,7 @@ private:
bool _position_changed;
bool _caps_changed;
bool _numeric_changed;
+ bool _feature_changed;
sigc::signal<void> _changed_signal;
@@ -117,7 +127,7 @@ public:
/**
* Update GUI based on query results.
*/
- void update( SPStyle const *query );
+ void update( SPStyle const *query, bool different_features );
/**
* Fill SPCSSAttr based on settings of buttons.