From 38f86993cf5458b09ec39d4f968f5d24df8ee7cc Mon Sep 17 00:00:00 2001 From: Dominic Radermacher Date: Tue, 1 Mar 2016 21:08:34 +0100 Subject: [PATCH] Small bugfix on text rendering for UTF-8 --- src/ptouch-print.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ptouch-print.c b/src/ptouch-print.c index ead7c2b..890db4e 100644 --- a/src/ptouch-print.c +++ b/src/ptouch-print.c @@ -141,7 +141,7 @@ int get_baselineoffset(char *text, char *font, int fsz) { int brect[8]; - if (strpbrk(text, "QgjpqyQ") == NULL) { /* if we have none of these */ + if (strpbrk(text, "QgjpqyQµ") == NULL) { /* if we have none of these */ return 0; /* we don't need an baseline offset */ } /* else we need to calculate it */ gdImageStringFT(NULL, &brect[0], -1, font, fsz, 0.0, 0, 0, "o"); @@ -153,6 +153,7 @@ int get_baselineoffset(char *text, char *font, int fsz) /* -------------------------------------------------------------------- Find out which fontsize we need for a given font to get a specified pixel size + NOTE: This does NOT work for some UTF-8 chars like µ -------------------------------------------------------------------- */ int find_fontsize(int want_px, char *font, char *text) { -- 2.39.2