Merge branch 'freetype-font-debugging' into 'main'

Improve font loading error debug messages in freetype plugin

See merge request plymouth/plymouth!284
This commit is contained in:
Ray Strode 2023-12-28 17:32:15 +00:00
commit a44ffaf8ed
2 changed files with 8 additions and 1 deletions

View file

@ -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);

View file

@ -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;
}