A page to track getting Inkscape to work at HiDPI.
Branch has been merged with master.
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 now works (after changing SPCanvas::paintSingleBuffer() to allow for device scale).
- 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.
Inkscape's cursors do scale under both X11 and Wayland but are blurry. Under X11, system cursors do not scale; under Wayland they do scale and are not blurry. We construct our own cursors from XPM files to allow for coloring the "stroke" and "fill". The code is in 'src/sp-cursor.cpp'. Might be possible to fix this using themed icons...
Editing controls like nodes and arrows are scaled under both X11 and Wayland but
are were blurry.
Control knots are draw in src/display/sodipodi-ctrl.cpp (note the two enums SPCtrlShapeType and SPKnotShapeType match... very confusing when tracing through code).
Still to do
Testing! At least the turbulence filter primitive needs to be adapted for high DPI. DONE
Following with Fedora 25:
- 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.
- 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.
Under both Wayland and X11:
- Tango icons display larger than default (hicolor).