unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: handa.kenichi@aist.go.jp (K.Handa)
To: Eli Zaretskii <eliz@gnu.org>
Cc: xsrvmy@gmail.com, 35079@debbugs.gnu.org
Subject: bug#35079: 26.1; Font rendering - problem with bdf fonts
Date: Sat, 13 Apr 2019 19:35:55 +0900	[thread overview]
Message-ID: <87h8b2chv8.fsf@aist.go.jp> (raw)
In-Reply-To: <83sgv0foc3.fsf@gnu.org> (message from Eli Zaretskii on Tue, 02 Apr 2019 17:56:12 +0300)

In article <83sgv0foc3.fsf@gnu.org>, Eli Zaretskii <eliz@gnu.org> writes:

> > From: Max Xiong <xsrvmy@gmail.com>
> > 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.






  reply	other threads:[~2019-04-13 10:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-02  5:31 bug#35079: 26.1; Font rendering - problem with bdf fonts Max Xiong
2019-04-02 14:56 ` Eli Zaretskii
2019-04-13 10:35   ` K.Handa [this message]
2019-05-03  8:36     ` Eli Zaretskii
2019-05-06 13:12       ` handa
2019-11-17  9:01     ` Lars Ingebrigtsen
2019-11-17 16:03       ` Eli Zaretskii
2019-11-17 16:32         ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h8b2chv8.fsf@aist.go.jp \
    --to=handa.kenichi@aist.go.jp \
    --cc=35079@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=xsrvmy@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).