From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: handa.kenichi@aist.go.jp (K.Handa) Newsgroups: gmane.emacs.bugs Subject: bug#35079: 26.1; Font rendering - problem with bdf fonts Date: Sat, 13 Apr 2019 19:35:55 +0900 Message-ID: <87h8b2chv8.fsf@aist.go.jp> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="128022"; mail-complaints-to="usenet@blaine.gmane.org" Cc: xsrvmy@gmail.com, 35079@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Apr 13 12:37:17 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hFG27-000X9M-Hv for geb-bug-gnu-emacs@m.gmane.org; Sat, 13 Apr 2019 12:37:15 +0200 Original-Received: from localhost ([127.0.0.1]:49544 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFG26-0005TM-IK for geb-bug-gnu-emacs@m.gmane.org; Sat, 13 Apr 2019 06:37:14 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:58799) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFG21-0005TG-3P for bug-gnu-emacs@gnu.org; Sat, 13 Apr 2019 06:37:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hFG1y-0008Oy-0w for bug-gnu-emacs@gnu.org; Sat, 13 Apr 2019 06:37:08 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44579) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hFG1u-0008OI-D8 for bug-gnu-emacs@gnu.org; Sat, 13 Apr 2019 06:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hFG1u-0001Lg-9i for bug-gnu-emacs@gnu.org; Sat, 13 Apr 2019 06:37:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: handa.kenichi@aist.go.jp (K.Handa) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 Apr 2019 10:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35079 X-GNU-PR-Package: emacs Original-Received: via spool by 35079-submit@debbugs.gnu.org id=B35079.15551517715120 (code B ref 35079); Sat, 13 Apr 2019 10:37:02 +0000 Original-Received: (at 35079) by debbugs.gnu.org; 13 Apr 2019 10:36:11 +0000 Original-Received: from localhost ([127.0.0.1]:58119 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hFG15-0001KW-1j for submit@debbugs.gnu.org; Sat, 13 Apr 2019 06:36:11 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:44286) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hFG12-0001KE-Dj for 35079@debbugs.gnu.org; Sat, 13 Apr 2019 06:36:09 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:50435) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFG0x-0007sL-7R; Sat, 13 Apr 2019 06:36:03 -0400 Original-Received: from i125-202-31-199.s41.a040.ap.plala.or.jp ([125.202.31.199]:62394 helo=abardeen) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hFG0u-0001Rw-Jf; Sat, 13 Apr 2019 06:36:01 -0400 Original-Received: from handa by abardeen with local (Exim 4.90_1) (envelope-from ) id 1hFG0p-000OWp-99; Sat, 13 Apr 2019 19:35:55 +0900 In-Reply-To: <83sgv0foc3.fsf@gnu.org> (message from Eli Zaretskii on Tue, 02 Apr 2019 17:56:12 +0300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:157578 Archived-At: In article <83sgv0foc3.fsf@gnu.org>, Eli Zaretskii writes: > > From: Max Xiong > > Date: Tue, 2 Apr 2019 01:31:09 -0400 > > > > When loading a bdf or a pcf font, specifically unifont in my case, the width of characters is incorrect. > Does this happen only with Unifont, or with any BDF font? > > To reproduce: > > Download the bdf.gz file from the unifont website at http://unifoundry.com/unifont/index.html > > Change the extension to .bdf There are two ways to use that font in Emacs. (1) install that font as X bitmap font, and use it via 'x' font-backend. (make-frame '((frame-parameter . (x xft)) (font . "-gnu-unifont-medium-r-normal-sans-16-160-75-75-c-80-iso10646-1"))) The reason for setting frame-parameter is that the default is (xft x) and thus that font is found via xft font-backend and via fontconfig. This way, Emacs shows characters with correct width. (2) install that font as you did, and use it via 'xft' font-backend. For this, I found that fontconfig gives 'spacing' parameter of that font as FC_CHARCELL. I think the spacing of that font should be FC_DUAL. Anyway, src/xftfont.c of Emacs does not know about FC_CHARCELL. So, emacs treats that font as a mono-space font. I think you can modify the spacing paramter of that font to FC_DUAL by writing some code in ~/.fonts.conf. Or, please try to apply this patch to src/xftfont.c, and rebuild emacs. diff --git a/src/xftfont.c b/src/xftfont.c index 8a4516f7f9..bb15a83685 100644 --- a/src/xftfont.c +++ b/src/xftfont.c @@ -349,7 +349,7 @@ xftfont_open (struct frame *f, Lisp_Object entity, int pixel_size) if (spacing != FC_PROPORTIONAL #ifdef FC_DUAL - && spacing != FC_DUAL + && spacing != FC_DUAL && spacing != FC_CHARCELL #endif /* FC_DUAL */ ) { I don't know the exact meaning of FC_CHARCELL. I could't find it on the Internet. Does anyone know what it means and why fontconfig uses it for the gnu unifont? --- K. Handa handa@gnu.org > > Install the font. In my case, I needed to copy it to ~/.local/share/fonts/misc/ > > Run fc-cache -fv in the terminal. > > Start emacs. > > From the menu bar, choose options -> select default font. > > Search for and choose Unifont Sans Serif size 12 (size should go to 12 anyways). > > > > The unexpected result is that each character is rendered with a full width, as if there is a space after it. The > > cursor becomes square instead of a half-width rectangle. > This could be the realization of the danger described in the > commentary to ftfont.c:get_adstyle_property, or some other issue with > BDF fonts. I don't think they are used widely anymore, so maybe our > code accrued some bitrot. > > Additionally, note that this does NOT occur with the ttf version of unifont. Nor does this bug occur when I use > > the bdf unifont inside the gnome terminal. > CC'ing Handa-san, in the hope that he could look into this issue. > Thanks.