From ff446fab9b6c2144417d73d058a08ed20fa77914 Mon Sep 17 00:00:00 2001 From: Alexander Babikov <2708460+lemondrops@users.noreply.github.com> Date: Mon, 18 Dec 2023 09:20:37 +0500 Subject: [PATCH 1/2] prt_escp.c: Fall back to roman.ttf instead of dotmatrix.ttf for unhandled typefaces --- src/printer/prt_escp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/printer/prt_escp.c b/src/printer/prt_escp.c index 707590134..cd0279078 100644 --- a/src/printer/prt_escp.c +++ b/src/printer/prt_escp.c @@ -531,7 +531,7 @@ update_font(escp_t *dev) fn = FONT_FILE_OCRB; break; default: - fn = FONT_FILE_DOTMATRIX; + fn = FONT_FILE_ROMAN; } /* Create a full pathname for the ROM file. */ From bf1f4252672eb2607cd00da65b45c03a377c3193 Mon Sep 17 00:00:00 2001 From: Alexander Babikov <2708460+lemondrops@users.noreply.github.com> Date: Mon, 18 Dec 2023 09:20:48 +0500 Subject: [PATCH 2/2] prt_escp.c: Try to use courier.ttf if dotmatrix.ttf is missing --- src/printer/prt_escp.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/printer/prt_escp.c b/src/printer/prt_escp.c index cd0279078..c11479786 100644 --- a/src/printer/prt_escp.c +++ b/src/printer/prt_escp.c @@ -545,6 +545,17 @@ update_font(escp_t *dev) if (FT_New_Face(ft_lib, path, 0, &dev->fontface)) { escp_log("ESC/P: unable to load font '%s'\n", path); dev->fontface = NULL; + + /* Try to fall back to Courier in case the dot matrix font is absent. */ + if (!strcmp(fn, FONT_FILE_DOTMATRIX)) { + strcpy(path, dev->fontpath); + path_slash(path); + strcat(path, FONT_FILE_COURIER); + if (FT_New_Face(ft_lib, path, 0, &dev->fontface)) { + escp_log("ESC/P: unable to load font '%s'\n", path); + dev->fontface = NULL; + } + } } if (!dev->multipoint_mode) {