1

Ubuntu 22.04, Emacs 30-ish.

I set my font this way:

(when (member "Terminus" (font-family-list))
  (set-frame-font "-xos4-Terminus-normal-normal-normal-*-14-*-*-*-c-60-iso10646-1")
  (add-to-list 'default-frame-alist '(font
                      . "-xos4-Terminus-normal-normal-normal-*-14-*-*-*-c-60-iso10646-1")))

I installed terminus with the apt packages xfont-terminus and fonts-terminus-otb.

My problem: I cannot increment or decrement the frame font size interactively anymore. text-scale-increase does nothing (event called many times). My previous zoom functionality does not work either:

;; --- Zoom applies to the whole frame ---
; Taken from a comment in package frame-cmds.el (elpa). Probably not working for versions under 22.
(defun my-enlarge-font (&optional increment frame)
    "Increase size of font in FRAME by INCREMENT.
Interactively, INCREMENT is given by the prefix argument.
Optional FRAME parameter defaults to current frame."
    (interactive "p")
    (setq frame  (or frame  (selected-frame)))
    (set-face-attribute
     'default frame :height (+ (* 10 increment)
                               (face-attribute 'default :height frame 'default))))
(defun my-zoom-in ()
  (interactive)
  (my-enlarge-font 1))
(defun my-zoom-out ()
  (interactive)
  (my-enlarge-font -1))

My best guess is that something with :height now works differently, but it's a long shot.

What can I do to restore my zoom functionality?

1 Answer 1

1

First thing to try is a different font (family). IOW, check whether this breakage is general or specific to terminus.


Text scaling works differently from the font-enlarging code you show. If text-scale-increase also doesn't work then it smells a bit like a bug/regression introduced in Emacs 30. If you don't get a good answer here, maybe try filing a bug report: M-x report-emacs-bug.


I don't have Emacs 30 (and it's not yet a release), so I don't know if this too is being broken by underlying "progress". But in case it does still work...

Your my-enlarge-font code looks very much like my enlarge-font ;-). You can try that, to see if it too becomes broken by Emacs 30.

It's defined in frame-cmds.el](https://www.emacswiki.org/emacs/download/frame-cmds.el), which in turn requires [frame-fns.el.

I'll be interested to find out what you find out, wrt the breakage and possible fixes/workarounds for it.


For interactive use, there is also zoom-frm.el, which uses enlarge-font from `frame-cmds.el.

6
  • Hi @Drew, thanks for checking in. I did copy the function from frame-cmds.el, thank you for this :) I don't remember why I made a local copy, it was very long ago. I tested it with emacs 29 and had the same error, so I think this is on my end. Someone suggested the problem is with Terminus being a bitmap font, which is why I installed fonts-terminus-otb. But maybe I need to do more for emacs to discover it? Maybe I'm still using the bitmap font and not otb?
    – Gauthier
    Apr 2 at 8:56
  • Do you have a font for which you don't see the problem? That's the first thing to check - see if it's font-specific.
    – Drew
    Apr 2 at 16:00
  • Yes, Liberation Mono works, both my (your) own implementation, and text-scale-*. Also, if I replace 14 with 12 in my first elisp snippet, then restart emacs, the size does change to 12.
    – Gauthier
    Apr 3 at 4:26
  • Maybe check what sizes you have for the problematic font, and exactly what their names are, in XLFD terms. And see the code comment for enlarge-font:
    – Drew
    Apr 3 at 14:29
  • This does not work 100% well. For instance, set frame font to "-raster-Terminal-normal-r-normal-normal-12-90-96-96-c-50-ms-oemlatin", then decrease font size. The next smaller existing font on my machine is "-raster-Terminal-normal-r-normal-normal-11-*-96-96-c-*-ms-oemlatin". Decrease size again. Next smaller font is "-raster-Terminal-bold-r-normal-normal-5-37-96-96-c-60-ms-oemlatin". Notice the switch to bold from regular. Cannot decrease any more. Increase size. Next larger font is "-raster-Terminal-bold-r-normal-normal-8-*-96-96-c-*-ms-oemlatin". Can no longer increase size.
    – Drew
    Apr 3 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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