-
public class FontLoaderDownloads and registers custom fonts (.ttf/.otf) referenced by a hosted URL in config.
Any element whose
font_familyvalue is a font URL (instead of a built-in family identifier) renders that font — the loader downloads it once, caches it in the app's cache dir, builds an android.graphics.Typeface via AndroidTypeface.createFromFile, and hands back a Compose FontFamily thatFontResolverreturns.The file-UPLOAD backend (storing an author-uploaded .ttf → serving a stable URL) is separate infrastructure; this loader works with ANY hosted font URL today.
-
-
Field Summary
Fields Modifier and Type Field Description public final static FontLoaderINSTANCE
-
Method Summary
Modifier and Type Method Description final Unitinit(Context context)Wired from AppDNA.configureso downloads can reach the app cache dir.final BooleanisCustomFontURL(String value)True when a font_familyvalue is a hosted custom-font URL rather than a built-in family identifier.final FontFamilyresolve(String urlString)Returns a Compose FontFamily for a font URL once it has been downloaded + built; otherwise returns nulland kicks off a one-time background download.-
-
Method Detail
-
init
final Unit init(Context context)
Wired from
AppDNA.configureso downloads can reach the app cache dir.
-
isCustomFontURL
final Boolean isCustomFontURL(String value)
True when a
font_familyvalue is a hosted custom-font URL rather than a built-in family identifier.
-
resolve
final FontFamily resolve(String urlString)
Returns a Compose FontFamily for a font URL once it has been downloaded + built; otherwise returns
nulland kicks off a one-time background download. Callers fall back to the default family until it becomes available (the next config re-render picks it up from the cache).
-
-
-
-