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

Method findFont

core/src/processing/core/PFont.java:925–949  ·  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

923 * See: <a href="https://github.com/processing/processing/issues/5481">issue #5481</a>
924 */
925 static public Font findFont(String name) {
926 if (PApplet.platform == PConstants.MACOS) {
927 loadFonts();
928 Font maybe = fontDifferent.get(name);
929 if (maybe != null) {
930 return maybe;
931 }
932 }
933 Font font = new Font(name, Font.PLAIN, 1);
934
935 // make sure we have the name of the system fallback font
936 if (systemFontName == null) {
937 // Figure out what the font is named when things fail
938 systemFontName = new Font("", Font.PLAIN, 1).getFontName();
939 }
940
941 // warn the user if they didn't get the font they want
942 if (!name.equals(systemFontName) &&
943 font.getFontName().equals(systemFontName)) {
944 PGraphics.showWarning("\"" + name + "\" is not available, " +
945 "so another font will be used. " +
946 "Use PFont.list() to show available fonts.");
947 }
948 return font;
949 }
950
951
952 //////////////////////////////////////////////////////////////

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