diff --git a/utility-swing/src/main/java/com/dua3/utility/swing/SwingFontUtil.java b/utility-swing/src/main/java/com/dua3/utility/swing/SwingFontUtil.java index 6796bebe..e7fd39c8 100644 --- a/utility-swing/src/main/java/com/dua3/utility/swing/SwingFontUtil.java +++ b/utility-swing/src/main/java/com/dua3/utility/swing/SwingFontUtil.java @@ -106,7 +106,7 @@ public double getTextHeight(CharSequence s, Font f) { @Override public List loadFonts(InputStream in) throws IOException { - try (in) { + try { java.awt.Font[] awtFonts = java.awt.Font.createFonts(in); List fonts = new ArrayList<>(awtFonts.length); for (var awtFont : awtFonts) { @@ -172,7 +172,7 @@ public java.awt.Font convert(Font font) { @Override public Font loadFontAs(InputStream in, Font font) throws IOException { - try (in) { + try { java.awt.Font[] awtFonts = java.awt.Font.createFonts(in); LangUtil.check(awtFonts.length > 0, () -> new IOException("no font loaded")); java.awt.Font awtFont = awtFonts[0].deriveFont(font.getSizeInPoints());