Commit d5b7771
Warn before opening the preview tab with an embedded svg font
Changed files (5)
modifiedlibbirdfont/ExportTool.valamodifiedlibbirdfont/Font.valamodifiedlibbirdfont/Glyph.valamodifiedlibbirdfont/Preview.valamodifiedlibbirdfont/PreviewTools.vala
Diff
@@ -584,7 +584,7 @@ os.put_string ( File file = (!) File.new_for_path (ttf); File file_mac = (!) File.new_for_path (ttf_mac); - error_message = null; + error_message = null; try { fo.open (file, file_mac);@@ -594,7 +594,7 @@ os.put_string ( warning (@"Can't create TTF font to $ttf"); critical (@"$(e.message)"); error_message = e.message; - } + } } static void write_eot (string ttf, string eot) {@@ -187,6 +187,18 @@ public class Font : GLib.Object { font_deleted (); } + public bool has_svg_glyph () {+ for (int glyph_index = 0; glyph_index < glyph_name.length (); glyph_index++) {+ GlyphCollection gc = glyph_name.nth (glyph_index);+ + if (gc.get_current ().has_svg_path ()) {+ return true;+ }+ }+ + return false;+ }+ public void add_default_characters () { GlyphCollection notdef = get_notdef_character (); @@ -184,6 +184,16 @@ public class Glyph : FontDisplay { warning ("Layer is not added to glyph."); } + public bool has_svg_path () {+ foreach (SvgBird.Object object in get_visible_objects ()) {+ if (object is EmbeddedSvg) {+ return true;+ }+ }+ + return false;+ }+ public Gee.ArrayList<SvgBird.Object> get_visible_objects () { return LayerUtils.get_visible_objects (layers); }@@ -28,7 +28,7 @@ public class Preview : FontDisplay { } public override void selected_canvas () {- MainWindow.set_scrollbar_size (0);+ MainWindow.set_scrollbar_size (0); } public static string get_html_path () {@@ -58,11 +58,18 @@ public class PreviewTools : ToolCollection { IdleSource idle = new IdleSource (); idle.set_callback (() => {+ Font font = BirdFont.get_current_font ();+ bool has_svg = font.has_svg_glyph ();+ + if (has_svg) {+ MainWindow.show_message (t_("SVG glyphs can't be viewed in preview."));+ }+ if (!Preview.has_html_document ()) { Preview.generate_html_document (); } - if (ExportTool.error_message == null) {+ if (ExportTool.error_message == null && !has_svg) { MainWindow.tabs.select_tab_name ("Preview"); }