Package-level declarations

Types

Link copied to clipboard
Link copied to clipboard
abstract class BaseTtfFont(s: FastByteArrayInputStream, extName: String? = null, onlyReadMetadata: Boolean = false, enableLigatures: Boolean = true) : VectorFont, Extra
Link copied to clipboard
interface BitmapFont : Font
Link copied to clipboard
class CharacterSet(val codePoints: IntArray)
Link copied to clipboard
open class DefaultFontRegistry(val coroutineContext: CoroutineContext) : FontRegistry
Link copied to clipboard
open class FolderBasedNativeSystemFontProvider(val context: CoroutineContext, val folders: List<String> = (linuxFolders + windowsFolders + macosFolders + androidFolders + iosFolders).distinct(), val fontCacheFile: VfsFile = standardVfs.userSharedCacheFile("korimFontCache")) : TtfNativeSystemFontProvider
Link copied to clipboard
interface Font : Resourceable<Font> , Extra
Link copied to clipboard
data class FontMetrics(var size: Double = 0.0, var top: Double = 0.0, var ascent: Double = 0.0, var baseline: Double = 0.0, var descent: Double = 0.0, var bottom: Double = 0.0, var lineGap: Double = 0.0, var maxWidth: Double = 0.0, var unitsPerEm: Double = 0.0)
Link copied to clipboard
interface FontRegistry
Link copied to clipboard
data class GlyphMetrics(var size: Double = 0.0, var existing: Boolean = false, var codePoint: Int = 0, var bounds: Rectangle = Rectangle(), var xadvance: Double = 0.0)
Link copied to clipboard
data class GlyphPath(var path: VectorPath = VectorPath(), var colorShape: Shape? = null, var bitmap: Bitmap? = null, var bitmapOffset: Point = Point(0, 0), var bitmapScale: Scale = Scale(1, 1), var transform: Matrix = Matrix(), var scale: Double = 1.0) : Drawable
Link copied to clipboard
class LazyBitmapFont(val font: VectorFont, val fontSize: Double, val distanceField: String? = null) : BitmapFont, Extra
Link copied to clipboard
Link copied to clipboard
data class PlacedGlyphMetrics(val codePoint: Int, val pos: Point, val metrics: GlyphMetrics, val fontMetrics: FontMetrics, val transform: Matrix, val index: Int, val nline: Int)
Link copied to clipboard
class SystemFont(val name: String, val coroutineContext: CoroutineContext) : VectorFont, Resourceable<Font> , Extra
Link copied to clipboard
data class TextMetrics(var bounds: Rectangle = Rectangle(), var lineBounds: List<Rectangle> = emptyList(), val fontMetrics: FontMetrics = FontMetrics(), var nlines: Int = 0)
Link copied to clipboard
data class TextMetricsResult(var fmetrics: FontMetrics = FontMetrics(), var metrics: TextMetrics = TextMetrics(), var glyphs: List<PlacedGlyphMetrics> = emptyList(), var glyphsPerLine: List<List<PlacedGlyphMetrics>> = emptyList()) : BaseTextMetricsResult
Link copied to clipboard
data class TextToBitmapResult(val bmp: Bitmap, val fmetrics: FontMetrics, val metrics: TextMetrics, val glyphs: List<PlacedGlyphMetrics>, val glyphsPerLine: List<List<PlacedGlyphMetrics>>, val shape: Shape? = null) : BaseTextMetricsResult
Link copied to clipboard
object TtfCIDFont

Compact Font Format font representation (also known as a PostScript Type 1, or CIDFont) https://docs.microsoft.com/en-us/typography/opentype/spec/cff

Link copied to clipboard
class TtfFont(d: ByteArray, extName: String? = null, onlyReadMetadata: Boolean = false, enableLigatures: Boolean = true) : BaseTtfFont
Link copied to clipboard
interface VectorFont : Font
Link copied to clipboard
data class VectorFontList(val list: List<VectorFont>) : VectorFont, Extra
Link copied to clipboard
class WoffFont(d: ByteArray, extName: String? = null, onlyReadMetadata: Boolean = false) : BaseTtfFont

Properties

Link copied to clipboard
Link copied to clipboard

Gets a BitmapFont from the font, that is going to be computed lazily as glyphs are required.

Returns, creates and caches a LazyBitmapFont instance from the VectorFont that will generate and cache glyphs as required.

