-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathDemoText01.kt
30 lines (27 loc) · 931 Bytes
/
DemoText01.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package text
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.draw.font.loadFace
import org.openrndr.extra.camera.Camera2D
import org.openrndr.extra.shapes.bounds.bounds
import org.openrndr.extra.shapes.text.shapesFromText
import org.openrndr.internal.Driver
fun main() = application {
configure {
width = 720
height = 720
}
program {
val face =
loadFace("https://github.com/IBM/plex/raw/master/packages/plex-mono/fonts/complete/otf/IBMPlexMono-Bold.otf")
val shapes = shapesFromText(face, "SUCH\nVECTOR\nSUCH\nTEXT", 150.0)
val bounds = shapes.bounds
extend(Camera2D())
extend {
drawer.clear(ColorRGBa.PINK)
drawer.translate(-bounds.corner)
drawer.translate((width - bounds.width) / 2.0, (height - bounds.height) / 2.0)
drawer.shapes(shapes)
}
}
}