Clone in a terminal:
Commit fe76d5b
Johan Mattsson - 2015-10-07T08:59:54+00:00
fe76d5bf0cf580b51340419c9336c29b9c2533efjohan.mattsson.m@gmail.com

Store otf tags in kerning tab

Changed files (2)

Diff

diff --git a/libbirdfont/KerningTools.vala b/libbirdfont/KerningTools.valaindex 409ae02..687bd39 100644--- a/libbirdfont/KerningTools.vala+++ b/libbirdfont/KerningTools.vala@@ -33,7 +33,6 @@ public class KerningTools : ToolCollection  { 	static OtfTags active_otf_features; 	 	public KerningTools () {-		active_otf_features = new OtfTags (); 		selected (); 	} 	@@ -52,6 +51,8 @@ public class KerningTools : ToolCollection  { 	public static void init () { 		Font font = BirdFont.get_current_font (); 		+		active_otf_features = new OtfTags ();+		 		Expander kerning_tools = new Expander (t_("Kerning Tools")); 		classes = new Expander (); 		expanders = new Gee.ArrayList<Expander> ();@@ -181,6 +182,8 @@ public class KerningTools : ToolCollection  { 	 	public static void add_otf_label (string tag) { 		OtfLabel otf_label = new OtfLabel (tag);+		FontSettings fs = BirdFont.get_current_font ().settings;+		 		otf_features.add_tool (otf_label); 		otf_label.otf_feature_activity.connect ((enable, tag) => { 			OtfTags tags = active_otf_features.copy ();@@ -190,17 +193,22 @@ public class KerningTools : ToolCollection  { 			// create a new feature set in order to keep the features 			// for other parts of the text in kerning tab 			active_otf_features = tags;-+			 			if (enable) { 				tags.add (tag);+				fs.set_setting (@"kerning_$(tag)", "true"); 			} else { 				tags.remove (tag);+				fs.set_setting (@"kerning_$(tag)", "false"); 			} 			 			kd.get_last_segment ().set_otf_tags (tags); 			 			GlyphCanvas.redraw (); 		});+		+		bool enable = fs.get_setting (@"kerning_$(tag)") == "true";+		otf_label.set_selected_tag (enable); 	} 	 	public static void add_unique_class (KerningRange kerning_class) {diff --git a/libbirdfont/OtfLabel.vala b/libbirdfont/OtfLabel.valaindex b51a672..5833a12 100644--- a/libbirdfont/OtfLabel.vala+++ b/libbirdfont/OtfLabel.vala@@ -32,11 +32,15 @@ public class OtfLabel : LabelTool { 		 		select_action.connect ((self) => { 			active_substitution = !active_substitution;-			self.set_selected (active_substitution);-			otf_feature_activity (active_substitution, tag);+			set_selected_tag (active_substitution); 		}); 	} 	+	public void set_selected_tag (bool enabled) {+		set_selected (enabled);+		otf_feature_activity (enabled, tag);+	}+	 	/** @return translated string representation of a OTF feature tag. */ 	public static string get_string (string tag) { 		if (tag == "salt") {

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112