summaryrefslogtreecommitdiffstats
path: root/src/libnrtype
diff options
context:
space:
mode:
authorEduard Braun <eduard.braun2@gmx.de>2017-09-23 18:01:24 +0000
committerEduard Braun <eduard.braun2@gmx.de>2017-09-23 19:23:26 +0000
commit179538a2098fe6ae701bdb20e538b92ff7a4ffe7 (patch)
tree087c6420e911bab9e352fcccc9d96a4fdbba82cf /src/libnrtype
parentFix wrong parameter in Doxifile pointed by Eduard Brown (diff)
downloadinkscape-179538a2098fe6ae701bdb20e538b92ff7a4ffe7.tar.gz
inkscape-179538a2098fe6ae701bdb20e538b92ff7a4ffe7.zip
Do not crash if no fonts are available
Usually we fall back to "sans-serif" but if not a single fallback was available (this happens for example if the fontconfig configuration is invalid) Inkscape crashed. Fixed bug: - https://bugs.launchpad.net/inkscape/+bug/1716516
Diffstat (limited to 'src/libnrtype')
-rw-r--r--src/libnrtype/FontFactory.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp
index 5c6a96694..40e5d4ba1 100644
--- a/src/libnrtype/FontFactory.cpp
+++ b/src/libnrtype/FontFactory.cpp
@@ -689,9 +689,12 @@ font_instance *font_factory::Face(PangoFontDescription *descr, bool canFail)
pango_font_description_set_family(descr,"sans-serif");
res = Face(descr,false);
pango_font_description_free(descr);
+ } else {
+ g_critical("Could not load any face for font '%s'.", pango_font_description_to_string(descr));
}
}
+ if (res) {
// Extract which OpenType tables are in the font. We'll make a list of all tables
// regardless of which script and langauge they are in. This Harfbuzz code replaces
// an earlier Pango version as the Pango functions are deprecated.
@@ -836,6 +839,7 @@ font_instance *font_factory::Face(PangoFontDescription *descr, bool canFail)
hb_face_destroy (face);
g_free(scripts_hb);
+ }
} else {
// already here
res = loadedFaces[descr];