controlsfx / controlsfx

High quality UI controls to complement the core JavaFX distribution
https://controlsfx.org
BSD 3-Clause "New" or "Revised" License
1.57k stars 269 forks source link

Custom font is invisible #1392

Open Richard-Tang opened 3 years ago

Richard-Tang commented 3 years ago
package com.funnysec.richardtang.androidkiller4j;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import org.controlsfx.glyphfont.Glyph;
import org.controlsfx.glyphfont.GlyphFont;
import org.controlsfx.glyphfont.GlyphFontRegistry;

public class Demo extends Application {

    static {
        GlyphFontRegistry.register("FaSolide", "file:///Users/richardtang/Desktop/GitProject/AndroidKiller4J/css/fa-solid.ttf", 20);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        GlyphFont FONT_AWESOME_SOLIDE = GlyphFontRegistry.font("FaSolide");
        Glyph     glyph               = FONT_AWESOME_SOLIDE.create("\uf2b5").size(20);
        StackPane stackPane           = new StackPane();
        stackPane.getChildren().addAll(new Button("test", glyph));

        primaryStage.setHeight(300);
        primaryStage.setWidth(300);
        primaryStage.setScene(new Scene(stackPane));
        primaryStage.show();
    }
}

Don't show ICONS

image

icon unicode: https://fontawesome.com/v5.15/icons/handshake?style=solid

ttf download: https://fontawesome.com/download

image

image

Richard-Tang commented 3 years ago

famliyName use "icomoon" is visible,but use other is invisible。 why? :(

hrzafer commented 2 years ago

Same issue here. I see an empty box though.

GlyphFontRegistry.register("Font Awesome 5 Free Regular", "C:\\Users\\harun\\workspace\\ma-desktop\\src\\main\\resources\\fa-regular-400.ttf", 16);
Glyph icon = GlyphFontRegistry.font("Font Awesome 5 Free Regular").create('\uf328').size(16);
fixButton.setGraphic(icon);

image