author | wenzelm |
Mon, 28 Dec 2009 16:24:19 +0100 | |
changeset 34195 | d58da36d1a30 |
parent 34194 | 001321ca185c |
child 34196 | c352f679dcca |
permissions | -rw-r--r-- |
30175 | 1 |
/* Title: Pure/System/isabelle_system.scala |
27919 | 2 |
Author: Makarius |
3 |
||
31796 | 4 |
Isabelle system support, with basic Cygwin/Posix compatibility. |
27919 | 5 |
*/ |
6 |
||
7 |
package isabelle |
|
8 |
||
31520
0a99c8716312
simplified IsabelleSystem.platform_path for cygwin;
wenzelm
parents:
31500
diff
changeset
|
9 |
import java.util.regex.Pattern |
31820 | 10 |
import java.util.Locale |
34162 | 11 |
import java.io.{BufferedInputStream, FileInputStream, BufferedReader, InputStreamReader, |
12 |
File, IOException} |
|
34024 | 13 |
import java.awt.{GraphicsEnvironment, Font} |
28063 | 14 |
|
15 |
import scala.io.Source |
|
31520
0a99c8716312
simplified IsabelleSystem.platform_path for cygwin;
wenzelm
parents:
31500
diff
changeset
|
16 |
import scala.util.matching.Regex |
34163 | 17 |
import scala.collection.mutable |
27936 | 18 |
|
27919 | 19 |
|
31796 | 20 |
object Isabelle_System |
31498 | 21 |
{ |
28057 | 22 |
val charset = "UTF-8" |
23 |
||
31822 | 24 |
|
31498 | 25 |
/* shell processes */ |
26 |
||
27 |
private def raw_execute(env: Map[String, String], redirect: Boolean, args: String*): Process = |
|
28 |
{ |
|
29 |
val cmdline = new java.util.LinkedList[String] |
|
30 |
for (s <- args) cmdline.add(s) |
|
31 |
||
32 |
val proc = new ProcessBuilder(cmdline) |
|
33 |
proc.environment.clear |
|
34 |
for ((x, y) <- env) proc.environment.put(x, y) |
|
35 |
proc.redirectErrorStream(redirect) |
|
36 |
||
37 |
try { proc.start } |
|
38 |
catch { case e: IOException => error(e.getMessage) } |
|
39 |
} |
|
40 |
||
41 |
private def process_output(proc: Process): (String, Int) = |
|
42 |
{ |
|
43 |
proc.getOutputStream.close |
|
44 |
val output = Source.fromInputStream(proc.getInputStream, charset).mkString |
|
34194
001321ca185c
slightly more paranoid cleanup of process (cf. http://kylecartmell.com/?p=9 "Five Common java.lang.Process Pitfalls");
wenzelm
parents:
34186
diff
changeset
|
45 |
val rc = |
001321ca185c
slightly more paranoid cleanup of process (cf. http://kylecartmell.com/?p=9 "Five Common java.lang.Process Pitfalls");
wenzelm
parents:
34186
diff
changeset
|
46 |
try { proc.waitFor } |
001321ca185c
slightly more paranoid cleanup of process (cf. http://kylecartmell.com/?p=9 "Five Common java.lang.Process Pitfalls");
wenzelm
parents:
34186
diff
changeset
|
47 |
finally { |
001321ca185c
slightly more paranoid cleanup of process (cf. http://kylecartmell.com/?p=9 "Five Common java.lang.Process Pitfalls");
wenzelm
parents:
34186
diff
changeset
|
48 |
proc.getInputStream.close |
001321ca185c
slightly more paranoid cleanup of process (cf. http://kylecartmell.com/?p=9 "Five Common java.lang.Process Pitfalls");
wenzelm
parents:
34186
diff
changeset
|
49 |
proc.getErrorStream.close |
001321ca185c
slightly more paranoid cleanup of process (cf. http://kylecartmell.com/?p=9 "Five Common java.lang.Process Pitfalls");
wenzelm
parents:
34186
diff
changeset
|
50 |
proc.destroy |
001321ca185c
slightly more paranoid cleanup of process (cf. http://kylecartmell.com/?p=9 "Five Common java.lang.Process Pitfalls");
wenzelm
parents:
34186
diff
changeset
|
51 |
Thread.interrupted |
001321ca185c
slightly more paranoid cleanup of process (cf. http://kylecartmell.com/?p=9 "Five Common java.lang.Process Pitfalls");
wenzelm
parents:
34186
diff
changeset
|
52 |
} |
31498 | 53 |
(output, rc) |
54 |
} |
|
55 |
} |
|
56 |
||
57 |
||
31796 | 58 |
class Isabelle_System |
31498 | 59 |
{ |
31796 | 60 |
/** Isabelle environment **/ |
61 |
||
62 |
/* platform prefixes */ |
|
31498 | 63 |
|
31520
0a99c8716312
simplified IsabelleSystem.platform_path for cygwin;
wenzelm
parents:
31500
diff
changeset
|
64 |
private val (platform_root, drive_prefix, shell_prefix) = |
31500 | 65 |
{ |
31825 | 66 |
if (Platform.is_windows) { |
34045
bc71778a327d
simplified Cygwin setup, assuming 1.7 registry layout (version 1.5 suffers from upcaseenv problem anyway);
wenzelm
parents:
34044
diff
changeset
|
67 |
val root = Cygwin.check_root() |
bc71778a327d
simplified Cygwin setup, assuming 1.7 registry layout (version 1.5 suffers from upcaseenv problem anyway);
wenzelm
parents:
34044
diff
changeset
|
68 |
val drive = "/cygdrive" |
31520
0a99c8716312
simplified IsabelleSystem.platform_path for cygwin;
wenzelm
parents:
31500
diff
changeset
|
69 |
val shell = List(root + "\\bin\\bash", "-l") |
0a99c8716312
simplified IsabelleSystem.platform_path for cygwin;
wenzelm
parents:
31500
diff
changeset
|
70 |
(root, drive, shell) |
31500 | 71 |
} |
31520
0a99c8716312
simplified IsabelleSystem.platform_path for cygwin;
wenzelm
parents:
31500
diff
changeset
|
72 |
else ("/", "", Nil) |
31500 | 73 |
} |
74 |
||
31796 | 75 |
|
76 |
/* bash environment */ |
|
77 |
||
31498 | 78 |
private val environment: Map[String, String] = |
79 |
{ |
|
80 |
import scala.collection.jcl.Conversions._ |
|
81 |
||
82 |
val env0 = Map(java.lang.System.getenv.toList: _*) |
|
27919 | 83 |
|
31927
9a0f28bcc81d
init isabelle home from existing setting or hint via system property;
wenzelm
parents:
31829
diff
changeset
|
84 |
val isabelle_home = |
9a0f28bcc81d
init isabelle home from existing setting or hint via system property;
wenzelm
parents:
31829
diff
changeset
|
85 |
env0.get("ISABELLE_HOME") match { |
31498 | 86 |
case None | Some("") => |
31927
9a0f28bcc81d
init isabelle home from existing setting or hint via system property;
wenzelm
parents:
31829
diff
changeset
|
87 |
val path = java.lang.System.getProperty("isabelle.home") |
9a0f28bcc81d
init isabelle home from existing setting or hint via system property;
wenzelm
parents:
31829
diff
changeset
|
88 |
if (path == null || path == "") error("Unknown Isabelle home directory") |
9a0f28bcc81d
init isabelle home from existing setting or hint via system property;
wenzelm
parents:
31829
diff
changeset
|
89 |
else path |
9a0f28bcc81d
init isabelle home from existing setting or hint via system property;
wenzelm
parents:
31829
diff
changeset
|
90 |
case Some(path) => path |
31498 | 91 |
} |
29177 | 92 |
|
31498 | 93 |
val dump = File.createTempFile("isabelle", null) |
94 |
try { |
|
31927
9a0f28bcc81d
init isabelle home from existing setting or hint via system property;
wenzelm
parents:
31829
diff
changeset
|
95 |
val cmdline = shell_prefix ::: |
9a0f28bcc81d
init isabelle home from existing setting or hint via system property;
wenzelm
parents:
31829
diff
changeset
|
96 |
List(isabelle_home + "/bin/isabelle", "getenv", "-d", dump.toString) |
34194
001321ca185c
slightly more paranoid cleanup of process (cf. http://kylecartmell.com/?p=9 "Five Common java.lang.Process Pitfalls");
wenzelm
parents:
34186
diff
changeset
|
97 |
val (output, rc) = |
001321ca185c
slightly more paranoid cleanup of process (cf. http://kylecartmell.com/?p=9 "Five Common java.lang.Process Pitfalls");
wenzelm
parents:
34186
diff
changeset
|
98 |
Isabelle_System.process_output(Isabelle_System.raw_execute(env0, true, cmdline: _*)) |
31498 | 99 |
if (rc != 0) error(output) |
100 |
||
101 |
val entries = |
|
102 |
for (entry <- Source.fromFile(dump).mkString split "\0" if entry != "") yield { |
|
103 |
val i = entry.indexOf('=') |
|
104 |
if (i <= 0) (entry -> "") |
|
105 |
else (entry.substring(0, i) -> entry.substring(i + 1)) |
|
106 |
} |
|
31704
b8628ac68b73
environment: keep original HOME and PATH (required for Cygwin integrity);
wenzelm
parents:
31703
diff
changeset
|
107 |
Map(entries: _*) + |
b8628ac68b73
environment: keep original HOME and PATH (required for Cygwin integrity);
wenzelm
parents:
31703
diff
changeset
|
108 |
("HOME" -> java.lang.System.getenv("HOME")) + |
b8628ac68b73
environment: keep original HOME and PATH (required for Cygwin integrity);
wenzelm
parents:
31703
diff
changeset
|
109 |
("PATH" -> java.lang.System.getenv("PATH")) |
31498 | 110 |
} |
111 |
finally { dump.delete } |
|
27953 | 112 |
} |
27919 | 113 |
|
31796 | 114 |
|
115 |
/* getenv */ |
|
116 |
||
31498 | 117 |
def getenv(name: String): String = |
118 |
environment.getOrElse(if (name == "HOME") "HOME_JVM" else name, "") |
|
119 |
||
120 |
def getenv_strict(name: String): String = |
|
121 |
{ |
|
31234
6ce6801129de
getenv_strict needs to be based on getenv (accidentally broken in 0e88d33e8d19);
wenzelm
parents:
30175
diff
changeset
|
122 |
val value = getenv(name) |
27993
6dd90ef9f927
simplified exceptions: use plain error function / RuntimeException;
wenzelm
parents:
27974
diff
changeset
|
123 |
if (value != "") value else error("Undefined environment variable: " + name) |
27919 | 124 |
} |
125 |
||
31703 | 126 |
override def toString = getenv("ISABELLE_HOME") |
127 |
||
27936 | 128 |
|
31796 | 129 |
|
130 |
/** file path specifications **/ |
|
131 |
||
31820 | 132 |
/* expand_path */ |
31796 | 133 |
|
31820 | 134 |
def expand_path(isabelle_path: String): String = |
31796 | 135 |
{ |
136 |
val result_path = new StringBuilder |
|
137 |
def init(path: String) |
|
138 |
{ |
|
139 |
if (path.startsWith("/")) { |
|
140 |
result_path.clear |
|
141 |
result_path += '/' |
|
142 |
} |
|
143 |
} |
|
144 |
def append(path: String) |
|
145 |
{ |
|
146 |
init(path) |
|
31803 | 147 |
for (p <- path.split("/") if p != "" && p != ".") { |
148 |
if (p == "..") { |
|
149 |
val result = result_path.toString |
|
150 |
val i = result.lastIndexOf("/") |
|
151 |
if (result == "") |
|
152 |
result_path ++= ".." |
|
153 |
else if (result.substring(i + 1) == "..") |
|
154 |
result_path ++= "/.." |
|
155 |
else if (i < 1) |
|
156 |
result_path.length = i + 1 |
|
157 |
else |
|
158 |
result_path.length = i |
|
159 |
} |
|
160 |
else { |
|
161 |
val len = result_path.length |
|
162 |
if (len > 0 && result_path(len - 1) != '/') |
|
163 |
result_path += '/' |
|
164 |
result_path ++= p |
|
165 |
} |
|
31796 | 166 |
} |
167 |
} |
|
31820 | 168 |
init(isabelle_path) |
169 |
for (p <- isabelle_path.split("/")) { |
|
31796 | 170 |
if (p.startsWith("$")) append(getenv_strict(p.substring(1))) |
171 |
else if (p == "~") append(getenv_strict("HOME")) |
|
172 |
else if (p == "~~") append(getenv_strict("ISABELLE_HOME")) |
|
173 |
else append(p) |
|
174 |
} |
|
175 |
result_path.toString |
|
176 |
} |
|
177 |
||
178 |
||
31820 | 179 |
/* platform_path */ |
27936 | 180 |
|
31820 | 181 |
private val Cygdrive = |
182 |
new Regex(Pattern.quote(drive_prefix) + "/([a-zA-Z])($|/.*)") |
|
31520
0a99c8716312
simplified IsabelleSystem.platform_path for cygwin;
wenzelm
parents:
31500
diff
changeset
|
183 |
|
31820 | 184 |
def platform_path(isabelle_path: String): String = |
31498 | 185 |
{ |
27936 | 186 |
val result_path = new StringBuilder |
31796 | 187 |
val rest = |
31820 | 188 |
expand_path(isabelle_path) match { |
31825 | 189 |
case Cygdrive(drive, rest) if Platform.is_windows => |
31796 | 190 |
result_path ++= (drive + ":" + File.separator) |
31520
0a99c8716312
simplified IsabelleSystem.platform_path for cygwin;
wenzelm
parents:
31500
diff
changeset
|
191 |
rest |
31796 | 192 |
case path if path.startsWith("/") => |
193 |
result_path ++= platform_root |
|
194 |
path |
|
195 |
case path => path |
|
31500 | 196 |
} |
31796 | 197 |
for (p <- rest.split("/") if p != "") { |
198 |
val len = result_path.length |
|
199 |
if (len > 0 && result_path(len - 1) != File.separatorChar) |
|
200 |
result_path += File.separatorChar |
|
201 |
result_path ++= p |
|
27936 | 202 |
} |
203 |
result_path.toString |
|
204 |
} |
|
27953 | 205 |
|
31498 | 206 |
def platform_file(path: String) = new File(platform_path(path)) |
29152 | 207 |
|
27953 | 208 |
|
31820 | 209 |
/* isabelle_path */ |
210 |
||
211 |
private val Platform_Root = new Regex("(?i)" + |
|
31821
ce6be870a5d3
isabelle_path: slightly more liberal root pattern;
wenzelm
parents:
31820
diff
changeset
|
212 |
Pattern.quote(platform_root) + """(?:\\+|\z)(.*)""") |
31820 | 213 |
private val Drive = new Regex("""([a-zA-Z]):\\*(.*)""") |
214 |
||
215 |
def isabelle_path(platform_path: String): String = |
|
216 |
{ |
|
31825 | 217 |
if (Platform.is_windows) { |
31820 | 218 |
platform_path.replace('/', '\\') match { |
219 |
case Platform_Root(rest) => "/" + rest.replace('\\', '/') |
|
220 |
case Drive(letter, rest) => |
|
221 |
drive_prefix + "/" + letter.toLowerCase(Locale.ENGLISH) + |
|
222 |
(if (rest == "") "" else "/" + rest.replace('\\', '/')) |
|
223 |
case path => path.replace('\\', '/') |
|
224 |
} |
|
225 |
} |
|
226 |
else platform_path |
|
227 |
} |
|
228 |
||
229 |
||
31436 | 230 |
/* source files */ |
231 |
||
232 |
private def try_file(file: File) = if (file.isFile) Some(file) else None |
|
233 |
||
31498 | 234 |
def source_file(path: String): Option[File] = |
235 |
{ |
|
236 |
if (path.startsWith("/") || path == "") |
|
31436 | 237 |
try_file(platform_file(path)) |
238 |
else { |
|
239 |
val pure_file = platform_file("~~/src/Pure/" + path) |
|
240 |
if (pure_file.isFile) Some(pure_file) |
|
241 |
else if (getenv("ML_SOURCES") != "") |
|
242 |
try_file(platform_file("$ML_SOURCES/" + path)) |
|
243 |
else None |
|
244 |
} |
|
245 |
} |
|
246 |
||
247 |
||
32450 | 248 |
|
31796 | 249 |
/** system tools **/ |
250 |
||
31498 | 251 |
/* external processes */ |
27953 | 252 |
|
31498 | 253 |
def execute(redirect: Boolean, args: String*): Process = |
254 |
{ |
|
255 |
val cmdline = |
|
31825 | 256 |
if (Platform.is_windows) List(platform_path("/bin/env")) ++ args |
31498 | 257 |
else args |
31796 | 258 |
Isabelle_System.raw_execute(environment, redirect, cmdline: _*) |
28046 | 259 |
} |
260 |
||
31818
f698f76a3713
builtin isabelle_tool for ML and Scala -- avoids excessive shell script (especially important for Cygwin);
wenzelm
parents:
31803
diff
changeset
|
261 |
def isabelle_tool(name: String, args: String*): (String, Int) = |
31498 | 262 |
{ |
31818
f698f76a3713
builtin isabelle_tool for ML and Scala -- avoids excessive shell script (especially important for Cygwin);
wenzelm
parents:
31803
diff
changeset
|
263 |
getenv_strict("ISABELLE_TOOLS").split(":").find(dir => { |
f698f76a3713
builtin isabelle_tool for ML and Scala -- avoids excessive shell script (especially important for Cygwin);
wenzelm
parents:
31803
diff
changeset
|
264 |
val file = platform_file(dir + "/" + name) |
34025 | 265 |
try { file.isFile && file.canRead && file.canExecute } |
31818
f698f76a3713
builtin isabelle_tool for ML and Scala -- avoids excessive shell script (especially important for Cygwin);
wenzelm
parents:
31803
diff
changeset
|
266 |
catch { case _: SecurityException => false } |
f698f76a3713
builtin isabelle_tool for ML and Scala -- avoids excessive shell script (especially important for Cygwin);
wenzelm
parents:
31803
diff
changeset
|
267 |
}) match { |
f698f76a3713
builtin isabelle_tool for ML and Scala -- avoids excessive shell script (especially important for Cygwin);
wenzelm
parents:
31803
diff
changeset
|
268 |
case Some(dir) => |
34194
001321ca185c
slightly more paranoid cleanup of process (cf. http://kylecartmell.com/?p=9 "Five Common java.lang.Process Pitfalls");
wenzelm
parents:
34186
diff
changeset
|
269 |
Isabelle_System.process_output( |
34195 | 270 |
execute(true, (List(expand_path(dir + "/" + name)) ++ args): _*)) |
31818
f698f76a3713
builtin isabelle_tool for ML and Scala -- avoids excessive shell script (especially important for Cygwin);
wenzelm
parents:
31803
diff
changeset
|
271 |
case None => ("Unknown Isabelle tool: " + name, 2) |
f698f76a3713
builtin isabelle_tool for ML and Scala -- avoids excessive shell script (especially important for Cygwin);
wenzelm
parents:
31803
diff
changeset
|
272 |
} |
28063 | 273 |
} |
274 |
||
275 |
||
276 |
/* named pipes */ |
|
277 |
||
31498 | 278 |
def mk_fifo(): String = |
279 |
{ |
|
28496
4cff10648928
renamed isatool to isabelle_tool in programming interfaces;
wenzelm
parents:
28063
diff
changeset
|
280 |
val (result, rc) = isabelle_tool("mkfifo") |
28063 | 281 |
if (rc == 0) result.trim |
282 |
else error(result) |
|
283 |
} |
|
284 |
||
31498 | 285 |
def rm_fifo(fifo: String) |
286 |
{ |
|
28496
4cff10648928
renamed isatool to isabelle_tool in programming interfaces;
wenzelm
parents:
28063
diff
changeset
|
287 |
val (result, rc) = isabelle_tool("rmfifo", fifo) |
28063 | 288 |
if (rc != 0) error(result) |
289 |
} |
|
290 |
||
34100 | 291 |
def fifo_stream(fifo: String): BufferedInputStream = |
31498 | 292 |
{ |
29177 | 293 |
// blocks until writer is ready |
294 |
val stream = |
|
34194
001321ca185c
slightly more paranoid cleanup of process (cf. http://kylecartmell.com/?p=9 "Five Common java.lang.Process Pitfalls");
wenzelm
parents:
34186
diff
changeset
|
295 |
if (Platform.is_windows) { |
001321ca185c
slightly more paranoid cleanup of process (cf. http://kylecartmell.com/?p=9 "Five Common java.lang.Process Pitfalls");
wenzelm
parents:
34186
diff
changeset
|
296 |
val proc = execute(false, "cat", fifo) |
001321ca185c
slightly more paranoid cleanup of process (cf. http://kylecartmell.com/?p=9 "Five Common java.lang.Process Pitfalls");
wenzelm
parents:
34186
diff
changeset
|
297 |
proc.getOutputStream.close |
001321ca185c
slightly more paranoid cleanup of process (cf. http://kylecartmell.com/?p=9 "Five Common java.lang.Process Pitfalls");
wenzelm
parents:
34186
diff
changeset
|
298 |
proc.getErrorStream.close |
001321ca185c
slightly more paranoid cleanup of process (cf. http://kylecartmell.com/?p=9 "Five Common java.lang.Process Pitfalls");
wenzelm
parents:
34186
diff
changeset
|
299 |
proc.getInputStream |
001321ca185c
slightly more paranoid cleanup of process (cf. http://kylecartmell.com/?p=9 "Five Common java.lang.Process Pitfalls");
wenzelm
parents:
34186
diff
changeset
|
300 |
} |
29177 | 301 |
else new FileInputStream(fifo) |
34100 | 302 |
new BufferedInputStream(stream) |
29177 | 303 |
} |
28063 | 304 |
|
29152 | 305 |
|
32450 | 306 |
|
31796 | 307 |
/** Isabelle resources **/ |
308 |
||
32328 | 309 |
/* components */ |
310 |
||
311 |
def components(): List[String] = |
|
312 |
getenv("ISABELLE_COMPONENTS").split(":").toList |
|
313 |
||
314 |
||
29152 | 315 |
/* find logics */ |
316 |
||
31498 | 317 |
def find_logics(): List[String] = |
318 |
{ |
|
29152 | 319 |
val ml_ident = getenv_strict("ML_IDENTIFIER") |
34163 | 320 |
val logics = new mutable.ListBuffer[String] |
29152 | 321 |
for (dir <- getenv_strict("ISABELLE_PATH").split(":")) { |
322 |
val files = platform_file(dir + "/" + ml_ident).listFiles() |
|
323 |
if (files != null) { |
|
324 |
for (file <- files if file.isFile) logics += file.getName |
|
325 |
} |
|
326 |
} |
|
327 |
logics.toList.sort(_ < _) |
|
328 |
} |
|
29570 | 329 |
|
330 |
||
331 |
/* symbols */ |
|
332 |
||
34137 | 333 |
private def read_symbols(path: String): List[String] = |
31498 | 334 |
{ |
34195 | 335 |
val file = platform_file(path) |
34137 | 336 |
if (file.isFile) Source.fromFile(file).getLines.toList |
337 |
else Nil |
|
29570 | 338 |
} |
339 |
val symbols = new Symbol.Interpretation( |
|
34137 | 340 |
read_symbols("$ISABELLE_HOME/etc/symbols") ::: |
29570 | 341 |
read_symbols("$ISABELLE_HOME_USER/etc/symbols")) |
34024 | 342 |
|
343 |
||
344 |
/* fonts */ |
|
345 |
||
346 |
val font_family = "IsabelleText" |
|
347 |
||
34044
09afb1d49fe7
slightly more robust and less ambitious version of install_fonts;
wenzelm
parents:
34027
diff
changeset
|
348 |
private def check_font(): Boolean = |
09afb1d49fe7
slightly more robust and less ambitious version of install_fonts;
wenzelm
parents:
34027
diff
changeset
|
349 |
new Font(font_family, Font.PLAIN, 1).getFamily == font_family |
09afb1d49fe7
slightly more robust and less ambitious version of install_fonts;
wenzelm
parents:
34027
diff
changeset
|
350 |
|
34024 | 351 |
private def create_font(name: String) = |
352 |
Font.createFont(Font.TRUETYPE_FONT, platform_file(name)) |
|
353 |
||
34044
09afb1d49fe7
slightly more robust and less ambitious version of install_fonts;
wenzelm
parents:
34027
diff
changeset
|
354 |
def install_fonts() |
09afb1d49fe7
slightly more robust and less ambitious version of install_fonts;
wenzelm
parents:
34027
diff
changeset
|
355 |
{ |
09afb1d49fe7
slightly more robust and less ambitious version of install_fonts;
wenzelm
parents:
34027
diff
changeset
|
356 |
if (!check_font()) { |
09afb1d49fe7
slightly more robust and less ambitious version of install_fonts;
wenzelm
parents:
34027
diff
changeset
|
357 |
val ge = GraphicsEnvironment.getLocalGraphicsEnvironment() |
09afb1d49fe7
slightly more robust and less ambitious version of install_fonts;
wenzelm
parents:
34027
diff
changeset
|
358 |
ge.registerFont(create_font("$ISABELLE_HOME/lib/fonts/IsabelleText.ttf")) |
09afb1d49fe7
slightly more robust and less ambitious version of install_fonts;
wenzelm
parents:
34027
diff
changeset
|
359 |
ge.registerFont(create_font("$ISABELLE_HOME/lib/fonts/IsabelleTextBold.ttf")) |
09afb1d49fe7
slightly more robust and less ambitious version of install_fonts;
wenzelm
parents:
34027
diff
changeset
|
360 |
if (!check_font()) |
09afb1d49fe7
slightly more robust and less ambitious version of install_fonts;
wenzelm
parents:
34027
diff
changeset
|
361 |
error("Failed to install IsabelleText fonts") |
09afb1d49fe7
slightly more robust and less ambitious version of install_fonts;
wenzelm
parents:
34027
diff
changeset
|
362 |
} |
34024 | 363 |
} |
27919 | 364 |
} |