Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for graphics, UI elements on HiDPI displays #8770

Open
JonathanReeve opened this issue Apr 22, 2017 · 6 comments

Comments

Projects
None yet
3 participants
@JonathanReeve
Copy link

commented Apr 22, 2017

Description :octocat:

As described in #6005, Spacemacs starts out with everything looking very tiny on a HiDPI display. The workaround described in that bug, adjusting the font size to something huge (I'm using a 30-point font size), fixes text but not other UI elements. The ~ character that shows the ends of files is extremely small, and so is the line wrap character, the squiggle that denotes a misspelled word, and virtually any other bitmap image. For instance, the badge in the spacemacs buffer that says "built with Spacemacs," and the heart emoji below it, are both rendered smaller than they should be. Basically, it looks like emacs isn't truly scaling with the rest of the desktop.

I have a standard HiDPI setup, where I have the DPI adjusted in .Xresources and GNOME scaled to 2 using Tweak Tool. Other GTK3 applications scale perfectly.

screenshot from 2017-04-22 11-06-27

screenshot from 2017-04-22 11-19-01

This screenshot shows what is probably a side-effect of this bug: the PNG is displayed as huge inside the table (this is in the Spacemacs documentation), but when displayed in its own window, is microscopically small:

screenshot from 2017-04-22 11-40-55

This screenshot shows the extremely small size of the line continuation character next to the size of the text:

screenshot from 2017-04-24 16-17-39

A lot of threads about similar problems say to run emacs with the command GDK_SCALE= emacs, which is supposed to undo any scaling set by the environment variable. But setting or unsetting this variable doesn't seem to have any effect with Spacemacs. It has an effect on vanilla emacs (GDK_SCALE=2 GDK_DPI_SCALE=0.5 emacs -q makes vanilla Emacs look about right on my display), but these variables don't seem to have an effect on Spacemacs.

Reproduction guide 🐞

  • Start Spacemacs in a HiDPI display.
  • Notice that graphics are really tiny.

Observed behaviour: 👀 💔
Graphics of all sorts aren't scaled as they should be.

Expected behaviour: ❤️ 😄
Graphics described above should be scaled according to the user's desktop scaling preference.

System Info 💻

  • OS: gnu/linux
  • Emacs: 25.1.1
  • Spacemacs: 0.200.9
  • Spacemacs branch: master (rev. 8e1af14)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: helm
  • Layers:
(php vimscript yaml html helm auto-completion emacs-lisp emoji bibtex ipython-notebook mu4e git markdown python org journal
     (shell :variables shell-default-height 30 shell-default-position 'bottom)
     themes-megapack spell-checking syntax-checking vinegar)
  • System configuration features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11
@JonathanReeve

This comment has been minimized.

Copy link
Author

commented Apr 25, 2017

As an addendum, this is what Tetris looks like (the game is in the upper left corner):

screenshot from 2017-04-25 08-32-52

@JonathanReeve

This comment has been minimized.

Copy link
Author

commented May 15, 2017

One more. Notice the two uppercase mode indicators on the right are tiny compared to the others.

screenshot from 2017-05-15 17-09-32

@JonathanReeve

This comment has been minimized.

Copy link
Author

commented May 17, 2017

The phenomenon from the previous comment can be solved, I figured out, by just installing a font that has both uppercase and lowercase circled letters in its unicode glyphs. I installed the Linux Biolinum font, which solved the problem above.

@rdrey

This comment has been minimized.

Copy link

commented Nov 22, 2017

I'm in the same boat, definitely looks like an issue in spacemacs, since my emacs -q scales perfectly with no additional env variables set.

@jackkamm

This comment has been minimized.

Copy link
Contributor

commented Jan 23, 2018

To me this looks like an upstream problem with emacs, not a spacemacs problem. While emacs -Q has some things correctly scaled, such as toolbar icons, other things like inline images are not (e.g. in an orgfile or using insert-image). Also tetris is tiny.

At least, the scaling doesn't work on my setup -- would be interested to hear from anyone who has hidpi scaling working for inline images in emacs-Q.

@jackkamm

This comment has been minimized.

Copy link
Contributor

commented Jan 23, 2018

The following advice, while not perfect, seems to improve the situation. For example, it improves the spacemacs home buffer, org inline images, and EIN. Tetris is still tiny.

  ;; scale most images by 2
  (defun create-image-2x (oldfun file-or-data &optional type data-p &rest props)
    (let ((original (apply oldfun (append (list file-or-data type data-p) props))))
      (if (memq type '(xpm xbm pbm imagemagick)) ;not sure about xbm,pbm,imagemagick
          original
        (let* ((width-height (image-size original t))
               (width (car width-height))
               (height (cdr width-height))
               (width-2x (* 2 width))
               (height-2x (* 2 height))
               (newprops (plist-put props :format type))
               (newprops (plist-put newprops :width width-2x))
               (newprops (plist-put newprops :height height-2x))
               (newargs (append (list file-or-data 'imagemagick data-p) newprops)))
          (apply oldfun newargs)))))
  (advice-add 'create-image :around #'create-image-2x)

Basically it wraps most calls to create-image with a second call using imagemagick. I put it in my user-init.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.