From 90c59ec39e5209a3bb83a47ae55c61b6e0f02489 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sat, 7 Oct 2017 18:34:58 +0200 Subject: [PATCH] Add function returning the true string length in pixels. May be called from outside of x11.c. --- src/frontend/plotting/x11.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/frontend/plotting/x11.c b/src/frontend/plotting/x11.c index 319e9dda3..7f0b71fda 100644 --- a/src/frontend/plotting/x11.c +++ b/src/frontend/plotting/x11.c @@ -1225,6 +1225,15 @@ Xget_str_length(char *text, int* wlen, int* wheight, XftFont* gfont, char* fonam return 0; } +/* get the length of an utf-8 string in pixels */ +int +X11_GetLenStr(GRAPH *gr, char* instring) +{ + int wl, wh; + Xget_str_length(instring, &wl, &wh, NULL, DEVDEP(gr).fname, DEVDEP(gr).fsize); + return wl; +} + #else int x11_dummy_symbol;