The Birdfont Source Code
Zoom bar in spacing tab
These changes was commited to the Birdfont repository Mon, 16 Mar 2015 11:35:57 +0000.
Contributing
Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
Zoom bar in spacing tab
--- /dev/null
+++ b/libbirdfont/SpacingTools.vala
@@ -1,1 +1,56 @@
+ /*
+ Copyright (C) 2015 Johan Mattsson
+
+ This library is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 3 of the
+ License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+ */
+
+ using Cairo;
+ using Math;
+
+ namespace BirdFont {
+
+ public class SpacingTools : ToolCollection {
+ public static Gee.ArrayList<Expander> expanders;
+
+ public static ZoomBar zoom_bar;
+
+ public SpacingTools () {
+ expanders = new Gee.ArrayList<Expander> ();
+
+ Expander font_name = new Expander ();
+ font_name.add_tool (new FontName ());
+ font_name.draw_separator = false;
+
+ Expander zoom_expander = new Expander (t_("Font Size"));
+
+ zoom_bar = new ZoomBar ();
+ zoom_bar.new_zoom.connect ((z) => {
+ KerningTools.font_size = 3 * z;
+
+ if (KerningTools.font_size < 0.1) {
+ KerningTools.font_size = 0.1;
+ }
+
+ GlyphCanvas.redraw ();
+ });
+ zoom_expander.add_tool (zoom_bar);
+
+ expanders.add (font_name);
+ expanders.add (zoom_expander);
+ }
+
+ public override Gee.ArrayList<Expander> get_expanders () {
+ return expanders;
+ }
+ }
+
+ }
--- a/libbirdfont/Toolbox.vala
+++ b/libbirdfont/Toolbox.vala
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012 2014 Johan Mattsson
+ Copyright (C) 2012 2014 2015 Johan Mattsson
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
@@ -26,6 +26,7 @@
public static OverviewTools overview_tools;
public static BackgroundTools background_tools;
public static HiddenTools hidden_tools;
+ public static SpacingTools spacing_tools;
Tool current_tool;
@@ -61,6 +62,7 @@
overview_tools = new OverviewTools ();
background_tools = new BackgroundTools ();
hidden_tools = new HiddenTools ();
+ spacing_tools = new SpacingTools ();
tool_sets.append (drawing_tools);
tool_sets.append (kerning_tools);
@@ -80,7 +82,9 @@
}
public static void set_toolbox_from_tab (string tab_name, Tab? t = null) {
- if (tab_name == "Kerning") {
+ if (tab_name == "Spacing") {
+ current_set = (ToolCollection) spacing_tools;
+ } else if (tab_name == "Kerning") {
current_set = (ToolCollection) kerning_tools;
} else if (tab_name == "Preview") {
current_set = (ToolCollection) preview_tools;