Cygwin fails to utilize Unicode replacement character

Corinna Vinschen corinna-cygwin@cygwin.com
Wed Sep 5 07:55:00 GMT 2018


On Sep  4 04:40, Steven Penny wrote:
> On Tue, 4 Sep 2018 11:00:00, Corinna Vinschen wrote:
> > Whereever you get DejaVu Sans Mono from.
> 
> Cygwin provides it via the "dejavu-fonts" package, or you can get it here:
> 
> http://dejavu-fonts.github.io
> 
> > My W10 console only allows to specify a handful of fonts, Consolas, Courier
> > New, Lucida, MS Gothic, NSimSun, Raster Fonts, SimSun-ExtB.
> 
> You can add DejaVu or others like this:
> 
> http://superuser.com/questions/390933/add-font-cmd-window-choices/956818

I added DejaVu Sans Mono per the above and to my surprise I see this:

  $ cat alfa.txt
  �

So it looks like Deja Vu has a 0xfffd char.  However, GetGlyphIndicesW
claims otherwise:

  static const wchar_t replacement_char[3] =
    {
      0xfffd, /* REPLACEMENT CHARACTER */
      0x25a1, /* WHITE SQUARE */
      0x2592  /* MEDIUM SHADE */
    };
  WORD gi[3] = { 0, 0, 0 };
  [...]
  GetGlyphIndicesW (cdc, replacement_char, 3, gi, GGI_MARK_NONEXISTING_GLYPHS);
  printf ("gi = %u %u %u\n", gi[0], gi[1], gi[2]);

This prints:

  gi = 65535 401 372

That means, the notdef glyph for DejaVu looks like 0xfffd, but isn't,
right?


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/8d300f70/attachment.sig>


More information about the Cygwin mailing list