0

Addendum added to respond to the answer and subsequent comments of db48x


A few months ago, I migrated from Fedora to Linux Mint 20 (Cinnamon), and then installed Emacs v26.3 in Mint. As shown in the Emacs screenshot below, this caused two display problems that were not present under Fedora. I request advice on attacking each of these problems.

  • The mode line is too short to fully display the information.
    I tried :
    Options - Customize Emacs - Top Level Customization Group -
    Environment - Mode Line.
    However, I didn't see any option that would allow me to make the mode line taller.

  • The leftmost digit of the line numbers are not visible.
    After doing some research, I added the following line to my Emacs initialization, and then stopped and re-started Emacs:
    (setq-default display-line-numbers-width 5)
    It had no effect on the problem.

enter image description here


Addendum
Responding to the answer and subsequent comments of db48x.

...The easiest way to fix the problem is to choose a different font, since that designer will have made a different set of mistakes.

First of all, thanks to db48x for going the extra mile to spend time and attention on my problems. Personally, my research and resolutions (described below) suggest that the problem is not in the fonts themselves, but rather in the way that Emacs is interacting with Linux Mint (Cinnamon), as opposed to Fedora (Cinnamon).

In summary I have two problems:

  • The height of the mode line is too short.

  • The width of the line-number gutter is too narrow.

Both of these problems surfaced after switching from Fedora to Linux Mint. Long term, I construe these problems as in the middle ground between Emacs and Linux Mint. I can't really regard these problems as either an Emacs problem or a Linux Mint problem. So, it isn't really reasonable to ask either Linux Mint support or Emacs support to investigate the problems.

At the same time, while I did upvote the answer of db48x, I did not accept it. This is my way of signaling that I still suspect that there is a problem with the underlying interaction between Emacs and Linux Mint Cinnamon.

Research/experimenting:

  • On my Linux Mint Desktop, I have specified large text via
    menu : accessibility : visual : visual aids : large text.
    I temporarily disabled this feature, and verified that both problems persisted. I then restored this feature, and researched/experimented further.

  • describe-face indicates that Monospace Regular is an alias for DejaVu Sans Mono.

  • Because of vision problems that I have, I use a default font size of (16).
    Also, I have to preserve that font size, even when investigating.

  • At random, I tried each of the following fonts. No joy with either of the two problems: [aaker medium], [Accanthis ADF STD Regular], [Free Mono Regular], [Free Sans Regular], [Meera Regular].

  • At random, I tried each of the following additional fonts. These two fonts both (seemed to) fixed the problem of the mode line height, but had no effect on the problem of the line-number gutter width: [Latin Modern Sans 17 Regular], [Tex Gyre Heros Regular].

Solutions:

I then solved the mode line height problem, without disturbing the default font, as follows:

  • I temporarily changed the default buffer to [Tex Gyre Heros Regular], size 16.
    I then executed describe-face and copied all of the information to a separate text editor.

  • I then restored my default font to Monospace Regular.

  • I then executed:
    Menu - Options - Customize Emacs - Top-Level Customization Group -
    Environment - Mode Line - Subgroup: Mode Line Faces - Mode Line Face

  • Within this menu option, I pasted in all of the information that I had copied from the describe-face command.

  • This altered the mode line font, without disturbing the default font. This alteration (inelegantly) solved the problem of the height of the mode line.

After doing some research on the line-number gutter width problem, I adopted the (extremely inelegant) solution of
'(linum-format "%5d").

I have not (yet) ever needed to repeatedly deal with a file of greater than 9999 lines. I can live with the wasted space in the line number gutter, on shorter files.

Note
I also use emacs code folding.
I specifically rejected (for example) '(linum-format " %d") because it created confusing results in folded code.

1 Answer 1

1

The height of the mode line and the width of the line numbers are based on the metrics of the face used to display them. Unfortunately, not every font reports correct metrics. Try choosing a different UI font in the font settings to see if the problem goes away. Alternatively, customize the default face in Emacs to choose a different base font that everything else derives from. (M-x customize-face default RET will take you right there.)

If you don’t want to use a different font, then you might look into changing the line-spacing display property on the mode line, but I don’t think that anything can help you with the line numbers other than trying a different font.

Edit:

Well, if the problem is not just limited to just one font, then I suppose you are left with investigating the behavior of the various font and text rendering libraries such as libfreetype and libharfbuzz that Emacs uses. Perhaps your two systems are using different versions, with different bugs or quirks.

5
  • Why would the metric associated with the [Monospace Regular 16] font work okay in Fedora, but not work okay in Mint? Is it possible that there is a malfunction in the way that Emacs is (in general) interacting with the Mint-Cinnamon desktop?
    – zugzwang
    Jul 27 at 23:51
  • “Monospace” is an alias for some other font. In order to investigate properly, you should use the gnome font settings to figure out which font it is, as well as to try alternate fonts to see if they have similar problems.
    – db48x
    Jul 28 at 1:41
  • But to try to answer your question, the metrics of a font are more complicated than they look. Each character potentially has a different height for example, and that height is further broken up into the baseline, ex–height, em–height, the ascenders and descenders, etc. It is entirely possible that the designer of the font made mistakes which are causing the problem. The easiest way to fix the problem is to choose a different font, since that designer will have made a different set of mistakes (hopefully fewer!).
    – db48x
    Jul 28 at 1:44
  • +1: for your answer and subsequent comments. Please see the Addendum that I have added to the end of my question.
    – zugzwang
    Jul 28 at 20:33
  • Re your latest edit: logical. However, this begs the question: given how popular Linux Mint is, and how popular Emacs is, why did this posting not receive (for example) 20 comments saying (in effect) : "I am experiencing the same symptoms"? On the other hand, I noticed no font mishap either during or after the Linux Mint 20 (fresh, full) install. I have noticed that Paintshop Pro (via wine) has its Menu bar fonts okay, but presents a small hard to read toolbar. This is really the only other related symptom. It remains unclear to me whether this is actually a font problem.
    – zugzwang
    Jul 28 at 22:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.