No description, website, or topics provided.
Switch branches/tags
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples fixed copyright Dec 7, 2016
src fixed copyright Dec 7, 2016
tests/unit fixed copyright Dec 7, 2016
.clang-format Initial commit Nov 28, 2016
.codecov.yml Initial commit Nov 28, 2016
.gitignore Initial commit Nov 28, 2016
.jazzy.yaml more docs updates Nov 29, 2016
.travis.yml more docs updates Nov 29, 2016
AUTHORS Initial commit Nov 28, 2016
CHANGELOG.md added change log entry for first release Dec 7, 2016
CONTRIBUTING.md Initial commit Nov 28, 2016
LICENSE Initial commit Nov 28, 2016
MDFFontDiskLoader.podspec changed min os to 7 Nov 29, 2016
README.md [Docs] Clarity in README (#1) Feb 17, 2017

README.md

#FontDiskLoader

Registers a single custom font asset from disk

Material Design Specifications

Overview

Font Disk Loader lazily registers custom fonts and caches them even if they are not included in the app's info.plist.

Installation

Requirements

  • Xcode 7.0 or higher.
  • iOS SDK version 7.0 or higher.

Installation with CocoaPods

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

Importing

Before using Font Disk Loader, you'll need to import it:

Objective-C

#import "MaterialFontDiskLoader.h"

Swift

import MDFFontDiskLoader

Usage

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 the font to your info.plist is not necessary. All you need to do is initialize the loader with the font name and url of the file and ask for the font.

Code snippets

Objective-C

  MDFFontDiskLoader *fontDiskLoader =
      [[MDFFontDiskLoader alloc] initWithFontName:nameOfFontInFile fontURL:fontURLOnDisk];
  UIFont *font = [fontDiskLoader fontOfSize:16];

Swift

    let fontLoader = MDFFontDiskLoader.init(fontName: nameOfFontInFile, fontURL: fontURLOnDisk);
    let myFont:UIFont = fontLoader.fontOfSize(16)!;