FXML and high dpi screens

Danno Ferrin danno.ferrin at shemnon.com
Fri May 17 17:24:03 PDT 2013

I'm not to familiar with the nitty gritty of the details of the apps, but
as far as I can tell windows will still respect pixel for pixel sizes, it
will just tell you that the 10pt fonts are 12, 15, or 18px for the default

So like any good issue this has opened multiple venues for a good fix.  The
pixel level mashing similar to what is done for apple and retina os
somthing outside of my comfort zone.

However, letting the users specify units in their FXML looks to me to have
utility outside of this issue.  For example you could specify your progress
bar as a real percent rather than a float (progress="80%" vs
progress=".8").  I've opened a bug and submitted an inital patch for this
approach.  https://javafx-jira.kenai.com/browse/RT-30471

On Fri, May 17, 2013 at 5:01 PM, Jim Graham <james.graham at oracle.com> wrote:

> The way we deal with platform "stretching" for retina displays is to tell
> the platform that we are HiDPI aware and do the "pixel stretching"
> ourselves, but this is using only the MacOS APIs for DPI communication.
> We have an outstanding Jira issue to do the same thing for Windows 8, but
> we haven't investigated what that involves yet, primarily because there
> hadn't been a major hardware shipment of Win8 HiDPI screens at the time we
> implemented Retina support.  It sounds like the new Surface hardware might
> be opening that box on the Windows side now.
> If we'd implemented retina support entirely by suggesting a different EM
> to the CSS code then only code that used CSS for sizing would look good.
>  The solution we used for Retina scales all content appropriately
> including, implicitly, the CSS EM sizing...
>                         ...jim
> On 5/16/13 11:51 AM, Danno Ferrin wrote:
>> Executive summary: Is there any way in FXML to specify the sizes of the
>> components in units other than pixels?  Either now or in the future?
>> So I am running a Java Swing Application on a Surface tablet with multiple
>> embedded FXPanels (mostly to deal with cross toolkit dialog modality... an
>> issue for another thread).  In order to not get the horrible blurred view
>> (since surface does 150% font scaling) I turn off the dpi fixing for the
>> java app, so the swing app is pixel to pixel for the most part, with some
>> dramatic sizing issues with the XP theming (an issue I don't expect ever
>> to
>> be fixed).
>> So I have an FXML panel that is supposed to be 560x400, and I literally
>> get
>> 560px by 400px.  But the widgets are all sized in EM, which respects the
>> native DPI scale.  I don't want to turn that off, because in this case I
>> like it.  But the widgets scale up, so it sizes like a 373.333x266.666
>> panel.  What I do want to be able to do is specify the FXML sizes in EM,
>> so
>> I would call it 35em x 25em.  Is there a way in FXML to specify these?  Or
>> will I have to do multiple FXMLs mechanically scaling the sizes up.  Or is
>> there some escape sequence or auxiliary data I can add to say "scale pixel
>> sizes by 150%"?

More information about the openjfx-dev mailing list