mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Merge branch 'master' of github.com:processing/processing
This commit is contained in:
@@ -935,10 +935,14 @@ public class Toolkit {
|
||||
* the Preferences window, and can be used by HTMLEditorKit for WebFrame).
|
||||
*/
|
||||
static private Font createFont(String filename, int size) throws IOException, FontFormatException {
|
||||
boolean registerFont = false;
|
||||
|
||||
// Can't use Base.getJavaHome(), because if we're not using our local JRE,
|
||||
// we likely have bigger problems with how things are running.
|
||||
File fontFile = new File(System.getProperty("java.home"), "lib/fonts/" + filename);
|
||||
if (!fontFile.exists()) {
|
||||
// any of the fallbacks below is a custom location, so try to register the font as well
|
||||
registerFont = true;
|
||||
// if we're debugging from Eclipse, grab it from the work folder (user.dir is /app)
|
||||
fontFile = new File(System.getProperty("user.dir"), "../build/shared/lib/fonts/" + filename);
|
||||
}
|
||||
@@ -946,6 +950,10 @@ public class Toolkit {
|
||||
// if we're debugging the new Java Mode from Eclipse, paths are different
|
||||
fontFile = new File(System.getProperty("user.dir"), "../../shared/lib/fonts/" + filename);
|
||||
}
|
||||
if (!fontFile.exists()) {
|
||||
// this if for Linux, where we're shipping a second copy of the fonts outside of java
|
||||
fontFile = Platform.getContentFile("lib/fonts/" + filename);
|
||||
}
|
||||
if (!fontFile.exists()) {
|
||||
String msg = "Could not find required fonts. ";
|
||||
// This gets the JAVA_HOME for the *local* copy of the JRE installed with
|
||||
@@ -963,6 +971,13 @@ public class Toolkit {
|
||||
BufferedInputStream input = new BufferedInputStream(new FileInputStream(fontFile));
|
||||
Font font = Font.createFont(Font.TRUETYPE_FONT, input);
|
||||
input.close();
|
||||
|
||||
// this makes Font() work for font files in custom locations
|
||||
if (registerFont) {
|
||||
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
ge.registerFont(font);
|
||||
}
|
||||
|
||||
return font.deriveFont((float) size);
|
||||
}
|
||||
|
||||
|
||||
+3
-19
@@ -611,17 +611,10 @@
|
||||
<copy todir="macosx/work/Processing.app/Contents/Java">
|
||||
<fileset dir=".." includes="core/library/**" /> <!-- why this? -->
|
||||
<!--<fileset dir="shared" includes="launch4j/**" />-->
|
||||
<fileset dir="shared" includes="lib/**" excludes="lib/fonts/**" />
|
||||
<fileset dir="shared" includes="lib/**" />
|
||||
<fileset file="shared/revisions.txt" />
|
||||
</copy>
|
||||
|
||||
<!--
|
||||
Processing.app/Contents/PlugIns/jdk1.7.0_40.jdk/Contents/Home/jre/lib/fonts
|
||||
-->
|
||||
<copy todir="macosx/work/Processing.app/Contents/PlugIns/jdk${jdk.esoteric}.jdk/Contents/Home/jre/lib/fonts">
|
||||
<fileset dir="shared/lib/fonts" includes="*" />
|
||||
</copy>
|
||||
|
||||
<antcall target="assemble">
|
||||
<param name="target.path"
|
||||
value="macosx/work/Processing.app/Contents/Java" />
|
||||
@@ -756,7 +749,7 @@
|
||||
<copy todir="linux/work">
|
||||
<fileset dir=".." includes="core/library/**" />
|
||||
<fileset dir="shared" includes="launch4j/**" />
|
||||
<fileset dir="shared" includes="lib/**" excludes="lib/fonts/**" />
|
||||
<fileset dir="shared" includes="lib/**" />
|
||||
<fileset dir="shared" includes="modes/**" />
|
||||
<fileset file="shared/revisions.txt" />
|
||||
</copy>
|
||||
@@ -857,11 +850,6 @@
|
||||
-->
|
||||
<fileset refid="jre-optional-linux" />
|
||||
</delete>
|
||||
|
||||
<copy todir="linux/work/java/lib/fonts">
|
||||
<fileset dir="shared/lib/fonts" includes="*" />
|
||||
</copy>
|
||||
|
||||
</target>
|
||||
|
||||
<target name="linux-run" depends="linux-build"
|
||||
@@ -1053,7 +1041,7 @@
|
||||
<copy todir="windows/work">
|
||||
<fileset dir=".." includes="core/library/**" />
|
||||
<fileset dir="shared" includes="launch4j/**" />
|
||||
<fileset dir="shared" includes="lib/**" excludes="lib/fonts/**" />
|
||||
<fileset dir="shared" includes="lib/**" />
|
||||
<fileset dir="shared" includes="modes/**" />
|
||||
<fileset file="shared/revisions.txt" />
|
||||
</copy>
|
||||
@@ -1119,10 +1107,6 @@
|
||||
-->
|
||||
<fileset refid="jre-optional-windows" />
|
||||
</delete>
|
||||
|
||||
<copy todir="windows/work/java/lib/fonts">
|
||||
<fileset dir="shared/lib/fonts" includes="*" />
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="windows-run" depends="windows-build"
|
||||
|
||||
Reference in New Issue
Block a user