MCPcopy Index your code
hub / github.com/benfry/processing4 / createFont

Method createFont

core/src/processing/core/PGraphics.java:4214–4242  ·  view source on GitHub ↗
(String name, float size,
                             boolean smooth, char[] charset)

Source from the content-addressed store, hash-verified

4212
4213
4214 protected PFont createFont(String name, float size,
4215 boolean smooth, char[] charset) {
4216 String lowerName = name.toLowerCase();
4217 Font baseFont;
4218
4219 try {
4220 InputStream stream = null;
4221 if (lowerName.endsWith(".otf") || lowerName.endsWith(".ttf")) {
4222 stream = parent.createInput(name);
4223 if (stream == null) {
4224 System.err.println("The font \"" + name + "\" " +
4225 "is missing or inaccessible, make sure " +
4226 "the URL is valid or that the file has been " +
4227 "added to your sketch and is readable.");
4228 return null;
4229 }
4230 baseFont = Font.createFont(Font.TRUETYPE_FONT, parent.createInput(name));
4231
4232 } else {
4233 baseFont = PFont.findFont(name);
4234 }
4235 return createFont(baseFont, size, smooth, charset, stream != null);
4236
4237 } catch (Exception e) {
4238 System.err.println("Problem with createFont(\"" + name + "\")");
4239 e.printStackTrace();
4240 return null;
4241 }
4242 }
4243
4244
4245 private PFont createFont(Font baseFont, float size,

Callers 1

createDefaultFontMethod · 0.95

Calls 4

findFontMethod · 0.95
createInputMethod · 0.45
printlnMethod · 0.45
printStackTraceMethod · 0.45

Tested by

no test coverage detected