Changing font size of all the buffers including the status line and the characters shown in electric-buffer

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Changing font size of all the buffers including the status line and the characters shown in electric-buffer

ISHIKAWA,chiaki
Hi,

I run Emacs under linux. I am happy with Emacs and most of my writing
document is done using Emacs even if the final draft is created using MS
Word by request.
Thanks to the support of unicode these days, handling Japanese as well
as English is great.


One gripe. Ever since I switched to 4K display (well actually, it is
more like 3840x2160 @30Hz  due to my poor graphics adapter), one thing
bothers me.

It is the font size of Emacs. The default is way too small on this 4K
display and I would like to show the characters and big and beautiful.
There are times when I want to see as many characters possible. But most
of the times, I want to see big and crisp characters due to my age.

Anyway, I checked Emacs Wiki.
https://www.emacswiki.org/emacs/SetFonts
There does NOT seem to be a universal method that can enlarge the font size
of buffers including one for electric-buffer mode and status line in one go.


Inside a buffer, I can do c-x c-+ to enlarge the font of the text INSIDE
that buffer, but the characters shown on the window pane, so to speak
does not become larger, neither the characters on the status line.
Of course, each time a new buffer/window by visiting a new file is
created, it is shown  in the small default size.
(I am a bit bothered by the description of a potential bug in the wiki:
--- quote
BUG? – If you use a fontset with Xft, `|C-x C-+|’ this does not scale
the secondary font. For example, If you use a fontset –
|dejavu-sans-mono| for latin, |NanumGothic_Coding| for hangul(Korean) –
, increasing the text size does not scale the Korean characters. – cinsk
<https://www.emacswiki.org/emacs/cinsk>

---end quote
I am using Japanese fonts with ordinary ASCII English fonts.
As far as I can tell, somehow my Japanese text buffer with interspersed
ASCII roman characters and digits do get resized properly with c-x c-+
keystrokes.
Maybe I am not using a "fontset" currently.
I recall setting the size using X11 resources long time ago, and now I
have just realized that the discrepancy of the sizes of Japanese fonts
and ASCII English fonts which I experienced are due to this "BUG".
It happened maybe two or three major versions ago of Emacs. Japanese
fonts got the desired size, but English fonts remained small.
It was so annoying that I believe I disabled the choice of Japanese font
size using X11 resources. It happened many months ago on non-4K display.

And I notice this c-x c-+ does not work for electric-buffer mode. Inside
electric-buffer mode, c-x is eaten by the electric buffer mode itself
and so this doesn't work.

So I probably have to do something about the size of various fonts
either in my .emacs start up or maybe using X11 resource properly(?).
There seems to be a method to selectively change the size of a given
font used inside a buffer.
It is a bit unfriendly and beside I have no idea if the size of fonts
used for status line and electric-buffer-mode is tweaked in the similar
manner.

Any thoughts/tips?

Yes, I agree it is wonderful that one can tweak each font for frame,
buffer, etc. as much as one wants, but there ought to be a single
wrapper that allows one to say, I want all the font to be 150 pixel
height or 1.4 times the current size to move to a new display terminal
with different physical pixel size. Hmm, it DOES sound to be a good
exercise to use X11 resources, but I suspect there are Windows users who
need this global font size change including electric-buffer mode buffer
and status line and so non-X11 solution is preferred.


TIA

Chiaki


Reply | Threaded
Open this post in threaded view
|

Re: Changing font size of all the buffers including the status line and the characters shown in electric-buffer

Tak Kunihiro-3
> So I probably have to do something about the size of various fonts
> either in my .emacs start up or maybe using X11 resource properly(?).
> There seems to be a method to selectively change the size of a given
> font used inside a buffer.

I configure Japanese font in the following manner.  HTH.

(defun sesame-set-font (font)
  "Set Japanese font."
  (interactive
   (list (let ((collection '("NasuM-14"
                             "Myrica M-14"
                             "MyricaM M-14"
                             "Noto Sans Mono CJK JP Regular-12"
                             "Noto Sans Mono CJK JP Regular-14"
                             "Ricty Diminished Discord-12"
                             "Ricty Diminished Discord-15"
                             "MigMix 1M-10")))
           (completing-read "Font: " collection nil t (car collection)))))

  (if (member (car (split-string font "-")) (font-family-list))
      (progn
        (set-frame-font font t)
        (add-to-list 'default-frame-alist `(font . ,font)))
    (message "Font %s not found" font)))
(sesame-set-font "NasuM-14")

Reply | Threaded
Open this post in threaded view
|

