MCPcopy Index your code
hub / github.com/processing/processing / findFont

Method findFont

core/src/processing/core/PFont.java:938–962  ·  view source on GitHub ↗

Starting with Java 1.5, Apple broke the ability to specify most fonts. This bug was filed years ago as #4769141 at bugreporter.apple.com. More: Bug 407 . This function displays a warning when the font is not found and Java's system

(String name)

Source from the content-addressed store, hash-verified

936 * See: <a href="https://github.com/processing/processing/issues/5481">issue #5481</a>
937 */
938 static public Font findFont(String name) {
939 if (PApplet.platform == PConstants.MACOSX) {
940 loadFonts();
941 Font maybe = fontDifferent.get(name);
942 if (maybe != null) {
943 return maybe;
944 }
945 }
946 Font font = new Font(name, Font.PLAIN, 1);
947
948 // make sure we have the name of the system fallback font
949 if (systemFontName == null) {
950 // Figure out what the font is named when things fail
951 systemFontName = new Font("", Font.PLAIN, 1).getFontName();
952 }
953
954 // warn the user if they didn't get the font they want
955 if (!name.equals(systemFontName) &&
956 font.getFontName().equals(systemFontName)) {
957 PGraphics.showWarning("\"" + name + "\" is not available, " +
958 "so another font will be used. " +
959 "Use PFont.list() to show available fonts.");
960 }
961 return font;
962 }
963
964
965 //////////////////////////////////////////////////////////////

Callers 1

createFontMethod · 0.95

Calls 4

loadFontsMethod · 0.95
showWarningMethod · 0.95
getMethod · 0.65
equalsMethod · 0.45

Tested by

no test coverage detected