From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29874 invoked by alias); 3 Sep 2018 17:56:38 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 29864 invoked by uid 89); 3 Sep 2018 17:56:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 spammy= X-HELO: mout.kundenserver.de Received: from mout.kundenserver.de (HELO mout.kundenserver.de) (217.72.192.75) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 03 Sep 2018 17:56:36 +0000 Received: from [192.168.178.45] ([95.91.209.148]) by mrelayeu.kundenserver.de (mreue105 [212.227.15.183]) with ESMTPSA (Nemesis) id 0LqU2T-1fRvuq0pyz-00e2F8 for ; Mon, 03 Sep 2018 19:56:33 +0200 Subject: Re: Cygwin fails to utilize Unicode replacement character To: cygwin@cygwin.com References: <7942b18e-96bf-a824-4dac-82715d87af55@towo.net> <5b8bdcc4.1c69fb81.84d1a.e6b9@mx.google.com> <20180903124616.GT6350@calimero.vinschen.de> <20180903145919.GU6350@calimero.vinschen.de> <126ebbde-2432-f19b-6c5c-fe61f31e4647@towo.net> <20180903171659.GY6350@calimero.vinschen.de> From: Thomas Wolff Message-ID: Date: Mon, 03 Sep 2018 17:56:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180903171659.GY6350@calimero.vinschen.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2018-09/txt/msg00052.txt.bz2 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... -- 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