sixcious / font-awesome-to-image

Generates Font Awesome icon images
MIT License
5 stars 1 forks source link

Add support for FontAwesome 6 #1

Open ijabz opened 1 year ago

ijabz commented 1 year ago

HI, I modified paths to

    private static final String ICONS_JSON_PATH = "metadata/icons.json";
    private static final String BRANDS_FONT_PATH = "otfs/Font Awesome 6 Brands-Regular-400.otf";
    private static final String REGULAR_FONT_PATH = "otfs/Font Awesome 6 Pro-Regular-400.otf";
    private static final String SOLID_FONT_PATH = "otfs/Font Awesome 6 Pro-Solid-900.otf";

but it then fails with

Initializing properties... Done!
        Initializing fonts... Done!
        Initializing icons... Done!
        Saving 3632 images... Exception in thread "main" java.lang.NullPointerException
        at FontAwesome.calcDrawPoint(FontAwesome.java:311)
        at FontAwesome.buildImage(FontAwesome.java:272)
        at FontAwesome.buildAndSaveImages(FontAwesome.java:228)
        at FontAwesome.main(FontAwesome.java:88)

Dont know why, would it be possible to get this working with FontAwsome 6

sixcious commented 1 year ago

Hi ijabz!

This is a blast from the past; I haven't worked on this in a very long time.

I was able to update FontAwesome.java to support Font Awesome Version 6. I had to replace the deprecated Java Nashorn code with my own custom JSON parser.

I tested it with the latest Java 20 (OpenJDK) and Font Awesome 6.3.0 for Desktop and it generated about 1.8K icons using the default command java FontAwesome all all 128 615492 1/8.

I hope it works for you.

ijabz commented 1 year ago

Thankyou!