@@ -929,31 +929,23 @@ static public Font getSansFont(int size, int style) {
929929
930930
931931 /**
932- * Get a font from the JRE lib/fonts folder. Our default fonts are also
932+ * Get a font from the lib/fonts folder. Our default fonts are also
933933 * installed there so that the monospace (and others) can be used by other
934934 * font listing calls (i.e. it appears in the list of monospace fonts in
935935 * the Preferences window, and can be used by HTMLEditorKit for WebFrame).
936936 */
937937 static private Font createFont (String filename , int size ) throws IOException , FontFormatException {
938938 boolean registerFont = false ;
939939
940- // Can't use Base.getJavaHome(), because if we're not using our local JRE,
941- // we likely have bigger problems with how things are running.
940+ // try the JRE font directory first
942941 File fontFile = new File (System .getProperty ("java.home" ), "lib/fonts/" + filename );
942+
943+ // else fall back to our own content dir
943944 if (!fontFile .exists ()) {
944- // any of the fallbacks below is a custom location, so try to register the font as well
945- registerFont = true ;
946- // if we're debugging from Eclipse, grab it from the work folder (user.dir is /app)
947- fontFile = new File (System .getProperty ("user.dir" ), "../build/shared/lib/fonts/" + filename );
948- }
949- if (!fontFile .exists ()) {
950- // if we're debugging the new Java Mode from Eclipse, paths are different
951- fontFile = new File (System .getProperty ("user.dir" ), "../../shared/lib/fonts/" + filename );
952- }
953- if (!fontFile .exists ()) {
954- // this if for Linux, where we're shipping a second copy of the fonts outside of java
955945 fontFile = Platform .getContentFile ("lib/fonts/" + filename );
946+ registerFont = true ;
956947 }
948+
957949 if (!fontFile .exists ()) {
958950 String msg = "Could not find required fonts. " ;
959951 // This gets the JAVA_HOME for the *local* copy of the JRE installed with
@@ -968,11 +960,11 @@ static private Font createFont(String filename, int size) throws IOException, Fo
968960 Messages .showError ("Font Sadness" , msg , null );
969961 }
970962
963+
971964 BufferedInputStream input = new BufferedInputStream (new FileInputStream (fontFile ));
972965 Font font = Font .createFont (Font .TRUETYPE_FONT , input );
973966 input .close ();
974967
975- // this makes Font() work for font files in custom locations
976968 if (registerFont ) {
977969 GraphicsEnvironment ge = GraphicsEnvironment .getLocalGraphicsEnvironment ();
978970 ge .registerFont (font );
0 commit comments