ADDITIONAL SYSTEM INFORMATION :
Tested under various versions of Java 8 and Java 10. Specific versions include jdk1.8.0_181 and jdk 10.0.2+13. This report is from a MacBook Pro running macOS Mojave 10.14.4 (the behavior was also verified on other systems running OS-X).
A DESCRIPTION OF THE PROBLEM :
Certain CSS attributes are ignored under OS-X, specifically, attributes "-fx-font-weight: bold;" and "-fx-font-style: italic;" In the test program given below, these attributes work as expected under Windows and Linux.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create an ordinary label in a GridPane, in an otherwise empty application. Reference a stylesheet. Apply a few styles, to verify that the stylesheet is working. Apply the style attributes "-fx-font-weight: bold;" and "-fx-font-style: italic;" and note that these have no effect.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Text styled with "-fx-font-weight: bold;" should be displayed bold. Text styled with "-fx-font-style: italic;" shoudl be italic.
ACTUAL -
Text does not display in bold or italic, despite the style attributes.
---------- BEGIN SOURCE ----------
public class CssProblem extends Application {
private int value; // our business data
Label label1 = new Label("A simple label - normal");
Label label2 = new Label("A simple label - italic");
Label label3 = new Label("A simple label - bold");
public static void main(String[] args) {
launch();
}
@Override
public void start(Stage stage) throws Exception {
GridPane root = new GridPane();
label2.setId("italic");
label3.setId("bold");
root.add((label1), 0, 0);
root.add((label2), 0, 1);
root.add((label3), 0, 2);
Scene scene = new Scene(root);
scene.getStylesheets().add(getClass().getResource("CssProblem.css").toExternalForm());
stage.setScene(scene);
stage.setTitle("Bold italic problem");
stage.show();
}
}
--- StyleSheet ---
.label {
-fx-font-size: 24px;
-fx-text-fill: #008080;
-fx-border-insets: 5px;
-fx-border-color: black;
-fx-border-width: 2px;
-fx-min-width: 200;
}
#bold {
-fx-font-weight: bold;
-fx-text-fill: #80231b;
}
#italic {
-fx-font-style: italic;
-fx-text-fill: #148046;
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No known workaround
FREQUENCY : always
Tested under various versions of Java 8 and Java 10. Specific versions include jdk1.8.0_181 and jdk 10.0.2+13. This report is from a MacBook Pro running macOS Mojave 10.14.4 (the behavior was also verified on other systems running OS-X).
A DESCRIPTION OF THE PROBLEM :
Certain CSS attributes are ignored under OS-X, specifically, attributes "-fx-font-weight: bold;" and "-fx-font-style: italic;" In the test program given below, these attributes work as expected under Windows and Linux.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create an ordinary label in a GridPane, in an otherwise empty application. Reference a stylesheet. Apply a few styles, to verify that the stylesheet is working. Apply the style attributes "-fx-font-weight: bold;" and "-fx-font-style: italic;" and note that these have no effect.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Text styled with "-fx-font-weight: bold;" should be displayed bold. Text styled with "-fx-font-style: italic;" shoudl be italic.
ACTUAL -
Text does not display in bold or italic, despite the style attributes.
---------- BEGIN SOURCE ----------
public class CssProblem extends Application {
private int value; // our business data
Label label1 = new Label("A simple label - normal");
Label label2 = new Label("A simple label - italic");
Label label3 = new Label("A simple label - bold");
public static void main(String[] args) {
launch();
}
@Override
public void start(Stage stage) throws Exception {
GridPane root = new GridPane();
label2.setId("italic");
label3.setId("bold");
root.add((label1), 0, 0);
root.add((label2), 0, 1);
root.add((label3), 0, 2);
Scene scene = new Scene(root);
scene.getStylesheets().add(getClass().getResource("CssProblem.css").toExternalForm());
stage.setScene(scene);
stage.setTitle("Bold italic problem");
stage.show();
}
}
--- StyleSheet ---
.label {
-fx-font-size: 24px;
-fx-text-fill: #008080;
-fx-border-insets: 5px;
-fx-border-color: black;
-fx-border-width: 2px;
-fx-min-width: 200;
}
#bold {
-fx-font-weight: bold;
-fx-text-fill: #80231b;
}
#italic {
-fx-font-style: italic;
-fx-text-fill: #148046;
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No known workaround
FREQUENCY : always
- relates to
-
JDK-8176835 [macosx] System font cannot be boldened
-
- Open
-