Make an internal list of all installed fonts. This can take a while with a lot of fonts installed, but running it on a separate thread may not help much. As of the commit that's adding this note, loadFonts() will only be called by PFont.list() and when loading a font by name, both of which are occa
()
| 909 | * https://bugs.openjdk.java.net/browse/JDK-8179209 |
| 910 | */ |
| 911 | static public void loadFonts() { |
| 912 | if (fonts == null) { |
| 913 | GraphicsEnvironment ge = |
| 914 | GraphicsEnvironment.getLocalGraphicsEnvironment(); |
| 915 | fonts = ge.getAllFonts(); |
| 916 | |
| 917 | if (PApplet.platform == PConstants.MACOSX) { |
| 918 | fontDifferent = new HashMap<>(); |
| 919 | for (Font font : fonts) { |
| 920 | // No need to use getPSName() anymore because getName() |
| 921 | // returns the PostScript name on OS X 10.6 w/ Java 6. |
| 922 | fontDifferent.put(font.getName(), font); |
| 923 | } |
| 924 | } |
| 925 | } |
| 926 | } |
| 927 | |
| 928 | |
| 929 | /** |