0

I had to reinstall my OS but I made a backup of my .emacs.d. Then, once the new OS was installed, I copied it back and installed all the fonts. This time however, the scaling is really small! With the same .emacs.d, OS, machine and the fonts my Emacs scaling was fine before. emacs -Q is also tiny. lsb_release -a returns,

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.2 LTS
Release:    20.04
Codename:   focal

Here is how I installed it,

usr@machine:~$ apt policy emacs27
emacs27:
  Installed: 27.1~1.git86d8d76aa3-kk2+20.04
  Candidate: 27.1~1.git86d8d76aa3-kk2+20.04
  Version table:
 *** 27.1~1.git86d8d76aa3-kk2+20.04 500
        500 http://ppa.launchpad.net/kelleyk/emacs/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status

Here is how it looks,

enter image description here

Other people have had this issue and suggested solutions include changes to the init files but I ran this same init file on the same distro and things were fine. So what changed must be outside of my init?

Edit:

Instead of emacs27, I installed emacs, i.e.,

emacs:
  Installed: 1:26.3+1-1ubuntu2
  Candidate: 1:26.3+1-1ubuntu2
  Version table:
 *** 1:26.3+1-1ubuntu2 500
        500 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu focal/universe i386 Packages
        100 /var/lib/dpkg/status

This scales fine!

Edit 2:

I am using Iosevka. Note that the with the same font and init file, Emacs from Ubuntu's repositories renders fine.

scribe
  • 930
  • 4
  • 15
  • I think you'll probably need to provide more info, including what fonts you are using and whether they are different from what you used before. Be aware too that bitmap fonts don't scale. Also, say specifically what you're doing, to "scale" things. – Drew Mar 28 '21 at 23:12
  • I just installed the usual `emacs` package from the ubuntu repositories and guess what that scales fine but the `emacs27` from kelleyk's repository does not scale. I am doing nothing to scale things. It worked out of the box before, like it does with `emacs`. I am using the same font as I did before, i.e., Iosevka. – scribe Mar 29 '21 at 00:07
  • Note that Ubuntu's `emacs` is at 26.x something. – scribe Mar 29 '21 at 00:07
  • Please put all relevant info in the question itself. Comments can be deleted at any time. Thx. – Drew Mar 29 '21 at 01:11
  • The "scaling" terminology is very confusing, but the screenshot looks like a very small font for the `default` face? Have a look at `M-x customize-face RET default RET` – phils Mar 29 '21 at 05:01
  • from PPA description: The `emacs27` packages have `cairo`-based text rendering; this may cause issues with bitmapped fonts. – jue Mar 30 '21 at 00:53
  • @jue I don't think [Iosevka](https://typeof.net/Iosevka/) is a bitmap font? @phils I'll have to install `emacs27` again to explicitly check that but I do have this in my init file: `(add-to-list 'default-frame-alist '(font . "Iosevka-12"))`. – scribe Mar 31 '21 at 01:09

1 Answers1

1

Well, since I could not find any non-configuration file based solutions, I ended up adding this to my file.

(add-to-list 'default-frame-alist '(width  . 80))
(add-to-list 'default-frame-alist '(height . 24))
(add-to-list 'default-frame-alist ; High DPI Fix
  `(font . ,(let ((dims (nth 1 (frame-monitor-attributes)))
     (m (/ 1.0 388800.0)) (b (/ 23.0 3.0)))
     (format "Iosevka-%d" (+ (* m (nth 3 dims) (nth 4 dims)) b)))))

Replace Iosevka with whatever font you'd like to use. What we are doing here is linearly scaling the font-size y=mx+b where the slope and y-intercept were calculated using points (1920×1080, 13), (3840×2160, 29).

scribe
  • 930
  • 4
  • 15