Fonts & Typefaces
The CreativeEditor SDK allows adding text elements to the scene. The available fonts can be controlled through the config.ui.typefaceLibraries
object and by creating custom asset sources.
Explore a full code sample on Stackblitz or view the code on Github.
Added typefaces are directly accessible from the typeface dropdown in the text inspector:
Configuring Custom Typefaces#
You can define your own typefaces by creating a custom asset source and by registering it in the configuration under ui.typefaceLibraries
. Each of the asset objects in the asset source must define a value for its payload.typeface
property. A typeface consists of the following properties:
name: string
the name of the typeface, which is also shown in the dropdown.
fonts[]: Object
an array of objects, where each object describes a single font of the typeface. Each font has the following properties:uri: string
points at the font file for this font style. Supportshttp(s)://
and relative paths which resolve to thebaseURL
. TrueType, OpenType, and WOFF (and WOFF2) formats are supported.subFamily: string
of the font. This is an arbitrary string as defined by the font file, e.g. 'Regular', 'ExtraBold Italic', 'Book', 'Oblique', etc. It is shown in the style dropdown in the inspector which lets users choose between all fonts of the selected typeface.weight: string
of the font. One ofthin
,extraLight
,light
,normal
,medium
,semiBold
,bold
,extraBold
,heavy
. Defaults tonormal
.style: string
of the font. One ofnormal
&italic
. Defaults tonormal
.
Removing the Default Typefaces#
In case you want to remove all of the default typefaces we ship with the CE.SDK editor, you need to remove the id of our default asset source ly.img.typeface
from the ui.typefaceLibraries
array in the editor configuration.