import javax.swing.*;
import java.awt.*;
import java.awt.font.TextAttribute;
import java.io.File;
import java.util.HashMap;
import java.util.Map;

public class Ligatures2Test {
    public static void main(String[] args) {
        SwingUtilities.invokeLater(() -> {
            JFrame frame = new JFrame();
            JLabel label = new JLabel("->");
            label.setFont(createFont());
            frame.add(label);
            frame.pack();
            frame.setVisible(true);
            frame.setLocationRelativeTo(null);
            frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        });
    }

    private static Font createFont() {
        try {
            Font font = Font.createFont(Font.TRUETYPE_FONT, new File(System.getProperty("user.home"), "Library/Fonts/Hasklig-Regular.noDFLT.otf"));
            Map<TextAttribute, Object> attributes = new HashMap<>();
            attributes.put(TextAttribute.SIZE, 30);
            attributes.put(TextAttribute.LIGATURES, TextAttribute.LIGATURES_ON);
            return font.deriveFont(attributes);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
