[Top][All Lists]

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

Re: Scaling stuff for high dpi screens

From: Vincent Bernat
Subject: Re: Scaling stuff for high dpi screens
Date: Fri, 30 Jan 2015 16:19:43 +0100
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.4 (gnu/linux)

 ❦ 30 janvier 2015 11:05 +0100, David Kastrup <address@hidden> :

>>> (/ (display-pixel-width) (/ (display-mm-width) 25.4))
>> I don't understand c) either, but it is quite annoying, because I can't
>> find a suitable way/hook in which to call display-pixel/mm-width at a
>> time where they give the results I expect.

For some reason, I didn't get the original message and I don't have the
whole thread either. Sorry if it has already been told.

If you use GTK as a toolkit for your Emacs, DPI changes are
automatically handled. I was previously using Lucid and switched to GTK
for this reason. This works automatically in Gnome or likewise

If you have a more "basic" environment, you need something like
xsettingsd with the target DPI*1024:

Xft/DPI 98304

I generate one with this snippet:

sed +Xft/DPI+d  ~/.xsettingsd
dpi=$(xdpyinfo | awk  '$1 ~ /resolution:/ { print $2 }' | sed 's/x.*//')
echo Xft/DPI $(( $dpi * 1024 )) >> ~/.xsettingsd
pid=$(xprop -name xsettingsd _NET_WM_PID 2> /dev/null | awk '{print $NF}')
if [ x"$pid" = x ]; then
    xsettingsd -c ~/.xsettingsd &
    kill -HUP $pid

# Also use xrdb for very old stuff (you know, LibreOffice)
echo Xft.dpi: $dpi | xrdb -merge
#+END_SRC sh

However, note that the GTK version of Emacs can kill itself if a display
becomes unavailable because of some limitation of GTK.
Use library functions.
            - The Elements of Programming Style (Kernighan & Plauger)

reply via email to

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