Cygwin fails to utilize Unicode replacement character

Steven Penny svnpenn@gmail.com
Wed Sep 5 11:58:00 GMT 2018


On Wed, 5 Sep 2018 09:55:28, Corinna Vinschen wrote:
> I added DejaVu Sans Mono per the above and to my surprise I see this:
>
>   $ cat alfa.txt
>   =EF=BF=BD
>
> So it looks like Deja Vu has a 0xfffd char.  However, GetGlyphIndicesW
> claims otherwise:

a character that DejaVu Sans Mono actually doesnt have is:

    U+01C4 LATIN CAPITAL LETTER DZ WITH CARON

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


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list