aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2019-05-23 08:26:32 +0300
committerEli Zaretskii2019-05-23 08:26:32 +0300
commit38564f8a664347c42f7614d9c91e0d49e4a073e8 (patch)
treec4ad682b3319103018f64c415c0b3c848d05eb01 /src
parent627fa5a0cb8aa57b9c419d3bc0ae749cd573fd52 (diff)
downloademacs-38564f8a664347c42f7614d9c91e0d49e4a073e8.tar.gz
emacs-38564f8a664347c42f7614d9c91e0d49e4a073e8.zip
Unbreak display of characters on MS-Windows
* src/w32font.c (w32font_draw): Convert the glyph_string's char2b array to 16-bit WCHAR data that ExtTextOutW needs.
Diffstat (limited to 'src')
-rw-r--r--src/w32font.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/w32font.c b/src/w32font.c
index bd68e22cc90..47a33aec35f 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -704,11 +704,23 @@ w32font_draw (struct glyph_string *s, int from, int to,
704 int i; 704 int i;
705 705
706 for (i = 0; i < len; i++) 706 for (i = 0; i < len; i++)
707 ExtTextOutW (s->hdc, x + i, y, options, NULL, 707 {
708 s->char2b + from + i, 1, NULL); 708 WCHAR c = s->char2b[from + i] & 0xFFFF;
709 ExtTextOutW (s->hdc, x + i, y, options, NULL, &c, 1, NULL);
710 }
709 } 711 }
710 else 712 else
711 ExtTextOutW (s->hdc, x, y, options, NULL, s->char2b + from, len, NULL); 713 {
714 /* The number of glyphs in a glyph_string cannot be larger than
715 the maximum value of the 'used' member of a glyph_row, so we
716 are OK using alloca here. */
717 eassert (len <= SHRT_MAX);
718 WCHAR *chars = alloca (len * sizeof (WCHAR));
719 int j;
720 for (j = 0; j < len; j++)
721 chars[j] = s->char2b[from + j] & 0xFFFF;
722 ExtTextOutW (s->hdc, x, y, options, NULL, chars, len, NULL);
723 }
712 724
713 /* Restore clip region. */ 725 /* Restore clip region. */
714 if (s->num_clips > 0) 726 if (s->num_clips > 0)