(String name, float size,
boolean smooth, char[] charset)
| 4115 | |
| 4116 | |
| 4117 | protected PFont createFont(String name, float size, |
| 4118 | boolean smooth, char[] charset) { |
| 4119 | String lowerName = name.toLowerCase(); |
| 4120 | Font baseFont = null; |
| 4121 | |
| 4122 | try { |
| 4123 | InputStream stream = null; |
| 4124 | if (lowerName.endsWith(".otf") || lowerName.endsWith(".ttf")) { |
| 4125 | stream = parent.createInput(name); |
| 4126 | if (stream == null) { |
| 4127 | System.err.println("The font \"" + name + "\" " + |
| 4128 | "is missing or inaccessible, make sure " + |
| 4129 | "the URL is valid or that the file has been " + |
| 4130 | "added to your sketch and is readable."); |
| 4131 | return null; |
| 4132 | } |
| 4133 | baseFont = Font.createFont(Font.TRUETYPE_FONT, parent.createInput(name)); |
| 4134 | |
| 4135 | } else { |
| 4136 | baseFont = PFont.findFont(name); |
| 4137 | } |
| 4138 | return createFont(baseFont, size, smooth, charset, stream != null); |
| 4139 | |
| 4140 | } catch (Exception e) { |
| 4141 | System.err.println("Problem with createFont(\"" + name + "\")"); |
| 4142 | e.printStackTrace(); |
| 4143 | return null; |
| 4144 | } |
| 4145 | } |
| 4146 | |
| 4147 | |
| 4148 | private PFont createFont(Font baseFont, float size, |
no test coverage detected