check for installed Source Sans on Windows (fix for #4747)

This commit is contained in:
Ben Fry
2016-12-21 17:21:58 -05:00
parent c4560e6945
commit db810070e4
3 changed files with 27 additions and 2 deletions
+20 -2
View File
@@ -69,6 +69,7 @@ import javax.swing.JPopupMenu;
import javax.swing.JRootPane;
import javax.swing.KeyStroke;
import processing.app.Base;
import processing.app.Language;
import processing.app.Messages;
import processing.app.Platform;
@@ -963,8 +964,25 @@ public class Toolkit {
static public Font getSansFont(int size, int style) {
if (sansFont == null) {
try {
sansFont = createFont("SourceSansPro-Regular.ttf", size);
sansBoldFont = createFont("SourceSansPro-Semibold.ttf", size);
// check for an installed version, because they cause nasty conflicts
// https://github.com/processing/processing/issues/4747
if (Platform.isWindows()) {
sansFont = new Font("Source Sans Pro", Font.PLAIN, size);
// the ps name will be Dialog.plain (or similar) if not installed
if (!sansFont.getPSName().startsWith("Source")) {
sansFont = null;
}
sansBoldFont = new Font("Source Sans Pro Semibold", Font.PLAIN, size);
if (!sansBoldFont.getPSName().startsWith("Source")) {
sansBoldFont = null;
}
}
if (sansFont == null) {
sansFont = createFont("SourceSansPro-Regular.ttf", size);
}
if (sansBoldFont == null) {
sansBoldFont = createFont("SourceSansPro-Semibold.ttf", size);
}
// additional language constraints
if ("el".equals(Language.getLanguage())) {
+4
View File
@@ -21,6 +21,10 @@ cleaning
o probably should also check to make sure PApplet running JVM 8
X or compile against 1.8 and force it?
andres
X PShape array index out of bounds when using P3D
X https://github.com/processing/processing/issues/4773
_ no prompt shows with selectInput() on 10.11 and 10.12
_ https://github.com/processing/processing/issues/4758
+3
View File
@@ -22,6 +22,9 @@ _ blank window on startup where the "welcome" screen should be
_ https://github.com/processing/processing/issues/3933
_ this may be fixed (removed invokeLater() on startup), unconfirmed
_ Spaces not handled correctly in when installing "processing-java" on macOS
_ https://github.com/processing/processing/issues/4779
contrib
X Added the remove filter feature
X https://github.com/processing/processing/pull/3890