Skip to content

Instantly share code, notes, and snippets.

@Sciss
Created February 19, 2018 16:41
Show Gist options
  • Save Sciss/c22e59fe31e239aa41a21d1e083d42fe to your computer and use it in GitHub Desktop.
Save Sciss/c22e59fe31e239aa41a21d1e083d42fe to your computer and use it in GitHub Desktop.
import java.awt.{Color, Font, RenderingHints, Graphics2D}
val f = Font.createFont(Font.TRUETYPE_FONT,
new java.io.FileInputStream("/home/hhrutz/Downloads/alegreya/Alegreya-Regular.otf"))
val f1 = f.deriveFont(Font.PLAIN, 64)
val c = new scala.swing.Label {
override def paintComponent(g: Graphics2D): Unit = {
g.setFont(f1)
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON)
g.setColor(Color.WHITE)
g.drawString("Hello World", 10, 56)
}
}
val fr = new scala.swing.Frame {
contents = c
size = new java.awt.Dimension(400, 400)
open()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment