The Birdfont Source Code


All Repositories / birdfont.git / commitdiff – RSS feed

Set canvas size

These changes was commited to the Birdfont repository Thu, 26 Mar 2015 07:17:56 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
[Thu, 26 Mar 2015 07:17:56 +0000]

Updated Files

libbirdfont/Glyph.vala
libbirdfont/Path.vala
libbirdfont/PointConverter.vala
libbirdfont/SpacingTab.vala
--- a/libbirdfont/Glyph.vala +++ b/libbirdfont/Glyph.vala @@ -102,6 +102,9 @@ /** Cache for Cairo rendering */ HashMap<string, Surface> glyph_cache = new HashMap<string, Surface> (); + + public const double CANVAS_MIN = -10000; + public const double CANVAS_MAX = 10000; public Glyph (string name, unichar unichar_code = 0) { this.name = name; @@ -195,15 +198,16 @@ return false; } - x1 = double.MAX; - x2 = double.MIN; - y1 = double.MAX; - y2 = double.MIN; + x1 = CANVAS_MAX; + x2 = CANVAS_MIN; + y1 = CANVAS_MAX; + y2 = CANVAS_MIN; foreach (Path p in path_list) { p.update_region_boundaries (); - - if (p.points.size > 0) { + + if (p.points.size > 1) { + if (p.xmin < x1) { x1 = p.xmin; } @@ -493,9 +497,6 @@ double x1, y1, x2, y2; if (boundaries (out x1, out y1, out x2, out y2)) { - if (get_name () == "g") { - print (@"G: $right_limit - $x2 left_limit - x2\n"); - } return right_limit - x2; } else { return right_limit - left_limit;
--- a/libbirdfont/Path.vala +++ b/libbirdfont/Path.vala @@ -1968,10 +1968,10 @@ return; } - minx = double.MAX; - miny = double.MAX; - maxx = double.MIN; - maxy = double.MIN; + minx = Glyph.CANVAS_MAX; + miny = Glyph.CANVAS_MAX; + maxx = Glyph.CANVAS_MIN; + maxy = Glyph.CANVAS_MIN; x0 = 0; y0 = 0;
--- a/libbirdfont/PointConverter.vala +++ b/libbirdfont/PointConverter.vala @@ -145,8 +145,8 @@ return; } - max_d = double.MIN; - min_d = double.MAX; + max_d = Glyph.CANVAS_MIN; + min_d = Glyph.CANVAS_MAX; Path.all_of (a0, a1, (xa, ya, ta) => { min_d = double.MAX;
--- a/libbirdfont/SpacingTab.vala +++ b/libbirdfont/SpacingTab.vala @@ -218,7 +218,7 @@ l = text_input_glyph.get_left_side_bearing (); - if (Math.fabs (r) < 0.001) { + if (Math.fabs (l) < 0.001) { l = 0; }