From d0e6015bc73806680c8d793ae7faef1515ffa8a0 Mon Sep 17 00:00:00 2001 From: Charlie Gordon Date: Wed, 3 May 2017 10:08:16 +0000 Subject: [PATCH] x11: small improvements - interpret X11 geometry string as pixels, not characters - fix invalid UCS2 character display in x11 --- x11.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/x11.c b/x11.c index be7e33b..a23c866 100644 --- a/x11.c +++ b/x11.c @@ -237,8 +237,8 @@ static int x11_dpy_init(QEditScreen *s, int w, int h) xsize = w; ysize = h; } else { - xsize = 128; - ysize = 50; + xsize = 128 * font_xsize; + ysize = 50 * font_ysize; if (geometry_str) { p = geometry_str; @@ -254,8 +254,6 @@ static int x11_dpy_init(QEditScreen *s, int w, int h) } } - xsize *= font_xsize; - ysize *= font_ysize; s->width = xsize; s->height = ysize; s->charset = &charset_utf8; @@ -983,6 +981,9 @@ static void x11_dpy_draw_text(QEditScreen *s, QEFont *font, q = x11_str; } last_font = font1; + /* XXX: invalid conversion from UCS4 to UCS2 */ + if (cc >= 0xFFFF) + cc = 0xFFFD; q->byte1 = (cc >> 8) & 0xff; q->byte2 = (cc) & 0xff; q++;