Clone in a terminal:
Commit 8eeace3
Johan Mattsson - 2022-02-10T17:50:09+00:00
8eeace35db7d4b291170642498161faf95448c4ejohan.mattsson.m@gmail.com

Make sure only one copy of a background image is stored in the font file

Changed files (2)

Diff

diff --git a/NEWS b/NEWSindex 3b87e6f..35f1811 100644--- a/NEWS+++ b/NEWS@@ -1,6 +1,7 @@ birdfont (2.30.0) stable;    * Smaller .birdfont files+  * Make sure only one copy of a background image is stored in the font file.   -- Johan Mattsson <johan.mattsson.m@gmail.com>  Tue Feb  8 03:03:27 CET 2022 diff --git a/libbirdfont/BirdFontFile.vala b/libbirdfont/BirdFontFile.valaindex 1092a7b..9234c4a 100644--- a/libbirdfont/BirdFontFile.vala+++ b/libbirdfont/BirdFontFile.vala@@ -24,12 +24,14 @@ class BirdFontFile : GLib.Object { 	Font font; 	 	public const int FORMAT_MAJOR = 2;-	public const int FORMAT_MINOR = 2;+	public const int FORMAT_MINOR = 3; 	 	public const int MIN_FORMAT_MAJOR = 0; 	public const int MIN_FORMAT_MINOR = 0;  	public bool has_svg_glyphs = false;	++	Gee.ArrayList<string> written_images = new Gee.ArrayList<string> (); 		 	public BirdFontFile (Font f) { 		font = f;@@ -252,6 +254,16 @@ class BirdFontFile : GLib.Object { 	} 	 	public void write_image (DataOutputStream os, string sha1, string data) throws GLib.Error {+		if (written_images.contains (sha1)) {+			warning ("Font file already contains " + sha1);+			return;+		}++		if (sha1 == "" || data == "") {+			warning ("No data in background image.");+			return;+		}+		 		os.put_string (@"<background-image sha1=\""); 		os.put_string (sha1); 		os.put_string ("\" ");

Contact

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