CachingTextShapingDriver

A caching implementation of TextShapingDriver that wraps another driver to optimize text shaping performance.

CachingTextShapingDriver maintains an in-memory LRU cache to store the results of text shaping operations. This minimizes redundant computations by reusing previously shaped results for identical inputs, thereby improving efficiency in scenarios where the same text is shaped multiple times.

Constructors

Link copied to clipboard
constructor(driver: TextShapingDriver)

Types

Link copied to clipboard
data class CacheKey(val faceHash: Long, val text: String, val features: List<ShapeFeature>, val direction: Direction?, val script: Script?, val language: String?)

Properties

Link copied to clipboard

The underlying TextShapingDriver used to perform text shaping operations when no cache hit occurs.

Functions

Link copied to clipboard
open override fun queryPositionFeatures(face: Face, script: Script): List<String>

Queries the position features available in the specified font face for a given script.

Link copied to clipboard
open override fun querySubstitutionFeatures(face: Face, script: Script): List<String>

Queries the substitution features available in the specified font face for a given script.

Link copied to clipboard

Queries the scripts supported by the specified font face.

Link copied to clipboard
open override fun shape(face: Face, text: String, features: List<ShapeFeature> = emptyList(), direction: Direction? = null, script: Script? = null, language: String? = null): List<ShapeResult>

Shapes the given text into a sequence of glyphs according to the specific font face and optional typographic attributes like writing direction and script.