I tried the following code to add custom fonts to the imglyKit SDK, but did not add a custom font. I also put the .ttf file in the info.plist file as a resource.
let sampleImage = image.image let configuration = Configuration() { builder in FontImporter.init().importFonts() builder.configurePhotoEditorViewController({ (editPhotoOption) in editPhotoOption.allowedPhotoEditorActions = [.text] editPhotoOption.actionButtonConfigurationClosure = {cell, _ in cell.captionLabel.text = "Add Text" //cell.backgroundColor = UIColor.red } editPhotoOption.backgroundColor = UIColor.brown editPhotoOption.allowsPreviewImageZoom = false }) builder.configureToolStackController({ (toolStackOption) in toolStackOption.mainToolbarBackgroundColor = UIColor.red toolStackOption.secondaryToolbarBackgroundColor = UIColor.brown }) builder.configureTextFontToolController({ (textFontToolOption) in var fontArray = [String]() fontArray = ["AlexBrush_Regular.ttf", "Arabella.ttf"] textFontToolOption.accessibilityElements = fontArray textFontToolOption.actionButtonConfigurationClosure = { cell, _ in cell.backgroundColor = UIColor.red } }) builder.configureTextToolController({ (textToolOption) in textToolOption.textViewConfigurationClosure = { label in label.textAlignment = NSTextAlignment.center } }) } let photoEditViewController = PhotoEditViewController(photo: sampleImage!, configuration: configuration) let toolStackController = ToolStackController(photoEditViewController: photoEditViewController) toolStackController.delegate = self toolStackController.navigationController?.view.backgroundColor = UIColor.red present(toolStackController, animated: true, completion: nil)
please help me add custom font
I also used the FontImporter class to load a custom font according to the manual here http://static.photoeditorsdk.com/docs/ios/Classes/FontImporter.html Thanks ...
source share