[orx-shapes] Add shapesFromText

This commit is contained in:
Edwin Jakobs
2023-10-11 17:18:58 +02:00
parent 307df635f1
commit 283fd939c4
3 changed files with 62 additions and 1 deletions

View File

@@ -0,0 +1,31 @@
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.draw.font.loadFace
import org.openrndr.extra.shapes.bounds.bounds
import org.openrndr.extra.shapes.text.shapesFromText
import org.openrndr.math.Vector2
import java.io.File
fun main() {
application {
configure {
width = 720
height = 720
}
program {
val face =
loadFace("https://github.com/IBM/plex/raw/master/IBM-Plex-Mono/fonts/complete/otf/IBMPlexMono-Bold.otf")
val shapes = shapesFromText(face, "SUCH\nVECTOR\nSUCH\nTEXT", 150.0)
val bounds = shapes.bounds
extend {
drawer.clear(ColorRGBa.PINK)
drawer.translate(-bounds.corner)
drawer.translate((width - bounds.width) / 2.0, (height - bounds.height) / 2.0)
drawer.shapes(shapes)
}
}
}
}