bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#35079: 26.1; Font rendering - problem with bdf fonts


From: K.Handa
Subject: bug#35079: 26.1; Font rendering - problem with bdf fonts
Date: Sat, 13 Apr 2019 19:35:55 +0900

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 via email to

[Prev in Thread] Current Thread [Next in Thread]