From 0fb9f0c6f1b14329dbb77a8bd7399d7338f2a1f1 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Tue, 26 Dec 2023 13:27:36 -0500 Subject: [PATCH] label-freetype: Fix loading debug message 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 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/controls/label-freetype/plugin.c b/src/plugins/controls/label-freetype/plugin.c index 424127ec..403541f4 100644 --- a/src/plugins/controls/label-freetype/plugin.c +++ b/src/plugins/controls/label-freetype/plugin.c @@ -33,6 +33,7 @@ #include #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); }