From App Bundle
VideoEditor SDK supports adding custom fonts from the app bundle. In this example, we add the font Raleway as well as a system font.
Custom Fonts#
VideoEditor SDK supports custom TTF
and OTF
fonts. Each custom font takes an identifier
, a name
, a fontName
as well as a fontUri
that points to the local font file. Remote resources are also supported, however, they need to be downloaded in advance. For further reference, please have a look at the dedicated section on this.
System Fonts#
Furthermore, the SDK also supports adding system fonts. To add these, simply add the matching fontName
, as well as your identifier
and the name
.
import 'package:catalog/models/code_example.dart';import 'package:imgly_sdk/imgly_sdk.dart';import 'package:video_editor_sdk/video_editor_sdk.dart';class VideoTextLocalExample extends CodeExample {void invoke() async {// Add a video from the assets directory.final video = Video("assets/Skater.mp4");// Create [TextOptions] to customize the text tool.final textOptions = TextOptions(fonts: [// A custom font.Font("custom_font_raleway_regular", "custom_font_raleway_regular","Raleway",fontUri: "assets/custom_font_raleway_regular.ttf"),// A system font.Font("system_font_helvetica", "Helvetica", "Helvetica")]);// Create a [Configuration] instance.final configuration = Configuration(text: textOptions);try {// Open the video editor and handle the export as well as any occurring errors.final result =await VESDK.openEditor(video, configuration: configuration);if (result != null) {// The user exported a new video successfully and the newly generated video is located at `result.video`.print(result.video);} else {// The user tapped on the cancel button within the editor.return;}} catch (error) {// There was an error generating the video.print(error);}}}