Re: Changing font size of all the buffers including the status line and the characters shown in electric-buffer

Kaushal Modi
In reply to this post by ISHIKAWA,chiaki
ISHIKAWA,chiaki <[hidden email]> wrote:

> Hi,
>
> Inside a buffer, I can do c-x c-+ to enlarge the font of the text INSIDE
> that buffer, but the characters shown on the window pane, so to speak
> does not become larger, neither the characters on the status line.
>

Hello Chiaki,

I'm on my phone, so just posting a link to my config:
https://github.com/kaushalmodi/.emacs.d/blob/master/setup-files/setup-visual.el

In there, you can search for "Global Font Resize". I use set-face-attribute
to resize *all* fonts, including the ones in the mode line, etc. The
function under that title depends on the default-font-size-pt defvar that I
define in the same file.

See if that works for you, or let me know if you need a more portable
version of that code.

>
Reply | Threaded
Open this post in threaded view
|

Re: Changing font size of all the buffers including the status line and the characters shown in electric-buffer

Marco Wahl-2
In reply to this post by ISHIKAWA,chiaki
Hi!

"ISHIKAWA,chiaki" <[hidden email]> writes:

> It is the font size of Emacs. The default is way too small on this 4K
> display and I would like to show the characters and big and
> beautiful. There are times when I want to see as many characters
> possible. But most of the times, I want to see big and crisp
> characters due to my age.

Occasionally I use these functions to increase/decrease the font size in
Emacs and in particular in the modeline.

