commit | 1a1e7fe5ffed4eba4983420a3b4d6c3706487dcb | [log] [tgz] |
---|---|---|
author | randallli <randallli@google.com> | Wed Dec 07 16:29:50 2016 |
committer | randallli <randallli@google.com> | Wed Dec 07 16:30:01 2016 |
tree | 9adc64ddca0924918cf6624085d4a7794b528abf | |
parent | 20c8fe37329cb18826f90159ce4ee445079e2e46 [diff] |
added change log entry for first release
#FontDiskLoader
Registers a single custom font asset from disk
In order to use custom fonts on iOS the font assets need to be registered before they can be used. Font Disk Loader lazily registers your custom fonts.
To add this component to your Xcode project using CocoaPods, add the following to your Podfile
:
pod 'MDFFontDiskLoader'
Then, run the following command:
pod install
Before using Font Disk Loader, you'll need to import it:
#import "MaterialFontDiskLoader.h"
import MDFFontDiskLoader
Make sure to add your font (or the bundle it is in) to your app target. The FontDiskLoader will lazy register the font using a CoreText API so adding a the font to your info.plist
is not necessary. All you need to do is initialize the loader with the font name and url to the file and ask for the font.
MDFFontDiskLoader *fontDiskLoader = [[MDFFontDiskLoader alloc] initWithFontName:nameOfFontInFile URL:fontURLOnDisk]; UIFont *font = [fontDiskLoader fontOfSize:16];
let fontLoader = MDFFontDiskLoader.init(fontName: nameOfFontInFile, fontURL: fontURLOnDisk); let myFont:UIFont = fontLoader.fontOfSize(16)!;