src/Pure/Admin/build_fonts.scala
changeset 69343 395c4fb15ea2
parent 69341 6aa24ccd8049
child 69354 600727ff6889
equal deleted inserted replaced
69342:fa981730b964 69343:395c4fb15ea2
     1 /*  Title:      Pure/Admin/build_fonts.scala
     1 /*  Title:      Pure/Admin/build_fonts.scala
     2     Author:     Makarius
     2     Author:     Makarius
     3 
     3 
     4 Build of Isabelle fonts: Deja Vu + special symbols.
     4 Build of Isabelle fonts: DejaVu + special symbols.
     5 */
     5 */
     6 
     6 
     7 package isabelle
     7 package isabelle
     8 
     8 
     9 
     9 
   184   {
   184   {
   185     Isabelle_System.mkdirs(target_dir)
   185     Isabelle_System.mkdirs(target_dir)
   186 
   186 
   187     val font_dirs = source_dirs ::: List(Path.explode("~~/lib/fonts"))
   187     val font_dirs = source_dirs ::: List(Path.explode("~~/lib/fonts"))
   188 
   188 
   189     for (isabelle_font <- Family.isabelle_text.fonts) {
       
   190       val isabelle_file = find_file(font_dirs, isabelle_font)
       
   191       val isabelle_names = Fontforge.font_names(isabelle_file)
       
   192 
       
   193       val target_names = isabelle_names.update(version = target_version)
       
   194       val target_file = target_dir + target_names.ttf
       
   195 
       
   196       progress.echo("Creating " + target_file.toString + " ...")
       
   197       Fontforge.execute(
       
   198         Fontforge.commands(
       
   199           Fontforge.open(isabelle_file),
       
   200           target_names.set,
       
   201           Fontforge.generate(target_file),
       
   202           Fontforge.close
       
   203         )
       
   204       ).check
       
   205     }
       
   206 
       
   207     for { source <- sources; (source_font, index) <- source.fonts.zipWithIndex } {
   189     for { source <- sources; (source_font, index) <- source.fonts.zipWithIndex } {
   208       val isabelle_file = find_file(font_dirs, Family.isabelle_text.get(index))
   190       val isabelle_file = find_file(font_dirs, Family.isabelle_text.get(index))
   209 
   191 
   210       val source_file = find_file(font_dirs, source_font)
   192       val source_file = find_file(font_dirs, source_font)
   211       val source_names = Fontforge.font_names(source_file)
   193       val source_names = Fontforge.font_names(source_file)
   249 
   231 
   250   Options are:
   232   Options are:
   251     -D DIR       target directory (default ".")
   233     -D DIR       target directory (default ".")
   252     -d DIR       additional source directory
   234     -d DIR       additional source directory
   253 
   235 
   254   Construct Isabelle fonts from Deja Vu font families and Isabelle symbols.
   236   Construct Isabelle fonts from DejaVu font families and Isabelle symbols.
   255 """,
   237 """,
   256         "D:" -> (arg => target_dir = Path.explode(arg)),
   238         "D:" -> (arg => target_dir = Path.explode(arg)),
   257         "d:" -> (arg => source_dirs = source_dirs ::: List(Path.explode(arg))))
   239         "d:" -> (arg => source_dirs = source_dirs ::: List(Path.explode(arg))))
   258 
   240 
   259       val more_args = getopts(args)
   241       val more_args = getopts(args)