The Birdfont Source Code
Check if a loaded font contains color glyphs
These changes was commited to the Birdfont repository Tue, 28 Nov 2017 12:04:42 +0000.
Contributing
Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
Check if a loaded font contains color glyphs
--- a/libbirdfont/BirdFontFile.vala
+++ b/libbirdfont/BirdFontFile.vala
@@ -28,6 +28,8 @@
public static const int MIN_FORMAT_MAJOR = 0;
public static const int MIN_FORMAT_MINOR = 0;
+
+ public bool has_svg_glyphs = false;
public BirdFontFile (Font f) {
font = f;
@@ -1438,6 +1440,10 @@
if (t.get_name () == "path") {
path = parse_path (t);
layer.add_path (path);
+ }
+
+ if (t.get_name () == "embedded") {
+ font.has_svg = true;
}
}
--- a/libbirdfont/Font.vala
+++ b/libbirdfont/Font.vala
@@ -126,7 +126,8 @@
public int format_minor = 0;
public int units_per_em = 1024;
-
+ public bool has_svg = false;
+
public Font () {
KerningClasses kerning_classes;
--- a/libbirdfont/LoadCallback.vala
+++ b/libbirdfont/LoadCallback.vala
@@ -34,6 +34,11 @@
MainWindow.show_message (t_("This font was made with an old version of Birdfont.")
+ " " + t_("You need an older version of Birdfont to open it."));
}
+ }
+
+ if (f.has_svg) {
+ MainWindow.show_message (t_("This font has color glyphs but your version of BirdFont does not have color support.")
+ + " " + t_("Check birdfont.org for other versions."));
}
});
}