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

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

bug#67449: Manual: add how to change default global font size in .emacs


From: Kévin Le Gouguec
Subject: bug#67449: Manual: add how to change default global font size in .emacs
Date: Thu, 30 Nov 2023 08:23:00 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

>> > and the font size can be changed interactively (*note
>> > Text Scale::).
>> 
>> We don't want to change it interactively. We just want to put a line in
>> our .emacs file to change it.
>> 
>> >    There are several different ways to specify a different font:
>> 
>> We don't want to specify a different font. We don't care about the font.
>> We just want to make it use a different size as default.
>
> So just specify the same font with the different size.  Case closed.
>
>> >    • Add a line to your init file, modifying the variable
>> >      ‘default-frame-alist’ to specify the ‘font’ parameter (*note Frame
>> >      Parameters::), like this:
>> > 
>> >           (add-to-list 'default-frame-alist
>> >                        '(font . "DejaVu Sans Mono-10"))
>> 
>> Yes we want to add a line to our .emacs file. But we don't want to have
>> to say some font name. We just want to tell emacs to use "default size
>> 14, not 10".
>
> So just specify the same font with the different size.  Case closed.
>
>> >      This makes the font the default on all graphical frames created
>> >      after restarting Emacs with that init file.
>> > 
>> >    • Add an ‘emacs.font’ X resource setting to your X resource file,
>> >      like this:
>> > 
>> >           emacs.font: DejaVu Sans Mono-12
>> 
>> Again we are forced to name a font. We don't want to name a font. We
>> just want to tell emacs to do what it does, but at scale 14 not 10.
>
> So just specify the same font with the different size.  Case closed.
>
>> Anyway maybe there is a glimmer of hope with some line like
>> -*-*-*-14-*-*-*- or something, but it so frustrating.
>
> A two-liner in the init file or a X resource setting cannot be
> anywhere near frustrating.
>
>> Whereas in other apps one can just choose a default font size, in
>> emacs ... well you have to go down to the car dealership and learn
>> about muffler types. You can't just tell the rental agency to
>> deliver an economy sized car.
>
> Or you can do the above, which is easy and a no-brainer, really.  Case
> closed.  And this bug is also closed.  Please accept the decision and
> stop pushing.

FWIW, I've been following this thread because I empathize with Dan in
this report: depending on the system I use, emacs -Q gets me either
Ubuntu Mono (GNOME/Ubuntu 22.04), Noto Sans Mono (Plasma/Debian 12) or
Source Code Pro (Plasma/openSUSE Tumbleweed).

In practice I customize Emacs to pick DejaVu Sans Mono in every setup,
but that's a decision I take for incidental reasons (character coverage,
bold/italic variants); so indeed I happen to

> just specify the same font

but I can imagine wanting to keep the system's default _family_, yet
have a consistent font _size_ across all my setups, in which case having
to spell out the font in my dotfiles is a bother.

(Granted, the X resource solution cited above might work?  Would it work
--with-pgtk on Wayland?)

(Granted², as soon as each "setup" differs in screen size, resolution,
or density, "a consistent font _size_ across all my setups" probably
requires bespoke face heights for each setup; still, that does not mean
I'd want to mess with the _family_)

FWIW², if I were to attempt to "just set the size, ignoring the font" in
my dotfiles, I'd probably go with either

  ;; (1)
  (set-face-attribute 'default nil :height my/height)

or

  ;; (2)
  (let* ((family (face-attribute 'default :family))
         (font-desc (format "%s-%s" family my/size)))
    (add-to-list 'default-frame-alist
                 (cons 'font font-desc)))

?  Not saying that's worth documenting, just hoping that'll help Dan
sort out his config.





reply via email to

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