]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
label-freetype: Fix loading debug message
authorRay Strode <rstrode@redhat.com>
Tue, 26 Dec 2023 18:27:36 +0000 (13:27 -0500)
committerRay Strode <halfline@gmail.com>
Wed, 27 Dec 2023 19:54:29 +0000 (19:54 +0000)
The freetype plugin was calling printf instead of ply-trace when
a font failed to load. Also, it didnt list the failure reason.

This commit fixes things up a bit.

src/plugins/controls/label-freetype/plugin.c

index 424127ec96e50e37387ea5ee5e40e32be5e732b0..403541f479718888a58ebb94febfd415f98ea6aa 100644 (file)
@@ -33,6 +33,7 @@
 #include <ft2build.h>
 #include FT_FREETYPE_H
 
+#include "ply-logger.h"
 #include "ply-pixel-buffer.h"
 #include "ply-pixel-display.h"
 #include "ply-utils.h"
@@ -158,11 +159,12 @@ set_font_with_fallback (ply_label_plugin_control_t *label,
                         const char                 *fallback_font_path)
 {
         FT_Error error;
-        if (primary_font_path)
+        if (primary_font_path != NULL)
                 error = FT_New_Face (label->library, primary_font_path, 0, &label->face);
 
-        if (!fallback_font_path || error) {
-                printf ("label-ft: trying font fallback\n");
+        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);
                 error = FT_New_Face (label->library, fallback_font_path, 0, &label->face);
         }