From Remote URL
PhotoEditor SDK supports loading fonts from a remote URL, this can be a resource hosted by a hosting provider or by 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 the font#
In order to use a custom font in the editor, we are downloading the remote resource to the temporary directory.
Adding custom font#
Using the downloaded resource, we are loading the custom font into the configuration. Each custom font takes an identifier
, a name
, a fontName
as well as a fontUri
that points to a local font file which can either be a TTF
or an OTF
font.
Handle user interaction#
For this example, we are disabling user interaction while the download task is executing. In production, you might want to indicate download progress here. When the download has finished, we can reenable user interaction and dismiss the progress indicator.