.
1 /*
2 Copyright (C) 2014 Johan Mattsson
3
4 This library is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 3 of the
7 License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13 */
14
15 namespace BirdFont {
16
17 public class ExportCallback : GLib.Object {
18
19 public signal void file_exported ();
20
21 public ExportCallback () {
22 }
23
24 public void export_fonts_in_background () {
25 Font font = BirdFont.get_current_font ();
26
27 if (!MainWindow.native_window.can_export ()) {
28 return;
29 }
30
31 if (font.font_file == null) {
32 MenuTab.set_save_callback (new SaveCallback ());
33 MenuTab.save_callback.file_saved.connect (() => {
34 MainWindow.native_window.export_font ();
35 });
36 MenuTab.save_callback.save ();
37 } else {
38 MainWindow.native_window.export_font ();
39 }
40 }
41
42 /** Export TTF, EOT and SVG fonts. */
43 public static void export_fonts () {
44 Font font = BirdFont.get_current_font ();
45
46 if (ExportSettings.export_ttf_setting (font) || ExportSettings.export_eot_setting (font)) {
47 ExportTool.export_ttf_font ();
48 }
49
50 if (ExportSettings.export_svg_setting (font)) {
51 ExportTool.export_svg_font ();
52 }
53 }
54 }
55
56 }
57