MacOS Text Scaling




On Apr 27, 2017, at 3:58 PM, Emmanuele Bassi <ebassi gmail com> wrote:

On 27 April 2017 at 22:56, Brion Vibber <brion pobox com> wrote:
GTK+3 added native support for user interface scaling to support HiDPI
displays with consistently sized resources and widgets, with the limitation
that the scaling factor is an integer (1x, 2x, 3x...)

It's not really a "limitation": it's purposefully designed that way,
for windowing system surfaces and graphical assets. Font sizes support
fractional values, and have been doing so for a long while (since the
GTK+ 2.x days)

In general, the toolkit has no code to detect scaling factors at all,
and it relies on the system to convey meaning to those values.

This might be a bit of a digression, sorry.

Gdk has several scaling-dependent functions:  gdk_screen_(set|get)_resolution(), gdk_monitor_get_scale_factor, and gdk_(screen|monitor)_get_(height|width)_mm()
and I'm trying to figure out how to get the right behavior on MacOS HiDPI (aka retina) monitors. A couple of weeks ago I replaced an obsolete function ([NSScreen userSpaceScaleFactor]) [1] with a more-correct implementation that effectively does what it's supposed to, return 144dpi for retina and 72 for normal. Doing so causes the font-size to double; i.e. a 12-point font displays at 24-points.

I suspect that's because Pango calls gdk_screen_get_resolution(), but it also uses Apple's CoreText for rendering and layout on MacOS and I suspect that CoreText is already compensating for the retina screen, resulting in the doubled font scaling. Does that make sense? Is the correct solution to have Pango ignore resolution on MacOS or to always set GdkScreen resolution to 72? If the latter, what about the other functions that use scaling information and how to communicate to applications that they need to use larger icons and such?

Regards,
John Ralls




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