Explanation of different scaling factors anywhere?

Mike Hearn mike at plan99.net
Mon Jan 27 15:59:45 UTC 2020


Hello,

A feature I often miss when using non-web GUIs is support for browser style
zooming. In JavaFX it is quite easy to specify all font sizes in terms of
"ems", relative sizes ("largest") or percentages and then adjust the base
font size on a root node inside key handlers. This works OK but doesn't do
much for images or other controls, and of course most JavaFX GUI code
specifies sizes in terms of pixels.

There are various scaling factors applied to pixel sizes. There is the
per-node scaling transform, but this doesn't affect layout so isn't
comparable to what browsers do. There's a per-screen DPI, there's a
"platform scale", there's a "render scale" and then there's a "ui scale".
These seem related to hidpi/retina support and are all internal (for the
purposes of this question I'm happy to modify JavaFX itself).

Render scale seems to affect resolution without affecting positions or
layout, so that's not quite what I want. UI scale sounds promising but
isn't documented and I couldn't quite figure it out by reading the code,
though I could just fiddle with it and see what happens.

It feels like someone probably explored this before now. Is there a way to
effectively expand the size of every node without altering the size of the
containing viewport, to get browser-style layout affecting  zoom?  If not,
has anyone explored the complexity of the modifications required?

thanks,
-mike


More information about the openjfx-dev mailing list