Clone in a terminal:
Commit de5dfd9
Johan Mattsson - 2012-09-03T20:16:37+00:00
de5dfd98e58c5eac6a03316f83a862e37df91736johan.mattsson.m@gmail.com

build libbirdfont.dll

Changed files (5)

Diff

diff --git a/src/ExportTool.vala b/src/ExportTool.valaindex 8391f14..ed43eef 100644--- a/src/ExportTool.vala+++ b/src/ExportTool.vala@@ -349,21 +349,26 @@ os.put_string (""" 		OpenFontFormatWriter fo; 		Font temp_font = new Font (); 		unowned Thread<void*> th;-		File file;+		File ttf_file;+		File eot_file; 		string temp_file;  		try { 			// create a copy of current font and use it in a separate  			// export thread 			temp_file = current_font.save_backup ();-			file = folder.get_child (current_font.get_name () + ".ttf");+			ttf_file = folder.get_child (current_font.get_name () + ".ttf");+			eot_file = folder.get_child (current_font.get_name () + ".eot"); -			if (file.query_exists ()) {-				file.delete ();+			if (ttf_file.query_exists ()) {+				ttf_file.delete (); 			} -			path = (!) file.get_path ();-			export_thread = new ExportThread (temp_file, path);+			if (eot_file.query_exists ()) {+				eot_file.delete ();+			}+			+			export_thread = new ExportThread (temp_file, (!) ttf_file.get_path (), (!) eot_file.get_path ());  			try { 				th = Thread.create<void*> (export_thread.run, true);@@ -418,36 +423,53 @@ os.put_string ("""  	class ExportThread { -		private string from;-		private string to;+		private string ffi;+		private string ttf;+		private string eot; -		public ExportThread (string from, string to) {-			this.from = from;-			this.to = to;+		public ExportThread (string ffi, string ttf, string eot) {+			this.ffi = ffi;+			this.ttf = ttf;+			this.eot = eot; 		}  		public void* run () {+			assert (!is_null (ffi));+			assert (!is_null (ttf));+			assert (!is_null (eot));+			+			write_ttf ();+			write_eof ();+			+			return null;+		}+		+		void write_ttf () { 			OpenFontFormatWriter fo = new OpenFontFormatWriter (); 			Font f = new Font (); 			-			assert (!is_null (from));-			assert (!is_null (to));-			 			try {-				if (!f.load (from, false)) {-					warning (@"Can't read $from");-					return null;+				if (!f.load (ffi, false)) {+					warning (@"Can't read $ffi"); 				} 				-				fo.open ((!) File.new_for_path (to));+				fo.open ((!) File.new_for_path (ttf)); 				fo.write_ttf_font (f); 				fo.close (); 			} catch (Error e) { 				critical (@"$(e.message)");-				return null;-			}	+			}+		}+		+		void write_eof () {+			EotWriter fo = new EotWriter (ttf, eot);+			Font f = new Font (); 			-			return null;+			try {+				fo.write ();+			} catch (Error e) {+				critical (@"$(e.message)");+			} 		} 	} 	diff --git a/src/OpenFontFormatReader.vala b/src/OpenFontFormatReader.valaindex b7209bc..7bc73b2 100644--- a/src/OpenFontFormatReader.vala+++ b/src/OpenFontFormatReader.vala@@ -48,8 +48,9 @@ errordomain BadFormat {  class OpenFontFormatReader : Object { 	-	OtfInputStream dis; 	DirectoryTable directory_table;+	+	OtfInputStream dis; 	File file; 	 	public OpenFontFormatReader () {@@ -120,5 +121,9 @@ class OpenFontFormatReader : Object { 	public unowned List<string> get_all_names () { 		return directory_table.post_table.get_all_names (); 	}+	+	public uint32 get_head_checksum () {+		return directory_table.head_table.get_adjusted_checksum ();+	} } }diff --git a/src/OpenFontFormatWriter.vala b/src/OpenFontFormatWriter.valaindex 3eaa44e..3a33c02 100644--- a/src/OpenFontFormatWriter.vala+++ b/src/OpenFontFormatWriter.vala@@ -2106,6 +2106,10 @@ class HeadTable : Table { 		id = "head";
 	}
 	
+	public uint32 get_adjusted_checksum () {
+		return adjusted_checksum;
+	}
+	
 	public double get_units_per_em () {
 		return units_per_em * 10; // Fixa: we can refactor this number
 	}
diff --git a/src/wscript b/src/wscriptindex b83ff78..f284220 100644--- a/src/wscript+++ b/src/wscript@@ -4,6 +4,7 @@ BIRDFONT = [ 	'BackgroundTool.vala',
 	'BackgroundSelection.vala',
 	'Birdfont.vala',
+	'EotWriter.vala',
 	'ExportTool.vala',
 	'FontDisplay.vala',
 	'CharDatabase.vala',
diff --git a/win32/wscript b/win32/wscriptindex 361d3d6..fa9eb4e 100644--- a/win32/wscript+++ b/win32/wscript@@ -99,6 +99,7 @@ def build(bld): 		$(i686-w64-mingw32-pkg-config --cflags --libs webkit-1.0) && mv *.o win32/""", source="../build/src/Supplement.c", target="./Supplement.o", name="mingw compile", always=True); 	 	bld(rule="""i686-w64-mingw32-gcc \+		-shared \ 		./win32/*.o \ 		./icon.res \ 		-s \@@ -108,7 +109,24 @@ def build(bld): 		-static -B static -lintl.dll -B static -l glib-2.0.dll -B static -l xml2.dll  \ 		-B static -lgio-2.0.dll -B static -l soup-2.4.dll \ 		-B static -l webkitgtk-1.0.dll  -B static -lgtk-win32-2.0.dll -B static -lgdk-win32-2.0.dll -B static -latk-1.0.dll -B static -lgio-2.0.dll -B static -lpangowin32-1.0.dll -B static -lpangocairo-1.0.dll -B static -lgdk_pixbuf-2.0.dll -B static -lpango-1.0.dll -B static -lcairo.dll -B static -lgobject-2.0.dll -B static -lgmodule-2.0.dll -B static -lgthread-2.0.dll -B static -lglib-2.0.dll \-		-static -o birdfont.exe""", source="../build/src/Supplement.c", target="../birdfont.exe", depends_on=['mingw compile', 'icon'], name="mingw link", always=True)+		-static -o libbirdfont.dll""", source="../build/src/Supplement.c", target="../libbirdfont.dll", depends_on=['mingw compile', 'icon'], name="mingw link shared", always=True)+	+	bld(rule="""i686-w64-mingw32-ar rcs libbirdfont.dll.a win32/*.o""", name="mingw link static", depends_on="mingw link shared")++	bld(rule="""i686-w64-mingw32-gcc \+		-shared \+		./win32/*.o \+		./icon.res \+		-s \+		-Wl,-subsystem,windows \+		-mthreads \+		-L./ \+		-L/usr/i686-w64-mingw32/sys-root/mingw/lib \+		-static -B -static -l birdfont.dll \+		-static -B static -lintl.dll -B static -l glib-2.0.dll -B static -l xml2.dll  \+		-B static -lgio-2.0.dll -B static -l soup-2.4.dll \+		-B static -l webkitgtk-1.0.dll  -B static -lgtk-win32-2.0.dll -B static -lgdk-win32-2.0.dll -B static -latk-1.0.dll -B static -lgio-2.0.dll -B static -lpangowin32-1.0.dll -B static -lpangocairo-1.0.dll -B static -lgdk_pixbuf-2.0.dll -B static -lpango-1.0.dll -B static -lcairo.dll -B static -lgobject-2.0.dll -B static -lgmodule-2.0.dll -B static -lgthread-2.0.dll -B static -lglib-2.0.dll \+		-static -o birdfont.exe""", source="../build/src/Supplement.c", target="../birdfont.exe", depends_on=['mingw link shared', 'icon'], name="mingw link", always=True)  	if bld.options.installer: 		copy_runtime_dependencies (bld)@@ -261,6 +279,8 @@ def copy_runtime_dependencies (bld): 	MINGW_BIN = MINGW + "/bin"  	bld(rule="mv birdfont.exe supplement/", depends_on='mingw link', always=True)+	bld(rule="mv libbirdfont.dll supplement/", depends_on='mingw link', always=True)+ 	bld(rule="cp ../README supplement/") 	bld(rule="cp ../COPYING supplement/") 	bld(rule="cp ../NEWS supplement/")

Contact

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