(defun mw-increase-face-height ()
  (interactive)
  (let ((before-height (face-attribute 'default :height)))
    (cl-loop while (and (< change 42)
                        (= before-height (face-attribute 'default :height)))
             with change = 1
             do (progn
                  (set-face-attribute
                   'default nil
                   :height (max 1 (+ before-height change)))
                  (sit-for 0))
             (cl-incf change))
    (message "face height: %d" (face-attribute 'default :height))))

(defun mw-decrease-face-height ()
  (interactive)
  (let ((before-height (face-attribute 'default :height)))
    (cl-loop while (and (< change 42) (= before-height (face-attribute 'default :height)))
             with change = 1
             do (progn
                  (set-face-attribute
                   'default nil
                   :height (max 1 (- before-height change)))
                  (sit-for 0))
             (cl-incf change)))
  (message "face height: %d" (face-attribute 'default :height)))


HTH and ciao,
             Marco

Reply | Threaded
Open this post in threaded view
|

Re: Changing font size of all the buffers including the status line and the characters shown in electric-buffer

Van L
In reply to this post by ISHIKAWA,chiaki

> Any thoughts/tips?

You can try load these functions in your .emacs

┌────
│  1  ;; To use:
│  2  ;;         M-x x-setface-height RET 300 RET
│  3  
│  4  (defun x-setface-height (number)
│  5    "Face height is set to NUMBER."
│  6    (interactive "nInsert number: ")
│  7    (set-face-attribute 'default (selected-frame) :height number))
│  8  
│  9  (defun set-face-height-360 ()
│ 10    "Set height of face to 360"
│ 11    (interactive)
│ 12    (set-face-attribute 'default (selected-frame) :height 360))
│ 13  ;; shortcut key
│ 14  (global-set-key (kbd "C-c o") 'set-face-height-360)
│ 15  
│ 16  (defun set-face-height-720 ()
│ 17    "Set height of face to 720"
│ 18    (interactive)
│ 19    (set-face-attribute 'default (selected-frame) :height 720))
│ 20  ;; shortcut key
│ 21  (global-set-key (kbd "C-c O") 'set-face-height-720)
│ 22  
└────

> Yes, I agree it is wonderful that one can tweak each font for frame, buffer, etc. as much as one wants, but there ought to be a single wrapper that allows one to say, I want all the font to be 150 pixel height or 1.4 times the current size to move to a new display terminal with different physical pixel size. Hmm, it DOES sound to be a good exercise to use X11 resources, but I suspect there are Windows users who need this global font size change including electric-buffer mode buffer and status line and so non-X11 solution is preferred.

To set the default face height go hunting in

M-x customize-group RET faces RET

Basic Faces
  Default
    Height



Reply | Threaded
Open this post in threaded view
|

Re: Changing font size of all the buffers including the status line and the characters shown in electric-buffer

ISHIKAWA,chiaki
In reply to this post by ISHIKAWA,chiaki
Thank you all the help posted to this mailing list.

After looking at the tips posted so far, I tested the one posted by Van L.:

M-x customize-group RET faces RET

Basic Faces
   Default
     Height

I did not realize the change to this is propagated to Japanese fonts as well as dired mode font faces (which I presume are used electric-dired mode). Sure the characters in modeline also becomes large, too.

So, although I rarely use customization feature of emacs, this time I am a happy user of this.
For those who are unfamiliar with customization (maybe I am in the minority?),
here is how you change the height.
After M-x customize-group RET faces RET You click on the Basic Faces line using mouse, and then
using [Tab] to move to the Default font entry.
Then hit RET/ENTER, a set of editable entries will appear.
In my case, the height section contains size (in 1/10 pt) and it was 101.
I rewrote it to 202 and from the [STATUS] button, saved the value for future sessions (as well as for the current session).

Voila the character size including the modeline, the buffers (Japanese characters and ASCII English characters both are affected), and electric-dired mode all became twice as large and I am a happy user now.

I will study the other tips/hints and see how they compare to the solution above.

Thank you, everybody!


Happy Hacking (in the good old sense of the phrase).

Chiaki




On 2018/10/10 20:37, ISHIKAWA,chiaki wrote:

> Hi,
>
> I run Emacs under linux. I am happy with Emacs and most of my writing
> document is done using Emacs even if the final draft is created using
> MS Word by request.
> Thanks to the support of unicode these days, handling Japanese as well
> as English is great.
>
>
> One gripe. Ever since I switched to 4K display (well actually, it is
> more like 3840x2160 @30Hz  due to my poor graphics adapter), one thing
> bothers me.
>
> It is the font size of Emacs. The default is way too small on this 4K
> display and I would like to show the characters and big and beautiful.
> There are times when I want to see as many characters possible. But
> most of the times, I want to see big and crisp characters due to my age.
>
> Anyway, I checked Emacs Wiki.
> https://www.emacswiki.org/emacs/SetFonts
> There does NOT seem to be a universal method that can enlarge the font
> size
> of buffers including one for electric-buffer mode and status line in
> one go.
>
>
> Inside a buffer, I can do c-x c-+ to enlarge the font of the text
> INSIDE that buffer, but the characters shown on the window pane, so to
> speak does not become larger, neither the characters on the status line.
> Of course, each time a new buffer/window by visiting a new file is
> created, it is shown  in the small default size.
> (I am a bit bothered by the description of a potential bug in the wiki:
> --- quote
> BUG? – If you use a fontset with Xft, `|C-x C-+|’ this does not scale
> the secondary font. For example, If you use a fontset –
> |dejavu-sans-mono| for latin, |NanumGothic_Coding| for hangul(Korean)
> – , increasing the text size does not scale the Korean characters. –
> cinsk <https://www.emacswiki.org/emacs/cinsk>
>
> ---end quote
> I am using Japanese fonts with ordinary ASCII English fonts.
> As far as I can tell, somehow my Japanese text buffer with
> interspersed ASCII roman characters and digits do get resized properly
> with c-x c-+ keystrokes.
> Maybe I am not using a "fontset" currently.
> I recall setting the size using X11 resources long time ago, and now I
> have just realized that the discrepancy of the sizes of Japanese fonts
> and ASCII English fonts which I experienced are due to this "BUG".
> It happened maybe two or three major versions ago of Emacs. Japanese
> fonts got the desired size, but English fonts remained small.
> It was so annoying that I believe I disabled the choice of Japanese
> font size using X11 resources. It happened many months ago on non-4K
> display.
>
> And I notice this c-x c-+ does not work for electric-buffer mode.
> Inside electric-buffer mode, c-x is eaten by the electric buffer mode
> itself and so this doesn't work.
>
> So I probably have to do something about the size of various fonts
> either in my .emacs start up or maybe using X11 resource properly(?).
> There seems to be a method to selectively change the size of a given
> font used inside a buffer.
> It is a bit unfriendly and beside I have no idea if the size of fonts
> used for status line and electric-buffer-mode is tweaked in the
> similar manner.
>
> Any thoughts/tips?
>
> Yes, I agree it is wonderful that one can tweak each font for frame,
> buffer, etc. as much as one wants, but there ought to be a single
> wrapper that allows one to say, I want all the font to be 150 pixel
> height or 1.4 times the current size to move to a new display terminal
> with different physical pixel size. Hmm, it DOES sound to be a good
> exercise to use X11 resources, but I suspect there are Windows users
> who need this global font size change including electric-buffer mode
> buffer and status line and so non-X11 solution is preferred.
>
>
> TIA
>
> Chiaki
>
>
>
>