From Remote URL
PhotoEditor SDK supports loading fonts from a remote URL, this can be a resource hosted by a file hosting provider or your servers. Although the editor supports adding assets with remote URLs, we highly recommend that you manage the download of remote resources yourself, since this gives you more control over the whole process.
Download font#
Here, we create a File
in the cache directory and download the remote font. Since file handling and downloading are IO operations, we do this inside a coroutine using the IO dispatcher.
Create FontAsset
#
FontAsset
#Here, we create a FontAsset
with a unique identifier and the font file downloaded above.
Add font to AssetConfig
#
AssetConfig
#To use the font, it must first be available in the SDK's backend. This is done by adding the FontAsset
to the AssetConfig
.
Configure UiConfigText
#
UiConfigText
#Here, we configure UiConfigText
and add a custom FontItem
to the fontList
.