Clone in a terminal:
Commit 3607be1
Johan Mattsson - 2016-10-22T11:08:24+00:00
3607be16e7430d40192e8a4d28174f8eb35e9b2bjohan.mattsson.m@gmail.com

Point flags

Changed files (9)

Diff

diff --git a/libbirdfont/ColorPicker.vala b/libbirdfont/ColorPicker.valaindex 8f3e1a9..f8eb4d8 100644--- a/libbirdfont/ColorPicker.vala+++ b/libbirdfont/ColorPicker.vala@@ -147,7 +147,7 @@ public class ColorPicker : Tool { 	public Color get_fill_color () { 		return fill_color; 	}-		+	 	public override void draw_tool (Context cr, double px, double py) { 		draw_bars (cr, px, py); 		draw_dial (cr, px, py, 0, hue);diff --git a/libsvgbird/Doubles.vala b/libsvgbird/Doubles.valaindex 56b7444..2627cf1 100644--- a/libsvgbird/Doubles.vala+++ b/libsvgbird/Doubles.vala@@ -53,7 +53,7 @@ public class Doubles : GLib.Object { 		data[index].value = p; 	} -	public void set_type (int index, uchar t) {+	public void set_type (int index, uint32 t) { 		if (unlikely (index < 0)) { 			warning ("index < 0"); 			return;@@ -72,7 +72,7 @@ public class Doubles : GLib.Object { 		data[index].value = p; 	} 	-	public void insert_type (int index, uchar p) {+	public void insert_type (int index, uint32 p) { 		insert_element (index);  		data[index].type = p; 	}@@ -137,7 +137,7 @@ public class Doubles : GLib.Object { 		capacity = new_capacity;		 	} -	public void add_type (uchar type) {+	public void add_type (uint32 type) { 		if (size >= capacity) { 			increase_capacity (); 		}@@ -179,7 +179,7 @@ public class Doubles : GLib.Object { 		return data[index].value; 	} -	public uchar get_point_type (int index) {+	public uint32 get_point_type (int index) { 		if (unlikely (index < 0)) { 			warning ("index < 0"); 			return 0;@@ -193,6 +193,20 @@ public class Doubles : GLib.Object { 		return data[index].type; 	} 	+	public void set_point_type (int index, uint32 type) {+		if (unlikely (index < 0)) {+			warning ("index < 0");+			return;+		}++		if (unlikely (index >= size)) {+			warning ("index >= size");+			return;+		}+		+		data[index].type = type;+	}+	 	public string get_string (int i) { 		return round (get_double (i)); 	}diff --git a/libsvgbird/Gradient.vala b/libsvgbird/Gradient.valaindex 5b3109e..aa1b166 100644--- a/libsvgbird/Gradient.vala+++ b/libsvgbird/Gradient.vala@@ -30,6 +30,15 @@ public abstract class Gradient : GLib.Object { 		stops = new Gee.ArrayList<Stop> (); 		transforms = new SvgTransforms (); 	}++	public Stop get_stop (int index) {+		if (unlikely (index < 0 || index >= stops.size)) {+			warning ("Stop index out of bounds");+			return new Stop ();+		}+		+		return stops.get (index);+	} 	 	public void copy_stops (Gradient g) { 		foreach (Stop stop in g.stops) {diff --git a/libsvgbird/PointValue.vala b/libsvgbird/PointValue.valaindex 2d9e62b..7fa8231 100644--- a/libsvgbird/PointValue.vala+++ b/libsvgbird/PointValue.vala@@ -14,9 +14,12 @@  namespace SvgBird { -public static const uchar POINT_NONE = 0;-public static const uchar POINT_ARC = 1;-public static const uchar POINT_CUBIC = 2;-public static const uchar POINT_LINE = 3;+public static const uint32 POINT_NONE = 0;+public static const uint32 POINT_ARC = 1;+public static const uint32 POINT_CUBIC = 1 << 1;+public static const uint32 POINT_LINE = 1 << 2;+public static const uint32 POINT_NEXT_LINE = 1 << 3;+public static const uint32 POINT_PREVIOUS_LINE = 1 << 4;+public static const uint32 POINT_TYPE = POINT_ARC | POINT_CUBIC | POINT_LINE;  }diff --git a/libsvgbird/Points.vala b/libsvgbird/Points.valaindex b4307b6..5757c47 100644--- a/libsvgbird/Points.vala+++ b/libsvgbird/Points.vala@@ -28,7 +28,7 @@ public class Points : GLib.Object { 		} 	} 	-	public void set_type (int index, uchar p) {+	public void set_type (int index, uint32 p) { 		point_data.set_type (index, p); 	} 	@@ -36,7 +36,7 @@ public class Points : GLib.Object { 		point_data.set_double (index, p); 	} -	public void insert_type (int index, uchar t) {+	public void insert_type (int index, uint32 t) { 		point_data.insert_type (index, t); 	} 	@@ -48,7 +48,7 @@ public class Points : GLib.Object { 		point_data.add (p); 	} 	-	public void add_type (uchar type) {+	public void add_type (uint32 type) { 		point_data.add_type (type); 	} @@ -113,9 +113,13 @@ public class Points : GLib.Object { 		return point_data.get_double (index); 	} -	public uchar get_point_type (int index) {+	public uint32 get_point_type (int index) { 		return point_data.get_point_type (index); 	}+	+	public void set_point_type (int index, uint32 type) {+		point_data.set_point_type (index, type);+	}  	public void all (LineIterator iter) { 		double previous_x;diff --git a/libsvgbird/SvgPath.vala b/libsvgbird/SvgPath.valaindex b9895ba..44c812b 100644--- a/libsvgbird/SvgPath.vala+++ b/libsvgbird/SvgPath.vala@@ -94,7 +94,7 @@ public class SvgPath : Object { 		return_if_fail (size % 8 == 0); 		return_if_fail (size >= 8); 		-		switch (path.get_point_type (0)) {+		switch (path.get_point_type (0) & POINT_TYPE) { 		case POINT_ARC: 			x = path.get_double (6); 			y = path.get_double (7);@@ -120,7 +120,7 @@ public class SvgPath : Object { 		return_if_fail (size % 8 == 0); 	 		for (int i = 0; i < size; i += 8) {-			switch (points[i].type) {+			switch (points[i].type & POINT_TYPE) { 			case POINT_ARC:		 				draw_arc (cr, points[i + 1].value, points[i + 2].value, 					points[i + 3].value, points[i + 4].value,diff --git a/libsvgbird/point_value.h b/libsvgbird/point_value.hindex a571df1..1648dbb 100644--- a/libsvgbird/point_value.h+++ b/libsvgbird/point_value.h@@ -19,7 +19,7 @@  typedef union { 	gdouble value;-	guchar type;+	guint32 type; } SvgBirdPointValue;  #endifdiff --git a/resources/icons.bf b/resources/icons.bfindex f7fa88b..da9bce2 100644--- a/resources/icons.bf+++ b/resources/icons.bf@@ -1651,6 +1651,16 @@ GNU Lesser General Public License</copyright> 	</glyph> </collection> +<collection name="translate">+	<selected id="0"/>+	<glyph id="0" left="-28" right="28">+		<layer name= "Layer" visible="true">+			<path data="B -8.7490642589,49.3988532131 C -6.3869401212,50.3651767240 -4.3469238204,50.1504381663 -1.4479532876,48.9693760972 T C 1.2293855707,47.8786084141 3.0615564298,44.4598663798 -0.1595219398,43.9230199847 T C -3.3806003095,43.3861735897 -7.6753714690,47.6809447493 -8.7490642589,49.3988532131" />+			<path data="B -20.0228385528,33.5081999227 C -14.2248974874,34.8324210304 -6.1722015632,36.4071704554 -2.6290153565,37.4808632453 T C 0.9141708501,38.5545560352 8.3226511004,41.1314187310 9.6110824483,41.1314187310 T C 10.8995137961,41.1314187310 13.5837457707,41.7756344048 14.8721771186,40.3798337780 T C 16.1606084666,38.9840331512 17.3416705355,38.9840331511 8.7521282163,37.3734939663 T C 0.1625858972,35.7629547815 2.7394485929,36.0134830991 -0.2668912188,35.3334776655 M 2.3099714770,33.0787228069 C 1.5583865241,31.0387065061 0.1625858972,21.9123177920 -1.1258454507,18.1543930272 C 3.3120847475,15.2912122543 6.8194811945,11.2827591720 12.1879451440,9.5648507082 T C 17.7862147007,7.7734044500 21.5648621756,7.4890446477 26.2533206915,6.4511416175 C 22.4953959270,4.3037560377 23.7838272747,4.6258638747 13.2616379339,3.5521710848 T C 8.0179209976,3.0170979280 2.5247100350,11.4974977300 -2.8437539145,15.4701610526 C -3.7027081464,13.7522525888 -6.2541544206,11.0696298246 -10.4669727228,9.3501121502 T C -15.7280673932,7.2027265704 -22.0628548536,7.0953572913 -25.3913025023,7.6322036864 C -20.8102132654,9.1353735921 -15.2988717451,10.5981041010 -13.6880510924,11.6048670090 T C -10.2522341648,13.7522525888 -7.0311557951,16.2217460054 -5.5279858892,19.2280858171 M -12.6143583025,26.4218275094 M -15.8354366722,28.0323666944 C -15.7280673932,28.3186847717 -14.6543746033,29.3207980421 -13.0438354185,29.4281673211 T C -11.8850313613,29.5054209250 -11.3259269547,28.6765823683 -9.2859106539,26.5291967884 T C -8.2992874836,25.4906460827 -5.4206166103,22.9860105819 -4.5616623783,21.8049485130 C -3.7027081464,23.7375955348 -3.4879695884,24.8112883247 -2.9511231935,27.2807817413 T C -2.0107080383,31.6066914556 -2.4142767986,34.7966312706 -3.4879695884,35.1187391077 M -15.2985902773,32.4345071328 C -16.4080728268,32.3271378538 -18.4122993678,31.6829221800 -18.6270379259,32.1123992960 T C -18.8417764839,32.5418764118 -19.5575716772,33.0429330471 -20.0228385528,33.5081999227" />+		</layer>+	</glyph>+</collection>+ <collection name="ttf_units"> 	<selected id="1"/> 	<glyph id="1" left="-28" right="33.862433862433868">@@ -1883,6 +1893,7 @@ GNU Lesser General Public License</copyright> <ligature sequence="h e l p _ l i n e s" replacement="help_lines"/> <ligature sequence="l e f t _ a r r o w" replacement="left_arrow"/> <ligature sequence="c l o s e _ p a t h" replacement="close_path"/>+<ligature sequence="t r a n s l a t e" replacement="translate"/> <ligature sequence="t r a n s f o r m" replacement="transform"/> <ligature sequence="a d d _ l a y e r" replacement="add_layer"/> <ligature sequence="o p e n _ f o n t" replacement="open_font"/>diff --git a/svgbirdpoint.vapi b/svgbirdpoint.vapiindex 55c9a0c..c80e635 100644--- a/svgbirdpoint.vapi+++ b/svgbirdpoint.vapi@@ -2,7 +2,7 @@ namespace SvgBird {  [CCode (cheader_filename="point_value.h")] public extern struct PointValue {-    uchar type;+    uint32 type;     double value; } 

Contact

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