// Path: app/src/main/java/com/annimon/hotarufx/exceptions/TypeException.java
// public class TypeException extends HotaruRuntimeException {
// 
//     public TypeException(String message) {
//         super(message);
//     }
// 
//     public TypeException(String message, SourcePosition start, SourcePosition end) {
//         super(message, start, end);
//     }
// }


import com.annimon.hotarufx.exceptions.TypeException;
import javafx.scene.text.Font;
import javafx.scene.text.FontPosture;
import javafx.scene.text.FontWeight;
        init();
    }

    private void init() {
        final var map = super.getMap();
        map.put("family", new StringValue(font.getFamily()));
        map.put("isItalic", NumberValue.fromBoolean(font.getStyle().toLowerCase().contains("italic")));
        final var weight = FontWeight.findByName(font.getStyle());
        map.put("weight", NumberValue.of(weight != null
                ? (weight.getWeight())
                : FontWeight.NORMAL.getWeight()));
        map.put("size", NumberValue.of(font.getSize()));
    }

    @Override
    public int type() {
        return Types.MAP;
    }

    public Font getFont() {
        return font;
    }

    @Override
    public Object raw() {
        return font;
    }

    @Override
    public Number asNumber() {
// Path: app/src/main/java/com/annimon/hotarufx/exceptions/TypeException.java
// public class TypeException extends HotaruRuntimeException {
// 
//     public TypeException(String message) {
//         super(message);
//     }
// 
//     public TypeException(String message, SourcePosition start, SourcePosition end) {
//         super(message, start, end);
//     }
// }


// Path: app/src/main/java/com/annimon/hotarufx/lib/FontValue.java
import com.annimon.hotarufx.exceptions.TypeException;
import javafx.scene.text.Font;
import javafx.scene.text.FontPosture;
import javafx.scene.text.FontWeight;

        init();
    }

    private void init() {
        final var map = super.getMap();
        map.put("family", new StringValue(font.getFamily()));
        map.put("isItalic", NumberValue.fromBoolean(font.getStyle().toLowerCase().contains("italic")));
        final var weight = FontWeight.findByName(font.getStyle());
        map.put("weight", NumberValue.of(weight != null
                ? (weight.getWeight())
                : FontWeight.NORMAL.getWeight()));
        map.put("size", NumberValue.of(font.getSize()));
    }

    @Override
    public int type() {
        return Types.MAP;
    }

    public Font getFont() {
        return font;
    }

    @Override
    public Object raw() {
        return font;
    }

    @Override
    public Number asNumber() {
        throw new TypeException("Cannot cast font to number");