Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not gotting my Custom icon in my button #145

Open
salmantln opened this issue Sep 6, 2021 · 5 comments
Open

Not gotting my Custom icon in my button #145

salmantln opened this issue Sep 6, 2021 · 5 comments

Comments

@salmantln
Copy link

salmantln commented Sep 6, 2021

I followed the docs on https://kordamp.org/ikonli/#_authoring to try and get my custom icon into my button. But when I try it, I get and use CAPTCHA("my-icon-captcha", '\uE001'); i get a checkmark icon:
image

I use the site https://fontello.com/ to create my custom icon.
image

public enum MyIcon implements Ikon {
    CAPTCHA("my-icon-google_recaptcha-icon", '\uE800');

    public static MyIcon findByDescription(String description) {
        for (MyIcon font : values()) {
            if (font.getDescription().equals(description)) {
                return font;
            }
        }
        throw new IllegalArgumentException("Icon description '" + description + "' is invalid!");
    }

    private String description;
    private int code;

    MyIcon(String description, int code) {
        this.description = description;
        this.code = code;
    }

    @Override
    public String getDescription() {
        return description;
    }

    @Override
    public int getCode() {
        return code;
    }
}

This is what I get when i am trying to use MyIcon:
image

how can i make sure that i get my own icon?

@aalmiray
Copy link
Collaborator

aalmiray commented Sep 6, 2021

This could be a problem with the font family name

@salmantln
Copy link
Author

Any idea what the font family name should be or how i can get it?

@aalmiray
Copy link
Collaborator

aalmiray commented Sep 6, 2021

The font family should be able to be set using the fontello app. Personally I use use the icomoon to create fonts. There should be a setting that lets you specify a custom font family name. If there isn't then you could switch to icomoon or use a font editor (I use FontForge on OSX) to set the value.

@RealThanhpv
Copy link

RealThanhpv commented Dec 20, 2021

I tried the font file materialdesign-pack of this lib, with the same family name but still hit the same problem.
image

Any helps is highly appreciated.

@azurief
Copy link

azurief commented Apr 11, 2024

If it can help some people who faced this problem.
In order for the icon to be displayed properly, the CSS file associated to the font file (fontello generates 5) need to be loaded in the scene of your javafx program.

Some adjustments to the CSS might be necessary regarding the url defined in the @font-face block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants