From 8ea8ddcc03755f769ffb0285158c37714c2b23e0 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Tue, 18 Aug 2020 10:40:14 +0200 Subject: [PATCH] simplify the previous commit, single step warp if multibyte utf-8 character --- src/frontend/plotting/x11.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/frontend/plotting/x11.c b/src/frontend/plotting/x11.c index 5c6485047..4feeadf2a 100644 --- a/src/frontend/plotting/x11.c +++ b/src/frontend/plotting/x11.c @@ -367,15 +367,16 @@ handlekeypressed(Widget w, XtPointer client_data, XEvent *ev, Boolean *continue_ keyev->y); #else int wl, wh; - int ret = Xget_str_length("ABCD", &wl, &wh, NULL, DEVDEP(graph).fname, DEVDEP(graph).fsize); + int ret = Xget_str_length(text, &wl, &wh, NULL, DEVDEP(graph).fname, DEVDEP(graph).fsize); +/* int ret = Xget_str_length("ABCD", &wl, &wh, NULL, DEVDEP(graph).fname, DEVDEP(graph).fsize); if (ret == 1) - ret = Xget_str_length("我能吞下", &wl, &wh, NULL, DEVDEP(graph).fname, DEVDEP(graph).fsize); + ret = Xget_str_length("我能吞下", &wl, &wh, NULL, DEVDEP(graph).fname, DEVDEP(graph).fsize);*/ if (ret == 1) { fprintf(cp_err, "Error: Could not establish a font for %s\n", DEVDEP(graph).fname); goto end; } XWarpPointer(display, None, DEVDEP(graph).window, 0, 0, 0, 0, - keyev->x + wl*nbytes/4, + keyev->x + (int)(1.2 * wl), keyev->y); #endif end: