Loading stylesheet via StyleManager#addUserAgentStylesheet ignores css meta data "-glyph-name"

Issue #63 new
Gordon Damerau created an issue

Hello,

i tried to load global stylesheets via StyleManager#addUserAgentStylesheet instead of assigning them to each Scene in my application. I noticed that "-glyph-name" and "-glyph-size" of my css file are not evaluated in this case. I guess it is realted to FontAwesomeFX because the color of the icon is set correctly. Please see attached my example files.

Test.css

.glyph-icon.error {
    -fx-fill: red;
    -glyph-name: "EXCLAMATION_TRIANGLE";
    -glyph-size: 20;
}

App.java

public class SpinnerExample extends Application {
    final String fname = SpinnerExample.class.getResource("/resources/Test.css").toExternalForm();
    final boolean working = false;

    @Override
    public void start(Stage primaryStage) {
        FontAwesomeIconView iconView = new FontAwesomeIconView(FontAwesomeIcon.RANDOM, "10");
        iconView.getStyleClass().addAll("error");

        VBox pane = new VBox();
        pane.getChildren().add(iconView);

        Scene scene = new Scene(pane, 600, 250);

        if (!working) {
            Application.setUserAgentStylesheet(Application.STYLESHEET_MODENA);
            StyleManager.getInstance().addUserAgentStylesheet(fname);
        }

        if (working) {
            scene.getStylesheets().add(fname);
        }

        primaryStage.setScene(scene);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}

Due to restrictions in my project setup i'm unfortunately unable to use later versions.

Comments (0)

  1. Log in to comment