Get access to over 100 FireMonkey cross platform samples for Android, IOS, OSX, Windows, and Linux!

AndroidAppmethodCode SnippetDelphiFiremonkey

Custom True Type Fonts On Android With Delphi XE5 and XE6 Firemonkey

Delphi XE5 Firemonkey TTF Fonts AndroidOver on the Embarcadero forum for Firemonkey there is a question and answer thread about dynamically loading a TrueType font on Android in a Delphi XE5 Firemonkey app. This method also works with Delphi XE6 and should work with AppMethod. Douglas Rudd wrote the instructions for making it happen and they involve copying the FMX.FontGlyphs.Android file to your project directory. You then modify the Delphi unit with some custom code to load a TTF file from the directory of your application. The magic takes place in the createFromFile() function in TJTypeFace:

You also include your TrueType font file inside your APK using the Delphi Deployment functionality. Add the TTF file to your Deployment and change the directory to: .\assets\internal\ One gotcha that you have to watch out for is that you must use the actual name of the font file minus the .ttf in the Font Family property in Delphi. Using the name of the font and not the filename will not work and remember Java is case sensitive (and so are the filenames).

The instructions are originally from two different blogs in Chinese here and here.

Head over and read the full forum thread on the Embarcadero site on using a custom font in Delphi Firemonkey on Android.


Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

Related posts

FireMonkey 10.4.2 Features Updated iOS 14, Android 11, And macOS 11 Support Plus Hundreds Of Fixes


Ryzen 9 5950x: One Billion Lines Of Delphi Code Compiled In ~5 Minutes On 16 Cores


DelphiCon 2020 FireMonkey Sessions Available Starting November 19


Powerful Commercial Gorilla3D Framework Upgraded For Delphi FireMonkey On Windows And Android

Sign up for our Newsletter and
stay informed

Leave a Reply