Skip to content

Commit

Permalink
change FontUtil.loadFont() methods to not close the provided InputStr…
Browse files Browse the repository at this point in the history
…eam. That is the caller's responsibility.
  • Loading branch information
xzel23 committed Oct 4, 2023
1 parent e17ee6c commit e351a8d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public double getTextHeight(CharSequence s, Font f) {

@Override
public List<Font> loadFonts(InputStream in) throws IOException {
try (in) {
try {
java.awt.Font[] awtFonts = java.awt.Font.createFonts(in);
List<Font> fonts = new ArrayList<>(awtFonts.length);
for (var awtFont : awtFonts) {
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit e351a8d

Please sign in to comment.