aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/TextUtilsDSL.kt
blob: 6d2f7e72298f123392ab426155cba045cf923941 (plain)
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
package cc.polyfrost.oneconfig.utils.dsl

import cc.polyfrost.oneconfig.renderer.font.Font
import cc.polyfrost.oneconfig.utils.TextUtils

/**
 * Wraps the given [String] to the given [maxWidth].
 * @see TextUtils.wrapText
 */
fun String.wrap(vg: Long, maxWidth: Float, fontSize: Number, font: Font) =
    TextUtils.wrapText(vg, this, maxWidth, fontSize.toFloat(), font)

/**
 * Wraps the given [String] to the given [maxWidth].
 * @see wrap
 */
fun Long.wrap(text: String, maxWidth: Float, fontSize: Number, font: Font) =
    TextUtils.wrapText(this, text, maxWidth, fontSize.toFloat(), font)

/**
 * Wraps the given [String] to the given [maxWidth].
 * @see wrap
 */
fun VG.wrap(text: String, maxWidth: Float, fontSize: Number, font: Font) =
    TextUtils.wrapText(instance, text, maxWidth, fontSize.toFloat(), font)