addFontAssociation

fun Krayon.addFontAssociation(fontName: String, @FontRes fontRes: Int)

Associate a Font.name to a FontRes id. As a best-practice, do this up front for any fonts that might be used, as calls to addFontAssociation are cheap and the behavior for missing associations is expensive (Resources.getIdentifier).

These associations are only used when drawing to an AndroidKanvas. If using compose with a ComposeKanvas, see the overload with FontResource instead.


fun addFontAssociation(fontName: String, @FontRes fontRes: Int)

Deprecated

This function has been moved to an extension function on Krayon.

Replace with

import com.juul.krayon.core.Krayon
import com.juul.krayon.kanvas.addFontAssociation
Krayon.addFontAssociation(fontName, fontRes)

Associate a Font.name to a FontRes id. As a best-practice, do this up front for any fonts that might be used, as calls to addFontAssociation are cheap and the behavior for missing associations is expensive (Resources.getIdentifier).

These associations are only used when drawing to an AndroidKanvas. If using Compose with a ComposeKanvas, see the overload with FontResource instead.