Huge discance between characters in Emacs

Hi, I have a bug which is kind of sweet, but it make the built in Emacs unusable :slight_smile:

The gaps between the characters in the editor is so huge that text becomes fuzzy. See picture below.

I thought is might be related to my fonts, but in the demo-font viewer the emacs fonts look fine and normal. Manpce also looks nice. I have also tried switching fonts in the Emacs-setup.

I am on Manjaro Linux, X11 version X.Org version: 21.1.4, latest stable swi, 8.4.3

I also did a build of the lastes swi direclty from github, but still have the same problem in this version.

Any clues?


A vaguely recall this happened on some systems long time ago. I’m afraid I do not recall the reason :frowning: Possibly there are some traces of old discussions on the web. Are there any warnings from cmake about missing dependencies? The graphics come with two text implementations and you need the one based on Xft (?)

I have seen the same. I vaguely remember that uncommenting the font selection in the configuration and explicitly setting a font fixed it.

Is this the same?

1 Like

I vaguely remember this also (years ago, and for some other program than swipl) and I think it was fixed by installing more fonts and/or rerunning fontconfig. Possibly something to do with double-byte characters (kanji)?

BTW, I think you’ll find that the “development” version of SWI-Prolog is very stable and it has a lot of nice features that aren’t in the “stable” version.

Maybe a file in UCS-2 or UTF-16 encoding, try:

iconv -f UTF-16 -t ASCII input.txt -o output.txt

Or alternatively insert a BOM at the beginning of the file,
maybe its missing and the tooling will understand it.

Yes, this looks like same issue as Boris mention I think!

No errors or strange warning while compling, as far as I can see, Jan. How do I change the text implementation, I have no reqirements here.

Good to hear that the developer version looks stable - I will switch to it :slight_smile:

j4n_bur53, thanks for tip - but it does not make any change.

It is a little strange if it is the fonts as this works pretty nice and looks fine:

:- use_module(library(pce)).

:- initialization main.

main :-
    send(new(@p, picture), open),
    send(@p, clear),
    send(@p, display,
         text("Hello World!",
              font := font(times,bold,12))).

It may also confirm it is a font issue. Try using fixed instead of font(times,bold,12))

No luck with this one.

My emacs config now looks like below. My small xpce-code from above works fine when using fixed instead of times.

To underline my confusion I also did try with font(roman, fixed, 12) :slight_smile:

! display.system_fonts: [ normal := font(fixed, roman, 12),
! bold := font(fixed, bold, 12),
! italic := font(fixed, oblique, 12),
! small := font(fixed, roman, 10),
! large := font(fixed, roman, 14),
! boldlarge := font(fixed, bold, 14),
! huge := font(fixed, roman, 18),
! boldhuge := font(fixed, bold, 18),
! fixed := font(roman, roman, 13),
! tt := font(roman, roman, 13),
! boldtt := font(fixed, roman, 13),
! symbol := font(symbol, roman, 12)
! ]

Just to make sure, did you uncomment it? You need to get rid of the !s at the beginning of each line. Here is what mine looks like right now:

! Binding for the logical font-names.  You can bind any name to any
! font here.

display.system_fonts:	[ normal    := font(helvetica, roman,   12), \
			  bold      := font(helvetica, bold,    12), \
			  italic    := font(helvetica, oblique, 12), \
			  small     := font(helvetica, roman,   10), \
			  large     := font(helvetica, roman,   14), \
			  boldlarge := font(helvetica, bold,    14), \
			  huge      := font(helvetica, roman,   18), \
			  boldhuge  := font(helvetica, bold,    18), \
			  fixed     := font(screen,    roman,   12, 'mononoki-12:Regular'), \
			  tt        := font(screen,    roman,   12, 'mononoki-12:Regular'), \
			  boldtt    := font(screen,    bold,    12, 'mononoki-12:Bold'), \
			  symbol    := font(symbol,    roman,   12)  \

! Scale all fonts with a constant factor.

!font.scale: 1.4

There is this “4th argument” you see that was discussed in the thread I linked. I no longer remember how I figured out the exact string there but I must have googled it… :-/

Yes, this seems to be the missing magic Boris. Works now, thanks :slight_smile:

I stumbled on this again under Conda. It seems to be a bug in LibXft, according to

Probably the work-around mentioned in some of the answers is to heuristically detect we are in the buggy situation and divide the claimed character width by 3 :frowning:

Another work around seems to be to rely that the monospace family creates a fixed with font and not specify this explicitly. I pushed a patch doing this.