On Thu, 23 Apr 2020 23:58:19 GMT, John Neffenger <github.com+1413266+jgn...@openjdk.org> wrote:
>> 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: >>  >>  >> 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. 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. ------------- PR: https://git.openjdk.java.net/jfx/pull/193