Commit 52c570a
Merge ../birdfont-2.x
Changed files (16)
modifiedbirdfont/GtkWindow.valamodifiedinstall.pymodifiedlibbirdfont/GlyphRange.valamodifiedlibbirdfont/KerningDisplay.valamodifiedlibbirdfont/KerningRange.valamodifiedlibbirdfont/KerningTools.valamodifiedlibbirdfont/LabelTool.valamodifiedlibbirdfont/OpenFontFormat/GlyfTable.valamodifiedlibbirdfont/OpenFontFormat/HmtxTable.valamodifiedlibbirdfont/OtfFeatureTable.valamodifiedlibbirdfont/OverView.valamodifiedlibbirdfont/Svg.valaaddedscripts/snap.pyaddedscripts/snap.shaddedscripts/snapcraft.yamlmodifiedscripts/version.py
Diff
@@ -161,9 +161,14 @@ public class GtkWindow : Gtk.Window, NativeWindow { }); scrollbar.set_visible (false);- + show_all ();+ MainWindow.open_recent_files_tab (); ++#if FREE+ MainWindow.show_license_dialog ();+#endif } public void window_focus (void* data) {@@ -1,6 +1,5 @@ #!/usr/bin/python3-"""-Copyright (C) 2013 2014 2015 Johan Mattsson+""" Copyright (C) 2013 2014 2015 Johan Mattsson This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -182,7 +182,11 @@ public class GlyphRange { } if (w.char_count () == 1) {- add_single (w.get_char ());+ unichar c = w.get_char_validated ();+ + if (c > 0) {+ add_single (c);+ } } else if (w == "space") { add_single (' '); } else if (w == "divis") {@@ -45,6 +45,10 @@ public class KerningDisplay : FontDisplay { public bool adjust_side_bearings = false; public bool right_side_bearing = true;++ public bool right_to_left = false; + + WidgetAllocation allocation = new WidgetAllocation (); TextArea description; @@ -137,6 +141,8 @@ public class KerningDisplay : FontDisplay { double item_size = 1.0 / KerningTools.font_size; double item_size2 = 2.0 / KerningTools.font_size; + this.allocation = allocation;+ i = 0; // bg color@@ -160,6 +166,10 @@ public class KerningDisplay : FontDisplay { prev = null; kern = 0; + if (right_to_left) {+ x = (allocation.width - 20) / KerningTools.font_size;+ }+ foreach (GlyphSequence word in get_all_rows ()) { wi = 0; word_with_ligatures = word.process_ligatures (font);@@ -192,7 +202,13 @@ public class KerningDisplay : FontDisplay { cr.save (); glyph.add_help_lines ();- cr.translate (kern + x - glyph.get_lsb () - Glyph.xc (), glyph.get_baseline () + y - Glyph.yc ());+ + if (right_to_left) {+ cr.translate (x - kern - glyph.get_lsb () - glyph.get_width () - Glyph.xc (), glyph.get_baseline () + y - Glyph.yc ());+ } else { + cr.translate (kern + x - glyph.get_lsb () - Glyph.xc (), glyph.get_baseline () + y - Glyph.yc ());+ }+ glyph.draw_layers (cr); cr.restore (); @@ -201,7 +217,11 @@ public class KerningDisplay : FontDisplay { // handle if (first_row && (active_handle == i || selected_handle == i)) {- x2 = x + kern / 2.0;+ if (right_to_left) {+ x2 = x - kern / 2.0;+ } else {+ x2 = x + kern / 2.0;+ } cr.save (); @@ -251,7 +271,11 @@ public class KerningDisplay : FontDisplay { cr.restore (); } - x += w + kern;+ if (right_to_left) {+ x -= w + kern;+ } else {+ x += w + kern;+ } // caption if (g == null || ((!)g).is_empty ()) {@@ -285,7 +309,13 @@ public class KerningDisplay : FontDisplay { } y += row_height + 20;- x = 20;+ + if (right_to_left) {+ x = (allocation.width - 20) / KerningTools.font_size;+ } else { + x = 20;+ }+ first_row = false; if (y > allocation.height) {@@ -776,6 +806,11 @@ public class KerningDisplay : FontDisplay { k = (ex - last_handle_x) / y; // y-axis is for variable precision k /= KerningTools.font_size;++ if (right_to_left) {+ k *= -1;+ } + set_space (selected_handle, k); GlyphCanvas.redraw (); }@@ -793,7 +828,11 @@ public class KerningDisplay : FontDisplay { Glyph glyph = new Glyph.no_lines (""); double fs = KerningTools.font_size; double x = 20;- ++ if (right_to_left) {+ x = (allocation.width - 20) / KerningTools.font_size;+ } + GlyphRange? gr_left, gr_right; Glyph? prev = null;@@ -829,8 +868,12 @@ public class KerningDisplay : FontDisplay { kern = get_kerning_for_pair (((!)prev).get_name (), ((!)g).get_name (), gr_left, gr_right); }- - d = Math.pow (fs * (x + kern) - ex, 2);+ + if (right_to_left) {+ d = Math.pow (fs * (x - kern) - ex, 2);+ } else { + d = Math.pow (fs * (x + kern) - ex, 2);+ } if (d < min) { min = d;@@ -852,7 +895,13 @@ public class KerningDisplay : FontDisplay { } prev = g;- x += w + kern;+ + if (right_to_left) {+ x -= w + kern;+ } else {+ x += w + kern;+ }+ i++; col_index++; }@@ -113,7 +113,8 @@ public class KerningRange : Tool { TextListener listener = new TextListener (t_("Kerning class"), ranges, t_("Set")); listener.signal_text_input.connect ((text) => { set_ranges (text);- Toolbox.redraw_tool_box ();+ KerningTools.classes.clear_cache ();+ KerningTools.classes.redraw (); }); listener.signal_submit.connect (() => {@@ -54,7 +54,12 @@ public class KerningTools : ToolCollection { active_otf_features = new OtfTags (); Expander kerning_tools = new Expander (t_("Kerning Tools"));- classes = new Expander ();+ + if (is_null (classes)) {+ classes = new Expander ();+ update_kerning_classes ();+ }+ expanders = new Gee.ArrayList<Expander> (); Expander font_name = new Expander ();@@ -86,6 +91,7 @@ public class KerningTools : ToolCollection { KerningRange kr = new KerningRange (f, @"$label $(++next_class)"); classes.add_tool (kr); self.set_selected (false);+ classes.clear_cache (); classes.redraw (); }); kerning_tools.add_tool (new_kerning_class);@@ -121,6 +127,15 @@ public class KerningTools : ToolCollection { }); kerning_tools.add_tool (insert_unicode); + Tool right_to_left = new Tool ("right_to_left", t_("Right to left"));+ right_to_left.select_action.connect ((self) => {+ KerningDisplay d = MainWindow.get_kerning_display ();+ d.right_to_left = !d.right_to_left;+ right_to_left.set_selected (d.right_to_left);+ GlyphCanvas.redraw ();+ });+ kerning_tools.add_tool (right_to_left);+ string empty_kerning_text = t_("Open a text file with kerning strings first."); previous_kerning_string = new Tool ("previous_kerning_string", t_("Previous kerning string"));@@ -176,8 +191,8 @@ public class KerningTools : ToolCollection { expanders.add (font_name); expanders.add (zoom_expander); expanders.add (kerning_tools);+ expanders.add (otf_features); expanders.add (classes);- expanders.add (otf_features); } public static void add_otf_label (string tag) {@@ -266,6 +281,9 @@ public class KerningTools : ToolCollection { add_unique_class (kr); } }+ + classes.clear_cache ();+ classes.redraw (); } private static void remove_all_kerning_classes () {@@ -92,29 +92,31 @@ public class LabelTool : Tool { if (is_selected ()) { if (selected_cache == null) {- selected_cache = Screen.create_background_surface ((int) w, (int) h + 2);+ selected_cache = Screen.create_background_surface ((int) (w * Screen.get_scale ()), (int) ((h + 2) * Screen.get_scale ())); Context c = new Context ((!) selected_cache);- c.scale (1 / Screen.get_scale (), 1 / Screen.get_scale ());+ c.scale (Screen.get_scale (), Screen.get_scale ()); draw_tool_surface (c, x, 2, true); } cr.save ();+ cr.scale (1 / Screen.get_scale (), 1 / Screen.get_scale ()); cr.set_antialias (Cairo.Antialias.NONE);- cr.set_source_surface ((!) selected_cache, 0, (int) y - 2);+ cr.set_source_surface ((!) selected_cache, 0, (int) ((y - 2) * Screen.get_scale ())); cr.paint (); cr.restore (); } else { if (deselected_cache == null) {- deselected_cache = Screen.create_background_surface ((int) w, (int) h + 2);+ deselected_cache = Screen.create_background_surface ((int) (w * Screen.get_scale ()), (int) ((h + 2) * Screen.get_scale ())); Context c = new Context ((!) deselected_cache);- c.scale (1 / Screen.get_scale (), 1 / Screen.get_scale ());+ c.scale (Screen.get_scale (), Screen.get_scale ()); draw_tool_surface (c, x, 2, false); } cr.save ();+ cr.scale (1 / Screen.get_scale (), 1 / Screen.get_scale ()); cr.set_antialias (Cairo.Antialias.NONE);- cr.set_source_surface ((!) deselected_cache, 0, (int) y - 2);+ cr.set_source_surface ((!) deselected_cache, 0, (int) ((y - 2) * Screen.get_scale ())); cr.paint (); cr.restore (); }@@ -307,18 +307,22 @@ public class GlyfTable : OtfTable { // save bounding box for head table if (glyf_data.bounding_box_xmin < this.xmin) {+ printd (@"YMin in $(g.get_name ())\n"); this.xmin = glyf_data.bounding_box_xmin; } if (glyf_data.bounding_box_ymin < this.ymin) {+ printd (@"YMin in $(g.get_name ())\n"); this.ymin = glyf_data.bounding_box_ymin; } if (glyf_data.bounding_box_xmax > this.xmax) {+ printd (@"XMax in $(g.get_name ())\n"); this.xmax = glyf_data.bounding_box_xmax; } if (glyf_data.bounding_box_ymax > this.ymax) {+ printd (@"YMax in $(g.get_name ())\n"); this.ymax = glyf_data.bounding_box_ymax; } @@ -161,7 +161,7 @@ public class HmtxTable : OtfTable { } if (extent < 0) {- warning ("Negative extent.");+ warning (@"Negative extent in $(gc.get_name ())."); } advance_width[nmetrics] = (uint16) extent;@@ -34,11 +34,26 @@ public class OtfFeatureTable : Table { Gee.ArrayList<AlternateItem> undo_items; // FIXME: implement redo + bool ignore_input = false;+ public OtfFeatureTable (GlyphCollection? gc) { glyph_collection = gc; undo_items = new Gee.ArrayList<AlternateItem> (); } + public override void selected_canvas () {+ ignore_input = true; // make sure that tripple clicks in overview are ignored++ TimeoutSource input_delay = new TimeoutSource (250);+ input_delay.set_callback(() => {+ ignore_input = false;+ return false;+ });+ input_delay.attach (null);+ + base.selected_canvas ();+ }+ public override Gee.ArrayList<Row> get_rows () { return rows; }@@ -49,6 +64,10 @@ public class OtfFeatureTable : Table { String s; AlternateItem a; + if (ignore_input) {+ return;+ }+ if (row_index == SOURCE_GLYPH) { GlyphSelection gs = new GlyphSelection (); @@ -1112,6 +1112,7 @@ public class OverView : FontDisplay { f.alternates = previous_collection.alternate_sets.copy (); undo_items.remove_at (undo_items.size - 1);+ update_item_list (); GlyphCanvas.redraw (); } @@ -153,8 +153,8 @@ public class Svg { EditPoint middle; double x, y; - x = start.get_right_handle ().x + (end.get_left_handle ().x - start.get_right_handle ().x);- y = start.get_right_handle ().y + (end.get_left_handle ().y - start.get_right_handle ().y);+ x = start.get_right_handle ().x + (end.get_left_handle ().x - start.get_right_handle ().x) / 2;+ y = start.get_right_handle ().y + (end.get_left_handle ().y - start.get_right_handle ().y) / 2; middle = new EditPoint (x, y, PointType.QUADRATIC); middle.right_handle = end.get_left_handle ().copy ();new file mode 100755@@ -0,0 +1,37 @@+#!/usr/bin/python3+import version+from optparse import OptionParser++parser = OptionParser()+parser.add_option('-f', '--free', dest='free', action="store_true", help="generate non-commercial version")+(options, args) = parser.parse_args()++template = open('./scripts/snapcraft.yaml', 'r')+yaml = template.read();++if options.free:+ v = version.VERSION + "-free"+else:+ v = version.VERSION++yaml = yaml.replace("VERSION", v)++make_script = open('./build/snapsource/birdfont/Makefile', 'w+')+make_script.write("#Don't edit, the file is generated by a script\n")+make_script.write("all:\n")++if options.free:+ make_script.write ("\t./configure --valac-flags=\"-D FREE\"\n")+else:+ make_script.write ("\t./configure\n")++make_script.write("\t./build.py\n")+make_script.write("""++install:+ ./install.py -d $(DESTDIR)+""")++build_script = open('./build/snapcraft.yaml', 'w+')+build_script.write(yaml)+new file mode 100755@@ -0,0 +1,27 @@+#!/bin/sh++if ! git diff --exit-code > /dev/null; then+ echo "Uncommitted changes, commit before creating the release."+ exit 1+fi++SOURCE_DIR="$(pwd)"++rm -rf $SOURCE_DIR/build/snapsource+mkdir -p $SOURCE_DIR/build/snapsource && \+cd $SOURCE_DIR/build/snapsource && \+git clone --depth=1 file:///$SOURCE_DIR birdfont && \+cd $SOURCE_DIR/build/snapsource/birdfont && \+python3 ./scripts/complete_translations.py -t 93 -i && \+cd .. && \+cd .. && \+mkdir -p setup/gui && \+cp ../resources/linux/256x256/birdfont.png setup/gui/icon.png && \+cd .. && \+./scripts/snap.py --free && \+cd build && \+snapcraft snap && \+cd .. && \+./scripts/snap.py && \+cd build && \+snapcraft snapnew file mode 100644@@ -0,0 +1,26 @@+name: birdfont+version: VERSION+summary: Font editor+description: A font edior which can create TTF, EOT and SVG fonts+confinement: strict++build-packages: [valac, python3, libglib2.0-dev, libgtk-3-dev,+ libwebkit2gtk-3.0-dev, libgee-0.8-dev, libnotify-dev, libsqlite3-dev, + libxmlbird-dev, python-pkg-resources]++apps: + run: + command: birdfont+ plugs: [home, gsettings, x11, unity7]++parts: + birdfont: + plugin: make+ source: snapsource/birdfont+ stage-packages:+ - libglib2.0-0+ - libwebkit2gtk-3.0-25+ - libgee-0.8-2+ - libnotify4+ - libsqlite3-0+ - libxmlbird1@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. """ -VERSION = '2.16.5'+VERSION = '2.16.7' SO_VERSION_MAJOR = '36' SO_VERSION_MINOR = '0' SO_VERSION = SO_VERSION_MAJOR + '.' + SO_VERSION_MINOR