Add External Fonts to Android
Once you have your Android Output ready, you will likely want to add your custom fonts to your project. There are a few simple steps to do this, but this must be done for each TextView you want the font applied to.
We will automate this process in a future Lighting Storm release.
Before You Begin
Adobe loads fonts installed in the System Fonts
directory or installed in the Adobe Common Files
.
ADOBE FONTS (WIN): C:\Program Files\Common Files\Adobe\Fonts -- or -- C:\Program Files (x86)\Common Files\Adobe\Fonts
ADOBE FONTS (MAC): ~/Library/Application Support/Adobe/Fonts
SYSTEM FONTS (WIN): C:\Windows\Fonts
SYSTEM FONTS (MAC): ~/Library/Fonts Learn more about Font Locations.
You will need to copy your fonts files into your Android project, we recommend you use the .ttf
file.
Advanced Users
You can create another Fonts directory in your Custom User Data, then sync the folder with Adobe Fonts. This will allow you to have Adobe Specific Fonts
.
WIN: C:\Users\YourUserName\Export Kit\ftml-data\adobe-fonts
MAC: ~/Export Kit/ftml-data/adobe-fonts
Create a Symlink
Open your command prompt/terminal: 1. Click Start > Search type "cmd" 2. Right Click > Run as Administrator
WIN
Navigate to "C:\Program Files\Common Files\Adobe
"
Then paste the following code into your command prompt (remember to change “YourUserName
” to your real User Name):
1 | mklink /D Fonts C:\Users\YourUserName\Export Kit\ftml-data\adobe-fonts |
MAC
Type the following in the Terminal
1 | ln -s ~/Export Kit/ftml-data/adobe-fonts ~/Library/Application Support/Adobe/Fonts |
This will create a symlink to your Custom User Data and allow you to have a global Adobe fonts directory.
Step 1: Copy Your Fonts
Copy all required fonts to your Android Output assets folder. If you do not have an assets folder, you can create one similar to this:
[Your Project] |assets ----|fonts --------|mytruetypefont.ttf |src |res
Step 2: Update the Java Activity
Once your font assets are copied, you will need to update your Java code to reflect the new typeface.
1 2 3 | TextView myTextView = (TextView)findViewById(R.id.myTextViewID); Typeface typeFace = Typeface.createFromAsset(getAssets(),"fonts/mytruetypefont.ttf"); myTextView.setTypeface(typeFace); |
You will need to repeat this step for each Font+TextView
element in your design.