RFR: 8243255: Font size is large in JavaFX app with enabled Monocle on Raspberry Pi
Alexander Scherbatiy
alexsch at openjdk.java.net
Fri Apr 24 08:22:13 UTC 2020
On Fri, 24 Apr 2020 01:27:42 GMT, John Neffenger <github.com+1413266+jgneff at openjdk.org> wrote:
>> 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.
>
> I got out my trusty C-Thru Ruler (GA-96), and the type now measures 12 points, just as intended.
>
> **PrismFontFactory.getSystemFontSize**
> } else if (isEmbedded) {
> try {
> int screenDPI = Screen.getMainScreen().getResolutionY();
> systemFontSize = ((float) screenDPI) / 6f; // 12 points
> } catch (NullPointerException npe) {
> // if no screen is defined
> systemFontSize = 13f; // same as desktop Linux
> }
> } else {
> systemFontSize = 13f; // Gnome uses 13.
> }
>
> Without the platform properties file, I've been running (for years!) with a default font size of 13 pixels, which on
> this device is very small: (13 px ÷ 167 px/in) × 72 points/in = 5.60 points.
> Now JavaFX is setting `isEmbedded` to `true`, picking up the correct screen DPI, and I'm finally getting a good default
> font size: ((167 px/in ÷ 6 per in) ÷ 167 px/in) × 72 points/in = 12.0 points. Amazing.
> @AlexanderScherbatiy Did you move the _javafx.platform.properties_ file to its parent directory manually, as I just did?
I used the full version of jdk 14.0.1 on Raspberry Pi where JavaFX is included in jdk so the file
_javafx.platform.properties_ is already in jdk-14.0.1-full/lib directory.
To debug the JavaFX on Raspberry Pi I built armv6hf-sdk and just copied the file _javafx.platform.properties_ from
the full jdk version with JavaFX to jdk-14.0.1/lib directory of jdk without JavaFX which I used to run my java
application with JavaFX modules from armv6hf-sdk/lib.
-------------
PR: https://git.openjdk.java.net/jfx/pull/193
More information about the openjfx-dev
mailing list