merged
authorhaftmann
Tue, 08 Dec 2009 13:19:04 +0100
changeset 34029 d3dead6ae0d2
parent 34028 1e6206763036 (current diff)
parent 34025 7996b488a9b5 (diff)
child 34031 f7480c5a34e8
merged
--- a/src/Pure/System/isabelle_system.scala	Mon Dec 07 16:27:48 2009 +0100
+++ b/src/Pure/System/isabelle_system.scala	Tue Dec 08 13:19:04 2009 +0100
@@ -9,6 +9,7 @@
 import java.util.regex.Pattern
 import java.util.Locale
 import java.io.{BufferedReader, InputStreamReader, FileInputStream, File, IOException}
+import java.awt.{GraphicsEnvironment, Font}
 
 import scala.io.Source
 import scala.util.matching.Regex
@@ -259,7 +260,7 @@
   {
     getenv_strict("ISABELLE_TOOLS").split(":").find(dir => {
       val file = platform_file(dir + "/" + name)
-      try { file.isFile && file.canRead } //  file.canExecute requires Java 1.6
+      try { file.isFile && file.canRead && file.canExecute }
       catch { case _: SecurityException => false }
     }) match {
       case Some(dir) =>
@@ -331,4 +332,20 @@
   val symbols = new Symbol.Interpretation(
     read_symbols("$ISABELLE_HOME/etc/symbols") ++
     read_symbols("$ISABELLE_HOME_USER/etc/symbols"))
+
+
+  /* fonts */
+
+  val font_family = "IsabelleText"
+
+  private def create_font(name: String) =
+    Font.createFont(Font.TRUETYPE_FONT, platform_file(name))
+
+  def register_fonts(): Boolean =
+  {
+    val ge = GraphicsEnvironment.getLocalGraphicsEnvironment()
+    val ok1 = ge.registerFont(create_font("~~/lib/fonts/IsabelleText.ttf"))
+    val ok2 = ge.registerFont(create_font("~~/lib/fonts/IsabelleTextBold.ttf"))
+    ok1 && ok2
+  }
 }