简体   繁体   中英

Font is bold on Ubuntu 18.04, but not on 18.10

在此处输入图片说明

Running a JavaFX application on Ubuntu 18.04 turns the font bold, but on 18.10 it looks as it should.

The image shows (from left to right)

  1. The window on 18.10,
  2. the window on 18.04, and
  3. the window in Scenebuilder preview running on 18.04.

I'm running Ubuntu 18.10 and 18.04. My application uses openjdk-11.

java -version returns:

on 18.10:

openjdk version "11.0.1" 2018-10-16
OpenJDK Runtime Environment (build 11.0.1+13-Ubuntu-3ubuntu3.18.10.1)
OpenJDK 64-Bit Server VM (build 11.0.1+13-Ubuntu-3ubuntu3.18.10.1, mixed mode, sharing)

on 18.04:

openjdk version "11.0.1" 2018-10-16
OpenJDK Runtime Environment (build 11.0.1+13-Ubuntu-3ubuntu118.04ppa1)
OpenJDK 64-Bit Server VM (build 11.0.1+13-Ubuntu-3ubuntu118.04ppa1, mixed mode, sharing)

After some digging I found out that a file called Styles.css was loaded. Its content was the following:

.button {
    -fx-font-weight: bold;
}

On 18.10, it is ignored, on 18.04 it is not. Deleting these lines fixed it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM