--- a/src/Pure/General/http.scala Wed Nov 28 14:51:24 2018 +0100
+++ b/src/Pure/General/http.scala Wed Nov 28 15:11:21 2018 +0100
@@ -154,14 +154,18 @@
/* fonts */
- private lazy val html_fonts: List[(String, Bytes)] =
- Isabelle_Fonts.fonts(html = true).map(entry => (entry.name -> entry.bytes))
+ private lazy val html_fonts: List[Isabelle_Fonts.Entry] = Isabelle_Fonts.fonts(html = true)
def fonts(root: String = "/fonts"): Handler =
get(root, arg =>
{
val uri_name = arg.uri.toString
- if (uri_name == root) Some(Response.text(cat_lines(html_fonts.map(_._1))))
- else html_fonts.collectFirst({ case (a, b) if uri_name == root + "/" + a => Response(b) })
+ if (uri_name == root) {
+ Some(Response.text(cat_lines(html_fonts.map(entry => entry.path.base_name))))
+ }
+ else {
+ html_fonts.collectFirst(
+ { case entry if uri_name == root + "/" + entry.path.base_name => Response(entry.bytes) })
+ }
})
}
--- a/src/Pure/System/isabelle_fonts.scala Wed Nov 28 14:51:24 2018 +0100
+++ b/src/Pure/System/isabelle_fonts.scala Wed Nov 28 15:11:21 2018 +0100
@@ -36,9 +36,9 @@
sealed case class Entry(path: Path, html: Boolean = false)
{
- def bytes: Bytes = Bytes.read(path)
+ lazy val bytes: Bytes = Bytes.read(path)
+ lazy val font: Font = Font.createFont(Font.TRUETYPE_FONT, path.file)
- lazy val font: Font = Font.createFont(Font.TRUETYPE_FONT, path.file)
def family: String = font.getFamily
def name: String = font.getFontName
def style: Int =