[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Replace XChar2b with unsigned in all font backends
From: |
Alex Gramiak |
Subject: |
Re: Replace XChar2b with unsigned in all font backends |
Date: |
Tue, 21 May 2019 15:32:09 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) |
martin rudalics <address@hidden> writes:
>> Does the following diff work for you?
>
> The warnings go away but characters are still displayed as empty
> boxes.
Right, that's not unexpected since I made a flub on that patch and
didn't multiply by sizeof (wchar_t) (I posted a version that fixed that
in another message but didn't CC you, sorry).
Here's a third version that uses SAFE_NALLOCA instead:
diff --git a/src/w32font.c b/src/w32font.c
index bd68e22cc9..08d0f370bf 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -704,11 +704,21 @@ w32font_draw (struct glyph_string *s, int from, int to,
int i;
for (i = 0; i < len; i++)
- ExtTextOutW (s->hdc, x + i, y, options, NULL,
- s->char2b + from + i, 1, NULL);
+ {
+ const wchar_t ch = s->char2b[from + i];
+ ExtTextOutW (s->hdc, x + i, y, options, NULL, &ch, 1, NULL);
+ }
}
else
- ExtTextOutW (s->hdc, x, y, options, NULL, s->char2b + from, len, NULL);
+ {
+ USE_SAFE_ALLOCA;
+ wchar_t *str;
+ SAFE_NALLOCA (str, 1, len);
+ for (int i = 0; i < len; ++i)
+ str[i] = s->char2b[from + i];
+ ExtTextOutW (s->hdc, x, y, options, NULL, str, len, NULL);
+ SAFE_FREE ();
+ }
/* Restore clip region. */
if (s->num_clips > 0)
- Re: Replace XChar2b with unsigned in all font backends, (continued)
- Re: Replace XChar2b with unsigned in all font backends, Alex Gramiak, 2019/05/20
- Re: Replace XChar2b with unsigned in all font backends, Andy Moreton, 2019/05/20
- Re: Replace XChar2b with unsigned in all font backends, Eli Zaretskii, 2019/05/20
- Re: Replace XChar2b with unsigned in all font backends, Andy Moreton, 2019/05/20
- Re: Replace XChar2b with unsigned in all font backends, Eli Zaretskii, 2019/05/21
- Re: Replace XChar2b with unsigned in all font backends, Andy Moreton, 2019/05/21
- Re: Replace XChar2b with unsigned in all font backends, Eli Zaretskii, 2019/05/21
- Re: Replace XChar2b with unsigned in all font backends, Alex Gramiak, 2019/05/20
Re: Replace XChar2b with unsigned in all font backends, Alex Gramiak, 2019/05/20
Re: Replace XChar2b with unsigned in all font backends, Andy Moreton, 2019/05/21