Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,19 @@ protected CompoundTag save(CompoundTag tag) {
@Override
protected FontFace load(CompoundTag tag) {
String family = tag.getStringOr("family", "");
FontInfo.Type type;
FontInfo.Type type = FontInfo.Type.fromString(tag.getStringOr("type", ""));

try {
type = FontInfo.Type.valueOf(tag.getStringOr("type", ""));
} catch (IllegalArgumentException _) {
set(Fonts.DEFAULT_FONT);
return get();
}

boolean changed = false;
for (FontFamily fontFamily : Fonts.FONT_FAMILIES) {
if (fontFamily.getName().equals(family)) {
set(fontFamily.get(type));
changed = true;
if (!fontFamily.getName().equals(family)) continue;

FontFace face = fontFamily.get(type);
if (face != null) {
set(face);
return get();
}
}
if (!changed) set(Fonts.DEFAULT_FONT);

set(Fonts.DEFAULT_FONT);
return get();
}

Expand Down