This is the mail archive of the cygwin mailing list for the Cygwin project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Sep 3 20:20, Thomas Wolff wrote: > Am 03.09.2018 um 19:56 schrieb Thomas Wolff: > > Am 03.09.2018 um 19:16 schrieb Corinna Vinschen: > > > On Sep 3 18:34, Thomas Wolff wrote: > > > > Am 03.09.2018 um 16:59 schrieb Corinna Vinschen: > > > > > On Sep 3 14:46, Corinna Vinschen wrote: > > > > > > On Sep 2 05:51, Steven Penny wrote: > > > > > > > On Sun, 2 Sep 2018 10:07:10, Thomas Wolff wrote: > > > > > > > > Actually, the width problem I suggested in my > > > > > > > > other response (and even > > > > > > > > referring to the wrong character) does not apply as mintty enforces > > > > > > > > proper width in that case. > > > > > > > > Also, even with fonts that do not provide the > > > > > > > > glyph, you will usually > > > > > > > > still see it by the Windows font fallback mechanism. > > > > > > > > Shall I make it configurable? > > > > > > > your call - here are the possible resolutions - in > > > > > > > order of my preference: > > > > > > > > > > > > > > 1. Change the default to U+FFFD with no option > > > > > > > 2. Change the default to U+FFFD with option to change > > > > > > > 3. Leave default as is with option to change > > > > > > Ideally we could check if the current font supports a visual > > > > > > representation of 0xfffd and if not, fall back to 0x2592. > > > > > > > > > > > > Not sure how feasible that is, but it doesn't seem to be overly > > > > > > complicated. I'm just looking into a solution for the Cygwin > > > > > > console. > > > > > Only, I can't get this working. In theory the GDI function > > > > > GetGlyphIndicesW is supposed to allow checking if a certain character > > > > > exists. But I'm getting a weird result. This code: > > > > > > > > > > static const wchar_t replacement_char[2] = > > > > > { > > > > > 0xfffd, /* REPLACEMENT CHARACTER */ > > > > > 0x2592 /* MEDIUM SHADE */ > > > > > }; > > > > > HWND cwnd = GetConsoleWindow (); > > > > > HDC cdc = GetDC (cwnd); > > > > > int rp_idx = 0; > > > > > WORD gi = 0; > > > > > DWORD ret = GetGlyphIndicesW (cdc, replacement_char, 1, &gi, > > > > > GGI_MARK_NONEXISTING_GLYPHS); > > > > > if (ret != GDI_ERROR && gi == 0xffff) > > > > > rp_idx = 1; > > > > > > > > > > always sets rp_idx to 1 when called from inside the Cygwin DLL, > > > > > independently of the actual console font. And, here's the > > > > > really weird > > > > > thing, it always sets rp_idx to 0 when called directly from an > > > > > application, likewise independently of the actual console font. > > > > > > > > > > Does anybody have an idea what I'm doing wrong? > > > > This works in mintty, just uploaded a patch. Maybe somehow the > > > > GetConsole > > > > "dc" does not support this usage? > > > ¯\_(ツ)_/¯ > > Dito; hold on, sorry, your code does *not* work inside mintty. > > Mine looks a bit different and I thought to have manually verified it's > > functionally equivalent, but indeed there must be something fishy... > You still need to > SelectObject(cdc, f); > where f is the HFONT of the font you want to check. > To compare, you may check out function win_check_glyphs in file wintext.c in > mintty. Thanks but I don't know how to get a HFONT for the current console font. In the meantime I figured out why my GetCurrentConsoleFontEx call failed with error 87: When looking again I realized there's a member called cbSize. The MSDN docs neglect to tell that the cbSize member has to be primed with sizeof(CONSOLE_FONT_INFOEX). As soon as I tried that, the function succeeded. Well, it's a start. I now have the actual font name. No idea how to get a HFONT from there, though. From what I can tell ATM, I'd have to call CreateFont to get a new HFONT and then destroy it again after usage. This looks pretty wasteful. Thanks, Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat
Attachment:
signature.asc
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |