Clone in a terminal:
Commit 9ff93c4
Johan Mattsson - 2012-10-21T12:06:34+00:00
9ff93c43baa640ee4a649a6a416fe05d736d89b1johan.mattsson.m@gmail.com

update preview hack for windows and wine

Changed files (3)

Diff

diff --git a/src/Birdfont.vala b/src/Birdfont.valaindex 881cb52..fc275c9 100644--- a/src/Birdfont.vala+++ b/src/Birdfont.vala@@ -24,7 +24,7 @@ static void print_export_help (string[] arg) { 	stdout.printf (" [OPTION ...] FILE\n"); 	stdout.printf ("-h, --help                      print this message\n"); 	stdout.printf ("-o, --output [DIRECTORY]        write files to this directory\n");-	stdout.printf ("-s, --svg                       write file\n");+	stdout.printf ("-s, --svg                       write svg file\n"); 	stdout.printf ("-t, --ttf                       write ttf and eot files\n"); 	stdout.printf ("\n"); }diff --git a/src/GtkWindow.vala b/src/GtkWindow.valaindex 5f6e9af..63d5f31 100644--- a/src/GtkWindow.vala+++ b/src/GtkWindow.vala@@ -88,19 +88,51 @@ public class GtkWindow : Gtk.Window, NativeWindow { 					layout_uri = layout_dir.get_child (fd.get_html_file ()); 					uri = fd.path_to_uri ((!) layout_uri.get_path ()); 				}--				if (fd.get_name () == "Preview") {-					ExportTool.export_all ();-				} 				 				if (fd.get_html () == "") {-					html_canvas.load_html_string ("<html></html>", "file:///");	-					html_canvas.reload_bypass_cache ();-					-					html_canvas.load_uri (uri);-					html_canvas.reload_bypass_cache ();-					html_canvas.load_uri (uri); 					+					// this hack forces webkit to reload the font and ignore cached data+					// it's only required on windows platform and in wine+					//+					// webkit will crash if the loaded file is updated with export_all+					//+					if (Supplement.win32) {+						html_canvas.load_uri (uri);+						+						TimeoutSource loadscreen = new TimeoutSource(300);+						loadscreen.set_callback(() => {+							html_canvas.load_html_string ("<html>Loading ...</html>", "file:///");+							html_box.set_visible (n);+							glyph_canvas_area.set_visible (!n);+							+							if (fd.get_name () == "Preview") {+								ExportTool.export_all ();+							}+						+							return false;+						});+						loadscreen.attach(null);+						+						TimeoutSource update = new TimeoutSource(2000);						+						update.set_callback(() => {+							html_canvas.load_uri (uri);+							return false;+						});+						update.attach(null);++					} else {++						if (fd.get_name () == "Preview") {+							ExportTool.export_all ();+						}+				+						html_canvas.load_html_string ("<html></html>", "file:///");	+						html_canvas.reload_bypass_cache ();+						+						html_canvas.load_uri (uri);+						html_canvas.reload_bypass_cache ();+						html_canvas.load_uri (uri);+					} 				} else { 					html_canvas.load_html_string (fd.get_html (), uri); 				}diff --git a/src/Supplement.vala b/src/Supplement.valaindex af0e898..c3becd3 100644--- a/src/Supplement.vala+++ b/src/Supplement.vala@@ -25,7 +25,7 @@ public class Supplement { 	internal static bool experimental = false;
 	internal static bool show_coordinates = false;
 	internal static bool fatal_wanings = false;
-	internal static bool win32 = false;
+	public static bool win32 = false;
 	internal static string exec_path = "";
 
 	internal static Font current_font;

Contact

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