]> git.sur5r.net Git - ptouch-print/commitdiff
Small bugfix on text rendering for UTF-8
authorDominic Radermacher <dominic.radermacher@gmail.com>
Tue, 1 Mar 2016 20:08:34 +0000 (21:08 +0100)
committerDominic Radermacher <dominic.radermacher@gmail.com>
Tue, 1 Mar 2016 20:08:34 +0000 (21:08 +0100)
src/ptouch-print.c

index ead7c2bfbc4c6a18698a5acbc3a5961755b3cce0..890db4e969b972058522c2399878e68ca3a1ddaf 100644 (file)
@@ -141,7 +141,7 @@ int get_baselineoffset(char *text, char *font, int fsz)
 {
        int brect[8];
 
 {
        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");
                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
 /* --------------------------------------------------------------------
        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)
 {
    -------------------------------------------------------------------- */
 int find_fontsize(int want_px, char *font, char *text)
 {