diff --git a/.gitignore b/.gitignore index 0edba41..d8d0e13 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ spring-shell.log .idea/* *.log +user diff --git a/acropolis-report/src/main/kotlin/org/ephyra/acropolis/report/impl/render/DiagramRenderer.kt b/acropolis-report/src/main/kotlin/org/ephyra/acropolis/report/impl/render/DiagramRenderer.kt index 3ae32ac..efd73a8 100644 --- a/acropolis-report/src/main/kotlin/org/ephyra/acropolis/report/impl/render/DiagramRenderer.kt +++ b/acropolis-report/src/main/kotlin/org/ephyra/acropolis/report/impl/render/DiagramRenderer.kt @@ -2,11 +2,13 @@ package org.ephyra.acropolis.report.impl.render import java.awt.BasicStroke import java.awt.Color +import java.awt.Font import java.awt.Graphics2D import java.awt.Polygon import java.awt.image.BufferedImage import java.awt.image.BufferedImage.TYPE_INT_RGB import java.io.File +import java.lang.IllegalStateException import javax.imageio.ImageIO class DiagramRenderer( @@ -48,6 +50,18 @@ class DiagramRenderer( target.drawPolygon(polygon) } + fun drawString(str: String, fontFile: File) { + if (fontFile.extension != "ttf") { + throw IllegalStateException("Cannot use a font which is not TTF") + } + + target.color = Color.DARK_GRAY + var font = Font.createFont(Font.TRUETYPE_FONT, fontFile) + font = font.deriveFont(target.font.size * 2f) + target.font = font + target.drawString(str, 100, 100) + } + override fun close() { target.dispose() }