Commit f43310d
Fix boundaries in conversion from SVG an remove old code
Changed files (9)
modifiedlibbirdfont/ClipTool.valamodifiedlibbirdfont/ExportTool.valamodifiedlibbirdfont/Font.valamodifiedlibbirdfont/KerningDisplay.valamodifiedlibbirdfont/KerningTools.valamodifiedlibbirdfont/LayerLabel.valamodifiedlibbirdfont/MoveTool.valamodifiedlibbirdfont/OpenFontFormat/GlyfData.valamodifiedlibbirdfont/SvgParser.vala
Diff
@@ -13,6 +13,7 @@ */ using SvgBird;+using B; namespace BirdFont { @@ -201,12 +202,12 @@ public class ClipTool : Tool { s.append (@"$(gc.get_current ().right_limit)"); s.append ("\n"); - foreach (SvgBird.Object obejct in gc.get_current ().get_visible_objects ()) {- if (obejct is Path) {+ foreach (SvgBird.Object object in gc.get_current ().get_visible_objects ()) {+ if (object is Path) { Path path = (Path) object; add_birdfont_path (s, path); } else if (object is EmbeddedSvg) {- EmbeddedSvg svg = (EmbeddedSvg) object:+ EmbeddedSvg svg = (EmbeddedSvg) object; add_birdfont_svg (s, svg); } }@@ -330,7 +331,7 @@ public class ClipTool : Tool { return s.str; } - public void add_birdfont_svg (StringBuilder s, EmbeddedSvg svg) {+ public static void add_birdfont_svg (StringBuilder s, EmbeddedSvg svg) { s.append ("BF svg: "); string svg_data = svg.svg_data.replace ("\n", " "); svg_data = svg_data.replace ("\r", "");@@ -338,7 +339,7 @@ public class ClipTool : Tool { s.append ("\n"); } - public void add_birdfont_path (StringBuilder s, Path path) {+ public static void add_birdfont_path (StringBuilder s, Path path) { s.append ("BF path: "); s.append (BirdFontFile.get_point_data (path)); s.append ("\n");@@ -482,23 +482,6 @@ os.put_string ( return (!) d; } - static bool can_write (File folder) {- File test = get_child (folder, "text.tmp");- bool writable = false;- - try {- writable = FileUtils.set_contents (test.get_path (), "test");- - if (writable) {- FileUtils.remove (test.get_path ());- }- } catch (GLib.Error e) {- writable = false;- }- - return writable;- }- public static File get_export_dir () { return File.new_for_path (get_export_folder ()); }@@ -187,18 +187,7 @@ public class Font : GLib.Object { ~Font () { font_deleted (); }--<<<<<<< HEAD-=======- public string? get_export_directory () {-#if MAC- return export_directory;-#else- return get_path ();-#endif- } ->>>>>>> 94139878f182ed4647645f72572bd764efff51f7 public bool has_svg_glyph () { for (int glyph_index = 0; glyph_index < glyph_name.length (); glyph_index++) { GlyphCollection gc = glyph_name.nth (glyph_index);@@ -50,8 +50,6 @@ public class KerningDisplay : FontDisplay { WidgetAllocation allocation = new WidgetAllocation (); - TextArea description; - public KerningDisplay () { GlyphSequence w = new GlyphSequence (); rows = new Gee.ArrayList <GlyphSequence> ();@@ -129,9 +129,8 @@ public class KerningTools : ToolCollection { 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);+ KerningDisplay.right_to_left = !KerningDisplay.right_to_left;+ right_to_left.set_selected (KerningDisplay.right_to_left); GlyphCanvas.redraw (); }); kerning_tools.add_tool (right_to_left);@@ -28,8 +28,6 @@ public class LayerLabel : Tool { /** Add margin when layer is moves. */ bool active_layer = false; - static TextArea? help_text_hide = null;- public LayerLabel (Layer layer) { base (); @@ -564,6 +564,7 @@ public class MoveTool : Tool { foreach (Path path in path_list.paths) { path.move (svg.x - glyph.left_limit, svg.y - font.top_limit);+ path.update_region_boundaries(); } } }@@ -57,7 +57,6 @@ public class GlyfData : GLib.Object { } public GlyfData (Glyph g) {- bool process; PathList all_quadratic = g.get_quadratic_paths (); PathList qp = new PathList (); @@ -149,7 +148,6 @@ public class GlyfData : GLib.Object { end_points.clear (); end_point = 0; - int path_number = 0; foreach (Path quadratic in paths) { if (unlikely (quadratic.points.size == 0)) { warning (@"No points in path (before conversion $(quadratic.points.size))");@@ -463,85 +463,6 @@ public class SvgParser { h.x += glyph.left_limit; } -- private void matrix (string function, PathList pl) {- string parameters = get_transform_parameters (function);- string[] p = parameters.split (" ");-- if (p.length != 6) {- warning ("Expecting six parameters for matrix transformation.");- return;- }-- foreach (Path path in pl.paths) {- apply_matrix (path, parse_double (p[0]), parse_double (p[1]), - parse_double (p[2]), parse_double (p[3]), - parse_double (p[4]), parse_double (p[5]));- }- }- - private void scale (string function, PathList pl) {- string parameters = get_transform_parameters (function);- string[] p = parameters.split (" ");- double x, y;- - x = 1;- y = 1;- - if (p.length > 0) {- x = parse_double (p[0]);- }- - if (p.length > 1) {- y = parse_double (p[1]);- }- - foreach (Path path in pl.paths) {- path.scale (-x, y);- }- }- - private void translate (string function, PathList pl) {- string parameters = get_transform_parameters (function);- string[] p = parameters.split (" ");- double x, y;- - x = 0;- y = 0;- - if (p.length > 0) {- x = parse_double (p[0]);- }- - if (p.length > 1) {- y = parse_double (p[1]);- }- - foreach (Path path in pl.paths) {- path.move (x, -y);- }- }-- private string get_transform_parameters (string function) {- int i;- string param = "";- - i = function.index_of ("(");- return_val_if_fail (i != -1, param);- param = function.substring (i);-- param = param.replace ("(", "");- param = param.replace ("\n", " ");- param = param.replace ("\t", " ");- param = param.replace (",", " ");- - while (param.index_of (" ") > -1) {- param = param.replace (" ", " ");- }- - return param.strip(); - }- private void parse_circle (XmlElement tag, Layer pl) { Path p; double x, y, r;