Gentoo currently ships only dev-cpp/cairomm-1.12.0-r1 which is from 2015-09-22.
I'm trying to code HiDPI scaling in a program using: cairo_surface_set_device_scale
but compilation fails, the function is unknown. Maybe it's due to cairomm being too old.
Please bump it. The latest version is 1.15.5 from 2017-08-25:
1.5 is a development series.
All of these 1.5 versions even came with a note in NEWS, as follows:
(Distros should probably not package this yet.)
cairo_surface_set_device_scale is a C function, so newer cairomm won't help, however 1.5 might wrap the function in Cairo::Surface.
I suggest trying with a local 1.15.5 build, or use the C function from C++ with something like:
cairo_surface_set_device_scale(surface_ptr->cobject(), 2.0, 2.0)
Due to direct usage of C cairo, might want to have your build system deal with cairo.pc as well explicitly then.
I had a quick look at cairomm 1.15.5 tarball, and I can't see any wrapping of cairo_surface_set_device_scale still in there.
All that said, usually I don't think people should be calling this at all, but rather rely on the relevant HiDPI supporting functionality and API in the toolkit instead, which makes all this automatic and does the call for you for the cairo surfaces you get to draw on.
Mart, Cairo 1.5 is from 2008. Did you mean 1.15?
Regardless, this is a request for a bump to the latest stable version.
There is no mention of instability in the release notes of 1.15.12:
If 1.15 is a development line of release, there's 1.14:
Regarding the HiDPI problem, the code is basically:
Which fails during compilation:
error: ‘class Cairo::Surface’ has no member named ‘set_device_scale’; did you mean ‘set_device_offset’?
The Cairo docs show that both set_device_offset and set_device_scale are indeed methods for Cairo::Surface, and that set_device_scale is "New in version 1.14.0."
You may very well be right that this shouldn't need to be called, because it should be handled by GTK+, but I just wanted to give more details since you kindly responded.
Yes, I meant 1.15. It is a development release and I will not package it, just like the NEWS item says for all 1.15.x versions -> "(Distros should probably not package this yet.)".
With GNOME (and cairo) packages it is common that development releases carry an odd minor version number (while stable have even minor version number).
There is no 1.14.x releases of cairomm, so I can't package that either.
Additionally as I said, cairomm 1.15.x doesn't even have a set_device_scale method either - did you try locally? Yes, the C method is new in cairo-1.14, but I didn't see it wrapped in cairomm for C++... but as I alluded to, it might also be some magic that only shows up during compilation of cairomm against the cairo version, and I didn't try that.
If you use GTK+, I suggest to do it via that indeed - in practice, you shouldn't be changing it, but gtk should. If you want to force it over GTK+/GNOME global choice, there's probably a GTK+ API for this.
But to try to use cairo API directly to complete your test, I suggest to try using C API directly as I already gave an example; to translate that example to your example, this would be something like:
cairo_surface_set_device_scale(cs->cobject(), 2.0, 2.0)
(I use 2.0 instead of 2 because it takes a floating point and 2 isn't a floating point)
Mart thank you for the advice.
Since this issue is about bumping cairo/cairomm and that cannot be done currently, I will close it.