Salesforce

How Do I Install and Use Third Party Fonts in an iOS App? (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Install and Use Third Party Fonts in an iOS App? (Magic xpa 3.x)

To use third party fonts in an iOS app, you first need to include them in your client application and then use them in your Magic xpa application.

Adding third party fonts to your client application

  1. Copy the iOS Client application from the %EngineDir%RiaModules\iOS\Source folder to your Mac.

  2. Open the XCode application on a Mac machine.

  3. From the File menu, click Open and navigate to the iOS Client Application source folder.

  4. Select the MagicApp.xcodeproj file and open it.

  5. Right click on the project name (MagicApp) on the left side of the project tree view and select Add Files to MagicApp.

  6. Select all of the required fonts and click Add. Make sure that the Add to targets section shows your project that you selected.

  1. Make sure that the fonts that you selected are included in the build target (bundle): On the left tree view, under MagicApp, for each font listed in the project, check in its properties pane on the right-side that for Target Membership the correct bundle is selected.

  1. Check that the fonts are included as Resources in the bundle: Highlight the XCode project on the left tree view pane and from the middle pane, select the Build Phases tab and check that the fonts that you added appear in the Copy Bundle Resources section.

Now you want to include the third party fonts in the application's .plist file:

  1. Click the application’s .plist file, which you can find in the left side of the tree view pane, in the MagicApp/Supporting Files subfolder (Magic's default .plist file name is MagicApp-info.plist).

  2. Highlight the Information Property List section in the middle pane and click its + (plus) sign.

  3. In the new row, type in this text exactly as it appears: Fonts provided by application

  4. For the new row, add sub-rows that will make this new row of Array type.

Each sub-row is for each of the new third party fonts. Make sure to include the extension and make sure that there are no typos in the filenames.

  1. Compile your client application.

Using the third party font in Magic xpa

The next step is to identify the font’s postscript name and define it in Magic xpa.

To find the font’s postscript name:

  1. In OS X, open the built-in Font Book utility.

  2. Click on the + (plus) sign, and choose to open all the third party required fonts:

  3. When you select one of the third party fonts, you will see its (PostScript) name, as shown below.

This is the name that should be used in the Magic xpa fonts configuration file.

To use this font in your application:

  1. In the Magic xpa application, open the fonts file (by default it is fnt_rnt.eng) using a text editor.

  2. Add new lines, one per each new third party font, using its PostScript name, and save the file. For example: MyMuseoFont100,MuseoSans-100,12,0,0

  3. Restart the Studio after you save the file.

  4. In the Magic xpa application, define this font for the controls that you want to use, as you would do for any font.

That’s it. You can now run your project and see the new font in your application.

Reference
Attachment 
Attachment