Docs
API Docs

Text

Text tool

A picture says more than a thousand words, however sometimes it still takes a few more. The robust text feature of the PhotoEditor SDK provides all necessary functions for quickly adding text to any picture or creative. The corresponding font library can easily be exchanged, reduced, or expanded.

The tool is implemented in the TextEditorTool class and displayed using the TextToolPanel. If you want to customize the appearance of this tool, take a look at the styling section.

Adding and removing fonts

The SDK comes with a predefined set of fonts, which you can examine in our demo app. You can download the app from the Play Store or clone from the demo repository.

Editor Fonts

In order to change the available fonts or rearrange them, start with a default PESDKConfig as described in the configuration section and use the getFontConfig() method. This method returns an ArrayList containing the default fonts. Use the clear() method to clear the list and re-fill it with the fonts you like in any order you prefer or set a new list with setFontConfig().

/* Step 1: Get the default configuration. */
ArrayList<FontConfig> fonts = config.getFontConfig();

/* Step 2: Clear the ArrayList. */
fonts.clear();

/*
 * Step 3: Add the fonts you like
 *
 * A FontConfig takes two parameters:
 *
 *   Parameter 1: Resource identifier of the font name or a String (String)
 *   Parameter 2: A File object or a String with the assets font path e.g. fonts/AbrahamLincoln.ttf
 */
fonts.add(new FontConfig(""Geared Slab", "fonts/GearedSlab.ttf"));
fonts.add(new FontConfig("Geared Slab", "fonts/AbrahamLincoln.ttf"));