diff --git a/core/PFont.java b/core/PFont.java index 5c9244c44..2740f9ce8 100644 --- a/core/PFont.java +++ b/core/PFont.java @@ -27,6 +27,7 @@ package processing.core; import java.io.*; import java.util.*; +import java.util.zip.*; // value[] could be used to build a char to byte mapping table @@ -127,14 +128,12 @@ public class PFont implements PConstants { //this.parent = parent; //this.valid = false; - //try { String lower = filename.toLowerCase(); - if (lower.endsWith(".vlw") || lower.endsWith(".vlw.gz")) { - //load_vlw_font(filename); + if (lower.endsWith(".vlw")) { read(parent.openStream(filename)); - //} else if (lower.endsWith(".fbf")) { - //load_fbf_font(filename); + } else if (lower.endsWith(".vlw.gz")) { + read(new GZIPInputStream(parent.openStream(filename))); } else { throw new IOException("don't know what type of file that is"); diff --git a/core/PGraphics.java b/core/PGraphics.java index eb914a148..0dc3cddf0 100644 --- a/core/PGraphics.java +++ b/core/PGraphics.java @@ -31,7 +31,6 @@ import java.awt.event.*; import java.awt.image.*; import java.io.*; import java.net.*; -import java.util.zip.*; public class PGraphics extends PImage implements PConstants { @@ -5480,13 +5479,12 @@ public class PGraphics extends PImage implements PConstants { public InputStream openStream(String filename) throws IOException { InputStream stream = null; - boolean gz = filename.toLowerCase().endsWith(".gz"); if (filename.startsWith("http://")) { try { URL url = new URL(filename); stream = url.openStream(); - return gz ? new GZIPInputStream(stream) : stream; + return stream; } catch (MalformedURLException e) { e.printStackTrace(); @@ -5494,25 +5492,21 @@ public class PGraphics extends PImage implements PConstants { } } - try { - stream = getClass().getResourceAsStream(filename); - if (stream != null) return gz ? new GZIPInputStream(stream) : stream; - } catch (IOException e) { } + stream = getClass().getResourceAsStream(filename); + if (stream != null) return stream; - try { - stream = getClass().getResourceAsStream("data/" + filename); - if (stream != null) return gz ? new GZIPInputStream(stream) : stream; - } catch (IOException e) { } + stream = getClass().getResourceAsStream("data/" + filename); + if (stream != null) return stream; try { try { stream = new FileInputStream(new File("data", filename)); - if (stream != null) return gz ? new GZIPInputStream(stream) : stream; + if (stream != null) return stream; } catch (IOException e2) { } try { stream = new FileInputStream(filename); - if (stream != null) return gz ? new GZIPInputStream(stream) : stream; + if (stream != null) return stream; } catch (IOException e1) { } } catch (SecurityException se) { } // online, whups