Link copied to clipboard

Functions

Link copied to clipboard

When getting glyphs, it first tries to resolve with first, then this this

Link copied to clipboard
fun Bitmap32.drawText(font: BitmapFont, str: String, pos: Point = Point.ZERO, color: RGBA = Colors.WHITE, size: Double = font.fontSize, alignment: TextAlignment = TextAlignment.TOP_LEFT): Bitmap32
fun <T> Font.drawText(ctx: Context2d?, size: Double, text: T, paint: Paint?, pos: Point = Point.ZERO, fill: Boolean = true, renderer: TextRenderer<T> = DefaultStringTextRenderer as TextRenderer<T>, align: TextAlignment = TextAlignment.BASELINE_LEFT, outMetrics: TextMetricsResult? = null, fillStyle: Paint? = null, stroke: Stroke? = null, textRangeStart: Int = 0, textRangeEnd: Int = Int.MAX_VALUE, placed: TextRendererActions.(codePoint: Int, Point, size: Double, metrics: GlyphMetrics, fmetrics: FontMetrics, transform: Matrix) -> Unit? = null): TextMetricsResult?
Link copied to clipboard
fun <T> Font.getTextBounds(size: Double, text: T, out: TextMetrics = TextMetrics(), renderer: TextRenderer<T> = DefaultStringTextRenderer as TextRenderer<T>, align: TextAlignment = TextAlignment.TOP_LEFT): TextMetrics
Link copied to clipboard
fun <T> Font.getTextBoundsWithGlyphs(size: Double, text: T, renderer: TextRenderer<T> = DefaultStringTextRenderer as TextRenderer<T>, align: TextAlignment = TextAlignment.BASELINE_LEFT): TextMetricsResult
Link copied to clipboard
suspend fun VfsFile.readBitmapFont(props: ImageDecodingProps = ImageDecodingProps.DEFAULT, mipmaps: Boolean = true, atlas: MutableAtlasUnit? = null): BitmapFont
Link copied to clipboard
suspend fun VfsFile.readFont(preload: Boolean = false, props: ImageDecodingProps = ImageDecodingProps.DEFAULT, mipmaps: Boolean = true): Font
Link copied to clipboard
suspend fun VfsFile.readTtfFont(onlyReadMetadata: Boolean = false, enableLigatures: Boolean = true): TtfFont
Link copied to clipboard
suspend fun VfsFile.readWoffFont(onlyReadMetadata: Boolean = false): WoffFont
Link copied to clipboard
suspend fun <T : Font> T.register(name: String = this.name): T
fun <T : Font> T.register(registry: DefaultFontRegistry, name: String = this.name): T
Link copied to clipboard
inline suspend fun <T> Font.registerTemporarily(name: String = this.name, block: () -> T): T
inline fun <T> Font.registerTemporarily(registry: DefaultFontRegistry, name: String = this.name, block: () -> T): T
Link copied to clipboard
fun Font.renderGlyphToBitmap(size: Double, codePoint: Int, paint: Paint = DefaultPaint, fill: Boolean = true, effect: BitmapEffect? = null, border: Int = 1, nativeRendering: Boolean = true, reader: WStringReader? = null): TextToBitmapResult
Link copied to clipboard
fun <T> Font.renderTextToBitmap(size: Double, text: T, paint: Paint = DefaultPaint, background: Paint = NonePaint, fill: Boolean = true, border: Int = 0, renderer: TextRenderer<T> = DefaultStringTextRenderer as TextRenderer<T>, returnGlyphs: Boolean = true, nativeRendering: Boolean = true, drawBorder: Boolean = false): TextToBitmapResult
Link copied to clipboard
suspend fun SystemFont(name: String): SystemFont
Link copied to clipboard
inline fun Font.toBitmapFont(fontSize: Number, chars: CharacterSet = CharacterSet.LATIN_ALL, fontName: String = this.name, paint: Paint = Colors.WHITE, mipmaps: Boolean = true, effect: BitmapEffect? = null): BitmapFont
Link copied to clipboard
fun VectorFont.toLazyBitmapFont(fontSize: Double, distanceField: String? = null): LazyBitmapFont
Link copied to clipboard

When getting glyphs, it first tries to resolve with this, then in order other

Link copied to clipboard
suspend fun BitmapFont.writeToFile(out: VfsFile, writeBitmap: Boolean = true)