RFR: 8243255: Font size is large in JavaFX app with enabled Monocle on Raspberry Pi

John Neffenger github.com+1413266+jgneff at openjdk.java.net
Fri Apr 24 00:00:28 UTC 2020

On Thu, 23 Apr 2020 22:43:30 GMT, John Neffenger <github.com+1413266+jgneff at openjdk.org> wrote:

>> See the detailed issue description on: http://mail.openjdk.java.net/pipermail/openjfx-dev/2020-April/025975.html
>> The fix 8236448 https://github.com/openjdk/jfx/pull/75 changes
>> [MonocleApplication.staticScreen_getScreens()](https://github.com/openjdk/jfx/pull/75/files#diff-b66ff7fe72c6c5cd26003572ca901bfdL228)
>> method code from
>>> ns.getDPI(), ns.getDPI(), ns.getScale(), ns.getScale(), ns.getScale(), ns.getScale()
>>  to
>>  > ns.getWidth(), ns.getHeight(), 1.f, 1.f, ns.getScale(), ns.getScale()"
>> so the font size is not properly calculated based on the given DPI value.
>> I left the platformScaleX and platformScaleY as 1.f because I do not know how it affects Android/Dalvik platform. On
>> Raspberry Pi where I run JavaFX code with Monocle the DispmanScreen is used which have fixed scale 1.0 value so the app
>> works in the same way.
> I couldn't understand why I wasn't hitting this error on the embedded Monocle EPD platform. Stepping through the code
> with the debugger, I found that JavaFX is looking for the *javafx.platform.properties* file in the wrong place. I moved
> the file to its parent directory, the location JavaFX expects, and saw the problem right away.  The first image below
> shows the button and text without the properties file, and the second image shows the problem once the properties file
> is loaded:
> ![normal](https://user-images.githubusercontent.com/1413266/80154159-e05ac600-8573-11ea-897b-49a82baaa10f.png)
> ![toobig](https://user-images.githubusercontent.com/1413266/80154165-e3ee4d00-8573-11ea-8b67-45670b17b7f1.png)  So
> there might be a secondary problem. After unzipping the SDK archive under *$HOME/lib*, the properties file is located
> at the following location on my system:  /home/ubuntu/lib/armv6hf-sdk/lib/javafx.platform.properties
> Yet
> [`com.sun.javafx.PlatformUtil.loadProperties`](https://github.com/openjdk/jfx/blob/master/modules/javafx.base/src/main/java/com/sun/javafx/PlatformUtil.java#L248)
> looks in the following three locations, in order:  /home/ubuntu/lib/armv6hf-sdk/javafx.platform.properties
> /home/ubuntu/opt/jdk-14.0.1+7/lib/javafx.platform.properties
> /javafx.platform.properties
> The first is based on the "runtime directory," the second is based on the value of *java.home*, and the third is based
> on the value of *javafx.runtime.path*, which is `null` on my system.
> @AlexanderScherbatiy Did you move the *javafx.platform.properties* file to its parent directory manually, as I just did?

Wow, this is going to take some getting used to. �� Below is a photograph of the button and text with two changes:

1. the code from this pull request, and
2. the `javafx.platform.properties` file moved to its parent directory.


The native screen on this platform returns 167 for its DPI. In general, the devices I'm testing have pixel densities of
either 167 or 300 pixels per inch.


PR: https://git.openjdk.java.net/jfx/pull/193

More information about the openjfx-dev mailing list