Package 

Object FontLoader


  • 
    public class FontLoader
    
                        

    Downloads and registers custom fonts (.ttf/.otf) referenced by a hosted URL in config.

    Any element whose font_family value 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 that FontResolver returns.

    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 FontLoader INSTANCE
    • Method Summary

      Modifier and Type Method Description
      final Unit init(Context context) Wired from AppDNA.configure so downloads can reach the app cache dir.
      final Boolean isCustomFontURL(String value) True when a font_family value is a hosted custom-font URL rather than a built-in family identifier.
      final FontFamily resolve(String urlString) Returns a Compose FontFamily for a font URL once it has been downloaded + built; otherwise returns null and kicks off a one-time background download.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • init

         final Unit init(Context context)

        Wired from AppDNA.configure so downloads can reach the app cache dir.

      • isCustomFontURL

         final Boolean isCustomFontURL(String value)

        True when a font_family value 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 null and 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).