Cygwin fails to utilize Unicode replacement character
Corinna Vinschen
corinna-cygwin@cygwin.com
Wed Sep 5 15:58:00 GMT 2018
On Sep 5 15:18, Marco Atzeri wrote:
> Am 05.09.2018 um 13:58 schrieb Steven Penny:
> > On Wed, 5 Sep 2018 09:55:28, Corinna Vinschen wrote:
>
> > Using this file:
> >
> > $ cat glyph.c
> > #include <stdio.h>
> > #include <windows.h>
> > int main()
> > {
> > CONSOLE_FONT_INFOEX ta;
> > ta.cbSize = sizeof ta;
> > GetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), 0, &ta);
> > HDC wh = GetDC(0);
> > SelectObject(wh,
> > CreateFontW(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ta.FaceName));
> > WCHAR xr[4] = {0xFFFD, 0x2592, 0x25A1, 0x01C4};
> > WORD zu[4];
> > GetGlyphIndicesW(wh, xr, 4, zu, 1);
> > printf("%ls:\n", ta.FaceName);
> > for (int q = 0; q < 4; q++) {
> > printf(" U+%04X: %s\n",
> > xr[q], zu[q] == 0xffff ? "failure" : "success");
> > }
> > }
> >
> > I get this result:
> >
> > DejaVu Sans Mono:
> > U+FFFD: success
> > U+2592: success
> > U+25A1: success
> > U+01C4: failure
> >
>
> Strange on W10 CMD I obtain
>
> DejaVu Sans Mono U+FFFD: failure
^^^
You see this? There's something really fishy here. I see a similar
effect which somehow depends on arbitrary changes to the source file:
- Sometimes I get "DejaVu Sans Mono" in FaceName and all works well.
- Sometimes I get "DejaVu Sans Mono\1" or "DejaVu Sans Mono\6" and
the subsequent GetGlyphIndicesW returns failures for many or all
characters.
I'm trying to find what's affecting this for hours, but I don't get any
conclusive results :(
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20180905/da40b761/attachment.sig>
More information about the Cygwin
mailing list