add error when using loadFont() with a non-vlw file

This commit is contained in:
Ben Fry
2014-11-19 21:48:07 -05:00
parent cd3e36bb9c
commit 03a4183432
+3
View File
@@ -5442,6 +5442,9 @@ public class PApplet implements PConstants {
* @see PApplet#createFont(String, float, boolean, char[])
*/
public PFont loadFont(String filename) {
if (!filename.toLowerCase().endsWith(".vlw")) {
throw new IllegalArgumentException("loadFont() only works with .vlw font files");
}
try {
InputStream input = createInput(filename);
return new PFont(input);