HiDPI

From Inkscape Wiki
Revision as of 16:11, 23 November 2017 by Tavmjong (talk | contribs)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

A page to track getting Inkscape to work at HiDPI.

HiDPI Branch

A HiDPI branch now exists on GitHub. Rendering seems to work but has not been tested fully. I expect breakage anywhere that uses bitmaps (images, tiling, patterns, etc.).

The GUI does not work. The wrong coordinates are probably returned for the cursor. The wrong tile is used in updating the canvas.

  • All Cairo image surfaces must be created with width/height in device pixels. cairo_image_surface_get_width()/height() returns width and height in device pixels.
  • All Cairo drawing calls remain the same. The device scale, set by cairo_surface_set_device_scale(), handles the transformation to a scaled Cairo surface.
  • Widget width/height allocation values are the same regardless of the device scale.
  • gtk_widget_get_scale_factor( widget ) returns device scale. It does not seem to reliably update when window is dragged between monitors with different device scales.


Gtk/Gdk Notes

Following with Fedora 25:

Under Wayland:

  • Gnome Tweak tool HiDPI setting does nothing (does work with Gtk3 Emacs and Firefox).
  • Export GDK_SCALE=2 does nothing. (No change visually or reported by Gdk::Window::get_scale_factor(), Gdk::Widget::get_scale_factor(), Gdk::Monitor::get_scale_factor(), Gdk::Screen::get_resolution.)
  • Export GDK_DPI_SCALE=2 increases text size by two. Does not effect icons. Does change Gdk::Screen::get_resolution(). (No change to xxx::get_scale_factor().)

Under Wayland using two side-by-side dummy monitors, one HiDPI, as described in the "HowDoI/HiDpi" page, link below.

  • xxx:get_scale_factor() reports 2 for HiDPI monitor, 1 for normal monitor.
  • Inkscape automatically scales properly when moved from monitor to monitor, except canvas is still blurry at hi DPI.
  • Gtk3/Cairo test program using Gtk::DrawingArea automatically adjust from monitor to monitor without blurring (except PNG icon).
    • Cairo device scale changes from 1 to 2 when moving window from normal monitor to hi DPI monitor.
  • Changing antialiasing does not fix blurry monitor.

Under X11:

  • Gnome Tweak tool HiDPI setting does nothing.
  • Export GDK_SCALE=2 scales icons, text, and canvas by two, but canvas is blurry. (Change reported by xxx:get_scale_factor() functions.)
  • Export GDK_DPI_SCALE=2 scales text by two. (Change reported by Gdk::Screen::get_resolution().)
  • Gtk3/Cairo test program using Gtk::DrawingArea shows a Cairo device scale of 2 with GDK_SCALE=2, no blurring (except PNG icon).

Setting cairo_surface_set_device_scale to 2,2 does produce a crisp image on a HiDPI monitor... but with all our custom code it is hard to see what else needs to change.

cairo_surface_create_similar() does copy device scale.

Gtk 3.26 has experimental fractional scaling for Wayland.


Misc

Under both Wayland and X11:

  • Tango icons display larger than default (hicolor).

Links