src/Pure/Tools/logo.scala
changeset 75393 87ebf5a50283
parent 73723 1bbbaae6b5e3
child 75394 42267c650205
equal deleted inserted replaced
75388:b3ca4a6ed74b 75393:87ebf5a50283
     5 */
     5 */
     6 
     6 
     7 package isabelle
     7 package isabelle
     8 
     8 
     9 
     9 
    10 object Logo
    10 object Logo {
    11 {
       
    12   /* create logo */
    11   /* create logo */
    13 
    12 
    14   def make_output_file(logo_name: String): Path =
    13   def make_output_file(logo_name: String): Path = {
    15   {
       
    16     val name = if (logo_name.isEmpty) "isabelle" else "isabelle_" + Word.lowercase(logo_name)
    14     val name = if (logo_name.isEmpty) "isabelle" else "isabelle_" + Word.lowercase(logo_name)
    17     Path.explode(name).pdf
    15     Path.explode(name).pdf
    18   }
    16   }
    19 
    17 
    20   def create_logo(logo_name: String, output_file: Path, quiet: Boolean = false): Unit =
    18   def create_logo(logo_name: String, output_file: Path, quiet: Boolean = false): Unit = {
    21   {
    19     Isabelle_System.with_tmp_file("logo", ext = "eps")(tmp_file => {
    22     Isabelle_System.with_tmp_file("logo", ext = "eps")(tmp_file =>
       
    23     {
       
    24       val template = File.read(Path.explode("$ISABELLE_HOME/lib/logo/isabelle_any.eps"))
    20       val template = File.read(Path.explode("$ISABELLE_HOME/lib/logo/isabelle_any.eps"))
    25       File.write(tmp_file, template.replace("<any>", logo_name))
    21       File.write(tmp_file, template.replace("<any>", logo_name))
    26 
    22 
    27       Isabelle_System.bash(
    23       Isabelle_System.bash(
    28         "\"$ISABELLE_EPSTOPDF\" --filter < " + File.bash_path(tmp_file) +
    24         "\"$ISABELLE_EPSTOPDF\" --filter < " + File.bash_path(tmp_file) +
    33 
    29 
    34 
    30 
    35   /* Isabelle tool wrapper */
    31   /* Isabelle tool wrapper */
    36 
    32 
    37   val isabelle_tool =
    33   val isabelle_tool =
    38     Isabelle_Tool("logo", "create variants of the Isabelle logo (PDF)", Scala_Project.here, args =>
    34     Isabelle_Tool("logo", "create variants of the Isabelle logo (PDF)", Scala_Project.here,
    39     {
    35       args => {
    40       var output: Option[Path] = None
    36       var output: Option[Path] = None
    41       var quiet = false
    37       var quiet = false
    42 
    38 
    43       val getopts = Getopts("""
    39       val getopts = Getopts("""
    44 Usage: isabelle logo [OPTIONS] [NAME]
    40 Usage: isabelle logo [OPTIONS] [NAME]