diff --git a/src/libply/ply-utils.c b/src/libply/ply-utils.c index 95b505b1..a71d8de8 100644 --- a/src/libply/ply-utils.c +++ b/src/libply/ply-utils.c @@ -518,7 +518,7 @@ ply_file_exists (const char *file) { struct stat file_info; - if (stat (file, &file_info) < 0) + if (lstat (file, &file_info) < 0) return false; return S_ISREG (file_info.st_mode); diff --git a/src/plugins/controls/label-freetype/plugin.c b/src/plugins/controls/label-freetype/plugin.c index 403541f4..17cb134e 100644 --- a/src/plugins/controls/label-freetype/plugin.c +++ b/src/plugins/controls/label-freetype/plugin.c @@ -165,6 +165,11 @@ set_font_with_fallback (ply_label_plugin_control_t *label, if (fallback_font_path != NULL && error != 0) { ply_trace ("Could not load font '%s', trying fallback font '%s' (error %d)", primary_font_path?: "(unset)", fallback_font_path, (int) error); + + if (!ply_file_exists (fallback_font_path)) { + ply_trace ("Fallback font '%s' does not exist!", fallback_font_path); + return error; + } error = FT_New_Face (label->library, fallback_font_path, 0, &label->face); } @@ -775,6 +780,8 @@ set_font_for_control (ply_label_plugin_control_t *label, if (error) { FT_Done_Face (label->face); label->face = NULL; + + ply_trace ("Could not load font, error %d", error); return; }