├── .clang-format ├── .codecov.yml ├── .gitignore ├── .jazzy.yaml ├── .travis.yml ├── AUTHORS ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── MDFFontDiskLoader.podspec ├── README.md ├── examples ├── FontDiskLoaderSimipleExample.m ├── apps │ └── FontDiskLoaderExample │ │ ├── FontDiskLoaderExample.xcodeproj │ │ └── project.pbxproj │ │ ├── FontDiskLoaderExample │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Assets.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── main.m │ │ ├── FontDiskLoaderExampleTests │ │ └── Info.plist │ │ ├── Podfile │ │ └── Podfile.lock └── supplemental │ └── CustomFont.bundle │ ├── BlackPixel.png │ └── Roboto-Regular.ttf ├── src ├── MDFFontDiskLoader.h ├── MDFFontDiskLoader.m └── MaterialFontDiskLoader.h └── tests └── unit └── FontDiskLoaderTests.m /.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Google 2 | 3 | AllowShortFunctionsOnASingleLine: Inline 4 | AllowShortIfStatementsOnASingleLine: false 5 | AllowShortLoopsOnASingleLine: false 6 | AlwaysBreakBeforeMultilineStrings: false 7 | BinPackParameters: false 8 | ColumnLimit: 0 9 | IndentWrappedFunctionNames: true 10 | ObjCSpaceBeforeProtocolList: true 11 | PointerBindsToType: false 12 | SortIncludes: true 13 | -------------------------------------------------------------------------------- /.codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | ignore: 3 | - "examples/" 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Jazzy 2 | docs/ 3 | 4 | # Xcode 5 | # 6 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 7 | 8 | ## Build generated 9 | build/ 10 | DerivedData/ 11 | 12 | ## Various settings 13 | *.pbxuser 14 | !default.pbxuser 15 | *.mode1v3 16 | !default.mode1v3 17 | *.mode2v3 18 | !default.mode2v3 19 | *.perspectivev3 20 | !default.perspectivev3 21 | xcuserdata/ 22 | 23 | ## Other 24 | *.moved-aside 25 | *.xcuserstate 26 | 27 | ## Obj-C/Swift specific 28 | *.hmap 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | ## Playgrounds 34 | timeline.xctimeline 35 | playground.xcworkspace 36 | 37 | # Swift Package Manager 38 | # 39 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 40 | # Packages/ 41 | .build/ 42 | 43 | # CocoaPods 44 | # 45 | # We recommend against adding the Pods directory to your .gitignore. However 46 | # you should judge for yourself, the pros and cons are mentioned at: 47 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 48 | # 49 | Pods/ 50 | *.xcworkspace 51 | 52 | # Carthage 53 | # 54 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 55 | # Carthage/Checkouts 56 | 57 | Carthage/Build 58 | 59 | # fastlane 60 | # 61 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 62 | # screenshots whenever they are needed. 63 | # For more information about the recommended setup visit: 64 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 65 | 66 | fastlane/report.xml 67 | fastlane/Preview.html 68 | fastlane/screenshots 69 | fastlane/test_output 70 | -------------------------------------------------------------------------------- /.jazzy.yaml: -------------------------------------------------------------------------------- 1 | module: MDFFontDiskLoader 2 | module_version: 1.0.0 3 | umbrella_header: src/MaterialFontDiskLoader.h 4 | objc: true 5 | sdk: iphonesimulator 6 | github_url: https://github.com/material-foundation/material-font-disk-loader-ios 7 | github_file_prefix: https://github.com/material-foundation/material-font-disk-loader-ios/tree/v1.0.0 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | osx_image: xcode8.1 3 | sudo: false 4 | notifications: 5 | email: false 6 | before_install: 7 | - gem install cocoapods --no-rdoc --no-ri --no-document --quiet 8 | - git clone https://github.com/phacility/arcanist.git 9 | - git clone https://github.com/phacility/libphutil.git 10 | - git clone --recursive https://github.com/material-foundation/material-arc-tools.git 11 | - pod install --repo-update 12 | script: 13 | - set -o pipefail 14 | - arcanist/bin/arc unit --everything --trace 15 | - xcodebuild build -workspace FontDiskLoaderExample.xcworkspace -scheme Catalog -sdk "iphonesimulator10.1" -destination "name=iPhone 6s,OS=10.1" ONLY_ACTIVE_ARCH=YES | xcpretty -c; 16 | after_success: 17 | - bash <(curl -s https://codecov.io/bash) 18 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the list of MDFFontDiskLoader authors for copyright purposes. 2 | # 3 | # This does not necessarily list everyone who has contributed code, since in 4 | # some cases, their employer may be the copyright holder. To see the full list 5 | # of contributors, see the revision history with git log. 6 | 7 | Google Inc. 8 | and other contributors 9 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.0 2 | 3 | Initial release. 4 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Want to contribute? Great! First, read this page (including the small print at 2 | the end). 3 | 4 | ### Before you contribute 5 | 6 | Before we can use your code, you must sign the 7 | [Google Individual Contributor License Agreement] 8 | (https://cla.developers.google.com/about/google-individual) 9 | (CLA), which you can do online. The CLA is necessary mainly because you own the 10 | copyright to your changes, even after your contribution becomes part of our 11 | codebase, so we need your permission to use and distribute your code. We also 12 | need to be sure of various other things—for instance that you'll tell us if you 13 | know that your code infringes on other people's patents. You don't have to sign 14 | the CLA until after you've submitted your code for review and a member has 15 | approved it, but you must do it before we can put your code into our codebase. 16 | Before you start working on a larger contribution, you should get in touch with 17 | us first through the issue tracker with your idea so that we can help out and 18 | possibly guide you. Coordinating up front makes it much easier to avoid 19 | frustration later on. 20 | 21 | ### Code reviews 22 | 23 | All submissions, including submissions by project members, require review. 24 | We use GitHub pull requests for this purpose. 25 | 26 | ### The small print 27 | 28 | Contributions made by corporations are covered by a different agreement than 29 | the one above, the 30 | [Software Grant and Corporate Contributor License Agreement] 31 | (https://cla.developers.google.com/about/google-corporate). 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /MDFFontDiskLoader.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "MDFFontDiskLoader" 3 | s.summary = "MDFFontDiskLoader" 4 | s.version = "1.0.0" 5 | s.authors = "The Material Foundation Authors" 6 | s.license = "Apache 2.0" 7 | s.homepage = "https://github.com/material-foundation/material-font-disk-loader-ios" 8 | s.source = { :git => "https://github.com/material-foundation/material-font-disk-loader-ios.git", :tag => "v" + s.version.to_s } 9 | s.platform = :ios, "7.0" 10 | s.requires_arc = true 11 | s.public_header_files = "src/*.h" 12 | s.source_files = "src/*.{h,m,mm}", "src/private/*.{h,m,mm}" 13 | end 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #FontDiskLoader 2 | 3 | Registers a single custom font asset from disk 4 | 5 | 6 | ### Material Design Specifications 7 | 8 | 15 | 16 | ## Overview 17 | 18 | Font Disk Loader lazily registers custom fonts and caches them even if they are not included in the app's info.plist. 19 | 20 | ## Installation 21 | 22 | ### Requirements 23 | 24 | - Xcode 7.0 or higher. 25 | - iOS SDK version 7.0 or higher. 26 | 27 | ### Installation with CocoaPods 28 | 29 | To add this component to your Xcode project using CocoaPods, add the following to your `Podfile`: 30 | 31 | ~~~ 32 | pod 'MDFFontDiskLoader' 33 | ~~~ 34 | 35 | Then, run the following command: 36 | 37 | ~~~ bash 38 | pod install 39 | ~~~ 40 | 41 | ### Importing 42 | 43 | Before using Font Disk Loader, you'll need to import it: 44 | 45 | 46 | #### Objective-C 47 | 48 | ~~~ objc 49 | #import "MaterialFontDiskLoader.h" 50 | ~~~ 51 | 52 | #### Swift 53 | ~~~ swift 54 | import MDFFontDiskLoader 55 | ~~~ 56 | 57 | 58 | ## Usage 59 | 60 | Make sure to add your font (or the bundle it is in) to your app target. The FontDiskLoader will lazy 61 | register the font using a CoreText API so adding the font to your `info.plist` is not necessary. 62 | All you need to do is initialize the loader with the font name and url of the file and ask for the 63 | font. 64 | 65 | ## Code snippets 66 | 67 | 68 | #### Objective-C 69 | ~~~ objc 70 | MDFFontDiskLoader *fontDiskLoader = 71 | [[MDFFontDiskLoader alloc] initWithFontName:nameOfFontInFile fontURL:fontURLOnDisk]; 72 | UIFont *font = [fontDiskLoader fontOfSize:16]; 73 | ~~~ 74 | 75 | #### Swift 76 | ~~~ swift 77 | let fontLoader = MDFFontDiskLoader.init(fontName: nameOfFontInFile, fontURL: fontURLOnDisk); 78 | let myFont:UIFont = fontLoader.fontOfSize(16)!; 79 | ~~~ 80 | 81 | -------------------------------------------------------------------------------- /examples/FontDiskLoaderSimipleExample.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015-present Google Inc.. All Rights Reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MaterialFontDiskLoader.h" 20 | 21 | NSString *const CustomFontBundle = @"CustomFont.bundle"; 22 | NSString *const CustomFontRegularFontName = @"Roboto-Regular"; 23 | NSString *const CustomFontRegularFontFilename = @"Roboto-Regular.ttf"; 24 | 25 | @interface FontDiskLoaderSimpleExample : UIViewController 26 | @end 27 | 28 | @implementation FontDiskLoaderSimpleExample 29 | 30 | - (void)viewDidLoad { 31 | [super viewDidLoad]; 32 | 33 | self.view.backgroundColor = [UIColor whiteColor]; 34 | UIViewAutoresizing flexibleMargins = 35 | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | 36 | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; 37 | 38 | // Consider using the named styles provided by the Typography component instead of specific font 39 | // sizes. See https://github.com/material-components/material-components-ios/tree/develop/components/Typography 40 | 41 | NSBundle *bundle = [NSBundle bundleForClass:[self class]]; 42 | MDFFontDiskLoader *fontDiskLoader = 43 | [[MDFFontDiskLoader alloc] initWithFontName:CustomFontRegularFontName 44 | filename:CustomFontRegularFontFilename 45 | bundleFileName:CustomFontBundle 46 | baseBundle:bundle]; 47 | 48 | UILabel *label = [[UILabel alloc] init]; 49 | label.text = @"This is Roboto regular 16"; 50 | label.font = [fontDiskLoader fontOfSize:16]; 51 | [label sizeToFit]; 52 | label.autoresizingMask = flexibleMargins; 53 | label.center = CGPointMake(CGRectGetMidX(self.view.bounds), CGRectGetMidY(self.view.bounds)); 54 | [self.view addSubview:label]; 55 | } 56 | 57 | #pragma mark - Supplemental 58 | 59 | + (NSArray *)catalogBreadcrumbs { 60 | return @[ @"Font Disk Loader" ]; 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /examples/apps/FontDiskLoaderExample/FontDiskLoaderExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1434C9B3015DC5F283B7B6C1 /* Pods_FontDiskLoaderExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E9309652CB2B534DF5441F33 /* Pods_FontDiskLoaderExample.framework */; }; 11 | 2011CBFB1DEDF9720047F8B5 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2011CBFA1DEDF9720047F8B5 /* main.m */; }; 12 | 2011CBFE1DEDF9720047F8B5 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2011CBFD1DEDF9720047F8B5 /* AppDelegate.m */; }; 13 | 2011CC041DEDF9720047F8B5 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2011CC021DEDF9720047F8B5 /* Main.storyboard */; }; 14 | 2011CC061DEDF9720047F8B5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2011CC051DEDF9720047F8B5 /* Assets.xcassets */; }; 15 | 2011CC091DEDF9720047F8B5 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2011CC071DEDF9720047F8B5 /* LaunchScreen.storyboard */; }; 16 | 20BB4D2A1DEDFA4A00838A41 /* FontDiskLoaderSimipleExample.m in Sources */ = {isa = PBXBuildFile; fileRef = 20BB4D291DEDFA4A00838A41 /* FontDiskLoaderSimipleExample.m */; }; 17 | 20BB4D2C1DEDFB4B00838A41 /* CustomFont.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 20BB4D2B1DEDFB4B00838A41 /* CustomFont.bundle */; }; 18 | 20BB4D2F1DEDFE1700838A41 /* FontDiskLoaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 20BB4D2D1DEDFDB600838A41 /* FontDiskLoaderTests.m */; }; 19 | 5BDF4D20BDF79B78B137C77D /* Pods_FontDiskLoaderExample_FontDiskLoaderExampleTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 67F6DC37B3A8C5FA7F341D05 /* Pods_FontDiskLoaderExample_FontDiskLoaderExampleTests.framework */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 2011CC101DEDF9720047F8B5 /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = 2011CBEE1DEDF9720047F8B5 /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 2011CBF51DEDF9720047F8B5; 28 | remoteInfo = FontDiskLoaderExample; 29 | }; 30 | /* End PBXContainerItemProxy section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | 1DFCA02F9B84CF6D04124AAD /* Pods-FontDiskLoaderExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FontDiskLoaderExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FontDiskLoaderExample/Pods-FontDiskLoaderExample.debug.xcconfig"; sourceTree = ""; }; 34 | 2011CBF61DEDF9720047F8B5 /* FontDiskLoaderExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FontDiskLoaderExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | 2011CBFA1DEDF9720047F8B5 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 36 | 2011CBFC1DEDF9720047F8B5 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 37 | 2011CBFD1DEDF9720047F8B5 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 38 | 2011CC031DEDF9720047F8B5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 39 | 2011CC051DEDF9720047F8B5 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 40 | 2011CC081DEDF9720047F8B5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 41 | 2011CC0A1DEDF9720047F8B5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 42 | 2011CC0F1DEDF9720047F8B5 /* FontDiskLoaderExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FontDiskLoaderExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 43 | 2011CC151DEDF9720047F8B5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 44 | 20BB4D291DEDFA4A00838A41 /* FontDiskLoaderSimipleExample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FontDiskLoaderSimipleExample.m; path = ../../../FontDiskLoaderSimipleExample.m; sourceTree = ""; }; 45 | 20BB4D2B1DEDFB4B00838A41 /* CustomFont.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = CustomFont.bundle; path = ../../../supplemental/CustomFont.bundle; sourceTree = ""; }; 46 | 20BB4D2D1DEDFDB600838A41 /* FontDiskLoaderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FontDiskLoaderTests.m; path = ../../../../tests/unit/FontDiskLoaderTests.m; sourceTree = ""; }; 47 | 67F6DC37B3A8C5FA7F341D05 /* Pods_FontDiskLoaderExample_FontDiskLoaderExampleTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FontDiskLoaderExample_FontDiskLoaderExampleTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | 73E74C55B0E8B83357E8EDFD /* Pods-FontDiskLoaderExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FontDiskLoaderExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-FontDiskLoaderExample/Pods-FontDiskLoaderExample.release.xcconfig"; sourceTree = ""; }; 49 | 8EB3B1E70CED076EAE587D88 /* Pods-FontDiskLoaderExample-FontDiskLoaderExampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FontDiskLoaderExample-FontDiskLoaderExampleTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-FontDiskLoaderExample-FontDiskLoaderExampleTests/Pods-FontDiskLoaderExample-FontDiskLoaderExampleTests.release.xcconfig"; sourceTree = ""; }; 50 | E9309652CB2B534DF5441F33 /* Pods_FontDiskLoaderExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FontDiskLoaderExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | F32FDFBA180521C3CF926509 /* Pods-FontDiskLoaderExample-FontDiskLoaderExampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FontDiskLoaderExample-FontDiskLoaderExampleTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FontDiskLoaderExample-FontDiskLoaderExampleTests/Pods-FontDiskLoaderExample-FontDiskLoaderExampleTests.debug.xcconfig"; sourceTree = ""; }; 52 | /* End PBXFileReference section */ 53 | 54 | /* Begin PBXFrameworksBuildPhase section */ 55 | 2011CBF31DEDF9720047F8B5 /* Frameworks */ = { 56 | isa = PBXFrameworksBuildPhase; 57 | buildActionMask = 2147483647; 58 | files = ( 59 | 1434C9B3015DC5F283B7B6C1 /* Pods_FontDiskLoaderExample.framework in Frameworks */, 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | 2011CC0C1DEDF9720047F8B5 /* Frameworks */ = { 64 | isa = PBXFrameworksBuildPhase; 65 | buildActionMask = 2147483647; 66 | files = ( 67 | 5BDF4D20BDF79B78B137C77D /* Pods_FontDiskLoaderExample_FontDiskLoaderExampleTests.framework in Frameworks */, 68 | ); 69 | runOnlyForDeploymentPostprocessing = 0; 70 | }; 71 | /* End PBXFrameworksBuildPhase section */ 72 | 73 | /* Begin PBXGroup section */ 74 | 2011CBED1DEDF9720047F8B5 = { 75 | isa = PBXGroup; 76 | children = ( 77 | 2011CBF81DEDF9720047F8B5 /* FontDiskLoaderExample */, 78 | 2011CC121DEDF9720047F8B5 /* FontDiskLoaderExampleTests */, 79 | 2011CBF71DEDF9720047F8B5 /* Products */, 80 | 8E7A13A19760811888D03744 /* Pods */, 81 | DE3088D2878E0352021F594C /* Frameworks */, 82 | ); 83 | sourceTree = ""; 84 | }; 85 | 2011CBF71DEDF9720047F8B5 /* Products */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 2011CBF61DEDF9720047F8B5 /* FontDiskLoaderExample.app */, 89 | 2011CC0F1DEDF9720047F8B5 /* FontDiskLoaderExampleTests.xctest */, 90 | ); 91 | name = Products; 92 | sourceTree = ""; 93 | }; 94 | 2011CBF81DEDF9720047F8B5 /* FontDiskLoaderExample */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 2011CBFC1DEDF9720047F8B5 /* AppDelegate.h */, 98 | 2011CBFD1DEDF9720047F8B5 /* AppDelegate.m */, 99 | 20BB4D291DEDFA4A00838A41 /* FontDiskLoaderSimipleExample.m */, 100 | 20BB4D2B1DEDFB4B00838A41 /* CustomFont.bundle */, 101 | 2011CC021DEDF9720047F8B5 /* Main.storyboard */, 102 | 2011CC051DEDF9720047F8B5 /* Assets.xcassets */, 103 | 2011CC071DEDF9720047F8B5 /* LaunchScreen.storyboard */, 104 | 2011CC0A1DEDF9720047F8B5 /* Info.plist */, 105 | 2011CBF91DEDF9720047F8B5 /* Supporting Files */, 106 | ); 107 | path = FontDiskLoaderExample; 108 | sourceTree = ""; 109 | }; 110 | 2011CBF91DEDF9720047F8B5 /* Supporting Files */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 2011CBFA1DEDF9720047F8B5 /* main.m */, 114 | ); 115 | name = "Supporting Files"; 116 | sourceTree = ""; 117 | }; 118 | 2011CC121DEDF9720047F8B5 /* FontDiskLoaderExampleTests */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | 20BB4D2D1DEDFDB600838A41 /* FontDiskLoaderTests.m */, 122 | 2011CC151DEDF9720047F8B5 /* Info.plist */, 123 | ); 124 | path = FontDiskLoaderExampleTests; 125 | sourceTree = ""; 126 | }; 127 | 8E7A13A19760811888D03744 /* Pods */ = { 128 | isa = PBXGroup; 129 | children = ( 130 | 1DFCA02F9B84CF6D04124AAD /* Pods-FontDiskLoaderExample.debug.xcconfig */, 131 | 73E74C55B0E8B83357E8EDFD /* Pods-FontDiskLoaderExample.release.xcconfig */, 132 | F32FDFBA180521C3CF926509 /* Pods-FontDiskLoaderExample-FontDiskLoaderExampleTests.debug.xcconfig */, 133 | 8EB3B1E70CED076EAE587D88 /* Pods-FontDiskLoaderExample-FontDiskLoaderExampleTests.release.xcconfig */, 134 | ); 135 | name = Pods; 136 | sourceTree = ""; 137 | }; 138 | DE3088D2878E0352021F594C /* Frameworks */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | E9309652CB2B534DF5441F33 /* Pods_FontDiskLoaderExample.framework */, 142 | 67F6DC37B3A8C5FA7F341D05 /* Pods_FontDiskLoaderExample_FontDiskLoaderExampleTests.framework */, 143 | ); 144 | name = Frameworks; 145 | sourceTree = ""; 146 | }; 147 | /* End PBXGroup section */ 148 | 149 | /* Begin PBXNativeTarget section */ 150 | 2011CBF51DEDF9720047F8B5 /* FontDiskLoaderExample */ = { 151 | isa = PBXNativeTarget; 152 | buildConfigurationList = 2011CC181DEDF9720047F8B5 /* Build configuration list for PBXNativeTarget "FontDiskLoaderExample" */; 153 | buildPhases = ( 154 | 609D56B9F5C9C43BAA71000D /* [CP] Check Pods Manifest.lock */, 155 | 2011CBF21DEDF9720047F8B5 /* Sources */, 156 | 2011CBF31DEDF9720047F8B5 /* Frameworks */, 157 | 2011CBF41DEDF9720047F8B5 /* Resources */, 158 | 4AFD03B38B0A2232B298C81F /* [CP] Embed Pods Frameworks */, 159 | EFAB62067C68872FA7AD2BA6 /* [CP] Copy Pods Resources */, 160 | ); 161 | buildRules = ( 162 | ); 163 | dependencies = ( 164 | ); 165 | name = FontDiskLoaderExample; 166 | productName = FontDiskLoaderExample; 167 | productReference = 2011CBF61DEDF9720047F8B5 /* FontDiskLoaderExample.app */; 168 | productType = "com.apple.product-type.application"; 169 | }; 170 | 2011CC0E1DEDF9720047F8B5 /* FontDiskLoaderExampleTests */ = { 171 | isa = PBXNativeTarget; 172 | buildConfigurationList = 2011CC1B1DEDF9720047F8B5 /* Build configuration list for PBXNativeTarget "FontDiskLoaderExampleTests" */; 173 | buildPhases = ( 174 | B870E463D9CAD4F4A2A85F05 /* [CP] Check Pods Manifest.lock */, 175 | 2011CC0B1DEDF9720047F8B5 /* Sources */, 176 | 2011CC0C1DEDF9720047F8B5 /* Frameworks */, 177 | 2011CC0D1DEDF9720047F8B5 /* Resources */, 178 | F06C165F57865485F813B9D0 /* [CP] Embed Pods Frameworks */, 179 | 8D6EFEE7498F18AA62BC18C9 /* [CP] Copy Pods Resources */, 180 | ); 181 | buildRules = ( 182 | ); 183 | dependencies = ( 184 | 2011CC111DEDF9720047F8B5 /* PBXTargetDependency */, 185 | ); 186 | name = FontDiskLoaderExampleTests; 187 | productName = FontDiskLoaderExampleTests; 188 | productReference = 2011CC0F1DEDF9720047F8B5 /* FontDiskLoaderExampleTests.xctest */; 189 | productType = "com.apple.product-type.bundle.unit-test"; 190 | }; 191 | /* End PBXNativeTarget section */ 192 | 193 | /* Begin PBXProject section */ 194 | 2011CBEE1DEDF9720047F8B5 /* Project object */ = { 195 | isa = PBXProject; 196 | attributes = { 197 | LastUpgradeCheck = 0800; 198 | ORGANIZATIONNAME = "Randall Li"; 199 | TargetAttributes = { 200 | 2011CBF51DEDF9720047F8B5 = { 201 | CreatedOnToolsVersion = 8.0; 202 | ProvisioningStyle = Automatic; 203 | }; 204 | 2011CC0E1DEDF9720047F8B5 = { 205 | CreatedOnToolsVersion = 8.0; 206 | ProvisioningStyle = Automatic; 207 | TestTargetID = 2011CBF51DEDF9720047F8B5; 208 | }; 209 | }; 210 | }; 211 | buildConfigurationList = 2011CBF11DEDF9720047F8B5 /* Build configuration list for PBXProject "FontDiskLoaderExample" */; 212 | compatibilityVersion = "Xcode 3.2"; 213 | developmentRegion = English; 214 | hasScannedForEncodings = 0; 215 | knownRegions = ( 216 | en, 217 | Base, 218 | ); 219 | mainGroup = 2011CBED1DEDF9720047F8B5; 220 | productRefGroup = 2011CBF71DEDF9720047F8B5 /* Products */; 221 | projectDirPath = ""; 222 | projectRoot = ""; 223 | targets = ( 224 | 2011CBF51DEDF9720047F8B5 /* FontDiskLoaderExample */, 225 | 2011CC0E1DEDF9720047F8B5 /* FontDiskLoaderExampleTests */, 226 | ); 227 | }; 228 | /* End PBXProject section */ 229 | 230 | /* Begin PBXResourcesBuildPhase section */ 231 | 2011CBF41DEDF9720047F8B5 /* Resources */ = { 232 | isa = PBXResourcesBuildPhase; 233 | buildActionMask = 2147483647; 234 | files = ( 235 | 2011CC091DEDF9720047F8B5 /* LaunchScreen.storyboard in Resources */, 236 | 2011CC061DEDF9720047F8B5 /* Assets.xcassets in Resources */, 237 | 2011CC041DEDF9720047F8B5 /* Main.storyboard in Resources */, 238 | 20BB4D2C1DEDFB4B00838A41 /* CustomFont.bundle in Resources */, 239 | ); 240 | runOnlyForDeploymentPostprocessing = 0; 241 | }; 242 | 2011CC0D1DEDF9720047F8B5 /* Resources */ = { 243 | isa = PBXResourcesBuildPhase; 244 | buildActionMask = 2147483647; 245 | files = ( 246 | ); 247 | runOnlyForDeploymentPostprocessing = 0; 248 | }; 249 | /* End PBXResourcesBuildPhase section */ 250 | 251 | /* Begin PBXShellScriptBuildPhase section */ 252 | 4AFD03B38B0A2232B298C81F /* [CP] Embed Pods Frameworks */ = { 253 | isa = PBXShellScriptBuildPhase; 254 | buildActionMask = 2147483647; 255 | files = ( 256 | ); 257 | inputPaths = ( 258 | ); 259 | name = "[CP] Embed Pods Frameworks"; 260 | outputPaths = ( 261 | ); 262 | runOnlyForDeploymentPostprocessing = 0; 263 | shellPath = /bin/sh; 264 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FontDiskLoaderExample/Pods-FontDiskLoaderExample-frameworks.sh\"\n"; 265 | showEnvVarsInLog = 0; 266 | }; 267 | 609D56B9F5C9C43BAA71000D /* [CP] Check Pods Manifest.lock */ = { 268 | isa = PBXShellScriptBuildPhase; 269 | buildActionMask = 2147483647; 270 | files = ( 271 | ); 272 | inputPaths = ( 273 | ); 274 | name = "[CP] Check Pods Manifest.lock"; 275 | outputPaths = ( 276 | ); 277 | runOnlyForDeploymentPostprocessing = 0; 278 | shellPath = /bin/sh; 279 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 280 | showEnvVarsInLog = 0; 281 | }; 282 | 8D6EFEE7498F18AA62BC18C9 /* [CP] Copy Pods Resources */ = { 283 | isa = PBXShellScriptBuildPhase; 284 | buildActionMask = 2147483647; 285 | files = ( 286 | ); 287 | inputPaths = ( 288 | ); 289 | name = "[CP] Copy Pods Resources"; 290 | outputPaths = ( 291 | ); 292 | runOnlyForDeploymentPostprocessing = 0; 293 | shellPath = /bin/sh; 294 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FontDiskLoaderExample-FontDiskLoaderExampleTests/Pods-FontDiskLoaderExample-FontDiskLoaderExampleTests-resources.sh\"\n"; 295 | showEnvVarsInLog = 0; 296 | }; 297 | B870E463D9CAD4F4A2A85F05 /* [CP] Check Pods Manifest.lock */ = { 298 | isa = PBXShellScriptBuildPhase; 299 | buildActionMask = 2147483647; 300 | files = ( 301 | ); 302 | inputPaths = ( 303 | ); 304 | name = "[CP] Check Pods Manifest.lock"; 305 | outputPaths = ( 306 | ); 307 | runOnlyForDeploymentPostprocessing = 0; 308 | shellPath = /bin/sh; 309 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 310 | showEnvVarsInLog = 0; 311 | }; 312 | EFAB62067C68872FA7AD2BA6 /* [CP] Copy Pods Resources */ = { 313 | isa = PBXShellScriptBuildPhase; 314 | buildActionMask = 2147483647; 315 | files = ( 316 | ); 317 | inputPaths = ( 318 | ); 319 | name = "[CP] Copy Pods Resources"; 320 | outputPaths = ( 321 | ); 322 | runOnlyForDeploymentPostprocessing = 0; 323 | shellPath = /bin/sh; 324 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FontDiskLoaderExample/Pods-FontDiskLoaderExample-resources.sh\"\n"; 325 | showEnvVarsInLog = 0; 326 | }; 327 | F06C165F57865485F813B9D0 /* [CP] Embed Pods Frameworks */ = { 328 | isa = PBXShellScriptBuildPhase; 329 | buildActionMask = 2147483647; 330 | files = ( 331 | ); 332 | inputPaths = ( 333 | ); 334 | name = "[CP] Embed Pods Frameworks"; 335 | outputPaths = ( 336 | ); 337 | runOnlyForDeploymentPostprocessing = 0; 338 | shellPath = /bin/sh; 339 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FontDiskLoaderExample-FontDiskLoaderExampleTests/Pods-FontDiskLoaderExample-FontDiskLoaderExampleTests-frameworks.sh\"\n"; 340 | showEnvVarsInLog = 0; 341 | }; 342 | /* End PBXShellScriptBuildPhase section */ 343 | 344 | /* Begin PBXSourcesBuildPhase section */ 345 | 2011CBF21DEDF9720047F8B5 /* Sources */ = { 346 | isa = PBXSourcesBuildPhase; 347 | buildActionMask = 2147483647; 348 | files = ( 349 | 20BB4D2A1DEDFA4A00838A41 /* FontDiskLoaderSimipleExample.m in Sources */, 350 | 2011CBFE1DEDF9720047F8B5 /* AppDelegate.m in Sources */, 351 | 2011CBFB1DEDF9720047F8B5 /* main.m in Sources */, 352 | ); 353 | runOnlyForDeploymentPostprocessing = 0; 354 | }; 355 | 2011CC0B1DEDF9720047F8B5 /* Sources */ = { 356 | isa = PBXSourcesBuildPhase; 357 | buildActionMask = 2147483647; 358 | files = ( 359 | 20BB4D2F1DEDFE1700838A41 /* FontDiskLoaderTests.m in Sources */, 360 | ); 361 | runOnlyForDeploymentPostprocessing = 0; 362 | }; 363 | /* End PBXSourcesBuildPhase section */ 364 | 365 | /* Begin PBXTargetDependency section */ 366 | 2011CC111DEDF9720047F8B5 /* PBXTargetDependency */ = { 367 | isa = PBXTargetDependency; 368 | target = 2011CBF51DEDF9720047F8B5 /* FontDiskLoaderExample */; 369 | targetProxy = 2011CC101DEDF9720047F8B5 /* PBXContainerItemProxy */; 370 | }; 371 | /* End PBXTargetDependency section */ 372 | 373 | /* Begin PBXVariantGroup section */ 374 | 2011CC021DEDF9720047F8B5 /* Main.storyboard */ = { 375 | isa = PBXVariantGroup; 376 | children = ( 377 | 2011CC031DEDF9720047F8B5 /* Base */, 378 | ); 379 | name = Main.storyboard; 380 | sourceTree = ""; 381 | }; 382 | 2011CC071DEDF9720047F8B5 /* LaunchScreen.storyboard */ = { 383 | isa = PBXVariantGroup; 384 | children = ( 385 | 2011CC081DEDF9720047F8B5 /* Base */, 386 | ); 387 | name = LaunchScreen.storyboard; 388 | sourceTree = ""; 389 | }; 390 | /* End PBXVariantGroup section */ 391 | 392 | /* Begin XCBuildConfiguration section */ 393 | 2011CC161DEDF9720047F8B5 /* Debug */ = { 394 | isa = XCBuildConfiguration; 395 | buildSettings = { 396 | ALWAYS_SEARCH_USER_PATHS = NO; 397 | CLANG_ANALYZER_NONNULL = YES; 398 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 399 | CLANG_CXX_LIBRARY = "libc++"; 400 | CLANG_ENABLE_MODULES = YES; 401 | CLANG_ENABLE_OBJC_ARC = YES; 402 | CLANG_WARN_BOOL_CONVERSION = YES; 403 | CLANG_WARN_CONSTANT_CONVERSION = YES; 404 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 405 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 406 | CLANG_WARN_EMPTY_BODY = YES; 407 | CLANG_WARN_ENUM_CONVERSION = YES; 408 | CLANG_WARN_INFINITE_RECURSION = YES; 409 | CLANG_WARN_INT_CONVERSION = YES; 410 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 411 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 412 | CLANG_WARN_UNREACHABLE_CODE = YES; 413 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 414 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 415 | COPY_PHASE_STRIP = NO; 416 | DEBUG_INFORMATION_FORMAT = dwarf; 417 | ENABLE_STRICT_OBJC_MSGSEND = YES; 418 | ENABLE_TESTABILITY = YES; 419 | GCC_C_LANGUAGE_STANDARD = gnu99; 420 | GCC_DYNAMIC_NO_PIC = NO; 421 | GCC_NO_COMMON_BLOCKS = YES; 422 | GCC_OPTIMIZATION_LEVEL = 0; 423 | GCC_PREPROCESSOR_DEFINITIONS = ( 424 | "DEBUG=1", 425 | "$(inherited)", 426 | ); 427 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 428 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 429 | GCC_WARN_UNDECLARED_SELECTOR = YES; 430 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 431 | GCC_WARN_UNUSED_FUNCTION = YES; 432 | GCC_WARN_UNUSED_VARIABLE = YES; 433 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 434 | MTL_ENABLE_DEBUG_INFO = YES; 435 | ONLY_ACTIVE_ARCH = YES; 436 | SDKROOT = iphoneos; 437 | TARGETED_DEVICE_FAMILY = "1,2"; 438 | }; 439 | name = Debug; 440 | }; 441 | 2011CC171DEDF9720047F8B5 /* Release */ = { 442 | isa = XCBuildConfiguration; 443 | buildSettings = { 444 | ALWAYS_SEARCH_USER_PATHS = NO; 445 | CLANG_ANALYZER_NONNULL = YES; 446 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 447 | CLANG_CXX_LIBRARY = "libc++"; 448 | CLANG_ENABLE_MODULES = YES; 449 | CLANG_ENABLE_OBJC_ARC = YES; 450 | CLANG_WARN_BOOL_CONVERSION = YES; 451 | CLANG_WARN_CONSTANT_CONVERSION = YES; 452 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 453 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 454 | CLANG_WARN_EMPTY_BODY = YES; 455 | CLANG_WARN_ENUM_CONVERSION = YES; 456 | CLANG_WARN_INFINITE_RECURSION = YES; 457 | CLANG_WARN_INT_CONVERSION = YES; 458 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 459 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 460 | CLANG_WARN_UNREACHABLE_CODE = YES; 461 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 462 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 463 | COPY_PHASE_STRIP = NO; 464 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 465 | ENABLE_NS_ASSERTIONS = NO; 466 | ENABLE_STRICT_OBJC_MSGSEND = YES; 467 | GCC_C_LANGUAGE_STANDARD = gnu99; 468 | GCC_NO_COMMON_BLOCKS = YES; 469 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 470 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 471 | GCC_WARN_UNDECLARED_SELECTOR = YES; 472 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 473 | GCC_WARN_UNUSED_FUNCTION = YES; 474 | GCC_WARN_UNUSED_VARIABLE = YES; 475 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 476 | MTL_ENABLE_DEBUG_INFO = NO; 477 | SDKROOT = iphoneos; 478 | TARGETED_DEVICE_FAMILY = "1,2"; 479 | VALIDATE_PRODUCT = YES; 480 | }; 481 | name = Release; 482 | }; 483 | 2011CC191DEDF9720047F8B5 /* Debug */ = { 484 | isa = XCBuildConfiguration; 485 | baseConfigurationReference = 1DFCA02F9B84CF6D04124AAD /* Pods-FontDiskLoaderExample.debug.xcconfig */; 486 | buildSettings = { 487 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 488 | INFOPLIST_FILE = FontDiskLoaderExample/Info.plist; 489 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 490 | PRODUCT_BUNDLE_IDENTIFIER = com.google.FontDiskLoaderExample; 491 | PRODUCT_NAME = "$(TARGET_NAME)"; 492 | }; 493 | name = Debug; 494 | }; 495 | 2011CC1A1DEDF9720047F8B5 /* Release */ = { 496 | isa = XCBuildConfiguration; 497 | baseConfigurationReference = 73E74C55B0E8B83357E8EDFD /* Pods-FontDiskLoaderExample.release.xcconfig */; 498 | buildSettings = { 499 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 500 | INFOPLIST_FILE = FontDiskLoaderExample/Info.plist; 501 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 502 | PRODUCT_BUNDLE_IDENTIFIER = com.google.FontDiskLoaderExample; 503 | PRODUCT_NAME = "$(TARGET_NAME)"; 504 | }; 505 | name = Release; 506 | }; 507 | 2011CC1C1DEDF9720047F8B5 /* Debug */ = { 508 | isa = XCBuildConfiguration; 509 | baseConfigurationReference = F32FDFBA180521C3CF926509 /* Pods-FontDiskLoaderExample-FontDiskLoaderExampleTests.debug.xcconfig */; 510 | buildSettings = { 511 | BUNDLE_LOADER = "$(TEST_HOST)"; 512 | INFOPLIST_FILE = FontDiskLoaderExampleTests/Info.plist; 513 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 514 | PRODUCT_BUNDLE_IDENTIFIER = com.google.FontDiskLoaderExampleTests; 515 | PRODUCT_NAME = "$(TARGET_NAME)"; 516 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FontDiskLoaderExample.app/FontDiskLoaderExample"; 517 | }; 518 | name = Debug; 519 | }; 520 | 2011CC1D1DEDF9720047F8B5 /* Release */ = { 521 | isa = XCBuildConfiguration; 522 | baseConfigurationReference = 8EB3B1E70CED076EAE587D88 /* Pods-FontDiskLoaderExample-FontDiskLoaderExampleTests.release.xcconfig */; 523 | buildSettings = { 524 | BUNDLE_LOADER = "$(TEST_HOST)"; 525 | INFOPLIST_FILE = FontDiskLoaderExampleTests/Info.plist; 526 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 527 | PRODUCT_BUNDLE_IDENTIFIER = com.google.FontDiskLoaderExampleTests; 528 | PRODUCT_NAME = "$(TARGET_NAME)"; 529 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FontDiskLoaderExample.app/FontDiskLoaderExample"; 530 | }; 531 | name = Release; 532 | }; 533 | /* End XCBuildConfiguration section */ 534 | 535 | /* Begin XCConfigurationList section */ 536 | 2011CBF11DEDF9720047F8B5 /* Build configuration list for PBXProject "FontDiskLoaderExample" */ = { 537 | isa = XCConfigurationList; 538 | buildConfigurations = ( 539 | 2011CC161DEDF9720047F8B5 /* Debug */, 540 | 2011CC171DEDF9720047F8B5 /* Release */, 541 | ); 542 | defaultConfigurationIsVisible = 0; 543 | defaultConfigurationName = Release; 544 | }; 545 | 2011CC181DEDF9720047F8B5 /* Build configuration list for PBXNativeTarget "FontDiskLoaderExample" */ = { 546 | isa = XCConfigurationList; 547 | buildConfigurations = ( 548 | 2011CC191DEDF9720047F8B5 /* Debug */, 549 | 2011CC1A1DEDF9720047F8B5 /* Release */, 550 | ); 551 | defaultConfigurationIsVisible = 0; 552 | defaultConfigurationName = Release; 553 | }; 554 | 2011CC1B1DEDF9720047F8B5 /* Build configuration list for PBXNativeTarget "FontDiskLoaderExampleTests" */ = { 555 | isa = XCConfigurationList; 556 | buildConfigurations = ( 557 | 2011CC1C1DEDF9720047F8B5 /* Debug */, 558 | 2011CC1D1DEDF9720047F8B5 /* Release */, 559 | ); 560 | defaultConfigurationIsVisible = 0; 561 | defaultConfigurationName = Release; 562 | }; 563 | /* End XCConfigurationList section */ 564 | }; 565 | rootObject = 2011CBEE1DEDF9720047F8B5 /* Project object */; 566 | } 567 | -------------------------------------------------------------------------------- /examples/apps/FontDiskLoaderExample/FontDiskLoaderExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015-present Google Inc.. All Rights Reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | 18 | #import 19 | 20 | @interface AppDelegate : UIResponder 21 | 22 | @property (strong, nonatomic) UIWindow *window; 23 | 24 | 25 | @end 26 | 27 | -------------------------------------------------------------------------------- /examples/apps/FontDiskLoaderExample/FontDiskLoaderExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015-present Google Inc.. All Rights Reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "AppDelegate.h" 18 | 19 | @interface AppDelegate () 20 | 21 | @end 22 | 23 | @implementation AppDelegate 24 | 25 | 26 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 27 | // Override point for customization after application launch. 28 | return YES; 29 | } 30 | 31 | 32 | - (void)applicationWillResignActive:(UIApplication *)application { 33 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 34 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 35 | } 36 | 37 | 38 | - (void)applicationDidEnterBackground:(UIApplication *)application { 39 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 40 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 41 | } 42 | 43 | 44 | - (void)applicationWillEnterForeground:(UIApplication *)application { 45 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 46 | } 47 | 48 | 49 | - (void)applicationDidBecomeActive:(UIApplication *)application { 50 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 51 | } 52 | 53 | 54 | - (void)applicationWillTerminate:(UIApplication *)application { 55 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 56 | } 57 | 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /examples/apps/FontDiskLoaderExample/FontDiskLoaderExample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /examples/apps/FontDiskLoaderExample/FontDiskLoaderExample/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /examples/apps/FontDiskLoaderExample/FontDiskLoaderExample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /examples/apps/FontDiskLoaderExample/FontDiskLoaderExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /examples/apps/FontDiskLoaderExample/FontDiskLoaderExample/main.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015-present Google Inc.. All Rights Reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | #import "AppDelegate.h" 19 | 20 | int main(int argc, char * argv[]) { 21 | @autoreleasepool { 22 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /examples/apps/FontDiskLoaderExample/FontDiskLoaderExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /examples/apps/FontDiskLoaderExample/Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | 3 | target "FontDiskLoaderExample" do 4 | pod 'MDFFontDiskLoader', :path => '../../../' 5 | target 'FontDiskLoaderExampleTests' do 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /examples/apps/FontDiskLoaderExample/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - MDFFontDiskLoader (1.0.0) 3 | 4 | DEPENDENCIES: 5 | - MDFFontDiskLoader (from `../../../`) 6 | 7 | EXTERNAL SOURCES: 8 | MDFFontDiskLoader: 9 | :path: "../../../" 10 | 11 | SPEC CHECKSUMS: 12 | MDFFontDiskLoader: b5c610d2d8112f28e9fbfbf4b172800a7c58ea69 13 | 14 | PODFILE CHECKSUM: d151bb618a72a3f57d567b24969f1f0b18ad5864 15 | 16 | COCOAPODS: 1.0.1 17 | -------------------------------------------------------------------------------- /examples/supplemental/CustomFont.bundle/BlackPixel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/material-foundation/material-font-disk-loader-ios/8e30188777b016182658fbaa0a4a020a48183224/examples/supplemental/CustomFont.bundle/BlackPixel.png -------------------------------------------------------------------------------- /examples/supplemental/CustomFont.bundle/Roboto-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/material-foundation/material-font-disk-loader-ios/8e30188777b016182658fbaa0a4a020a48183224/examples/supplemental/CustomFont.bundle/Roboto-Regular.ttf -------------------------------------------------------------------------------- /src/MDFFontDiskLoader.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015-present Google Inc.. All Rights Reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | /** 20 | This class loads and registers a custom font by file url. 21 | 22 | This class provides a convenience layer on top of CoreText APIs. Registration occurs by @c fileURL, 23 | therefore registration state is shared across all instances of MDFFontDiskLoader objects. For 24 | example if two MDFFontDiskLoader objects have the same fileURL, calling @c load one will also 25 | alter the state of the second MDFFontDiskLoader object. The same holds true for @c unload. 26 | This class is thread safe and can be called from any thread. 27 | */ 28 | @interface MDFFontDiskLoader : NSObject 29 | 30 | /** 31 | Designated initializer for the MDFFontDiskLoader. 32 | 33 | @param fontName The font's name as it is defined in the resource file. 34 | @param fontURL The url location of the font on the file system. 35 | */ 36 | - (nonnull instancetype)initWithFontName:(nonnull NSString *)fontName 37 | fontURL:(nonnull NSURL *)fontURL NS_DESIGNATED_INITIALIZER; 38 | 39 | /** 40 | Convenience initializer for the MDFFontDiskLoader. 41 | 42 | @param fontName The font's name as it is defined in the ttf file. 43 | @param filename The name of the font file. For example a *.ttf file. 44 | @param bundleFilename The name of the bundle. 45 | @param baseBundle The bundle to look in. 46 | */ 47 | - (nonnull instancetype)initWithFontName:(nonnull NSString *)fontName 48 | filename:(nonnull NSString *)filename 49 | bundleFileName:(nonnull NSString *)bundleFilename 50 | baseBundle:(nonnull NSBundle *)baseBundle; 51 | 52 | /** 53 | This class requires a fontURL and fontName therefore init is no longer allowed. 54 | Please use initWithFontName:fontURL: 55 | */ 56 | - (nonnull instancetype)init NS_UNAVAILABLE; 57 | 58 | /** The name of the font within the font resource file. */ 59 | @property(nonatomic, readonly, copy, nonnull) NSString *fontName; 60 | 61 | /** The URL of the font asset. */ 62 | @property(nonatomic, readonly, copy, nonnull) NSURL *fontURL; 63 | 64 | /** 65 | The loaded state of the custom font. 66 | 67 | All instances of MDFFontDiskLoader with the same fontURL have the same value of @c loaded. 68 | */ 69 | @property(nonatomic, readonly, getter=isLoaded) BOOL loaded; 70 | 71 | /** 72 | This flag is true when the registration failed. 73 | 74 | It prevents future attempts at registration. To reset call @c unload. 75 | */ 76 | @property(nonatomic, readonly, getter=hasLoadFailed) BOOL loadFailed; 77 | 78 | /** 79 | Attempts to load the font. 80 | 81 | All instances of MDFFontDiskLoader with the same fontURL will reflect changes from this method. 82 | 83 | The @c loaded and @c loadFailed flags reflect the results of this registration 84 | attempt. Returns true if the font is loaded. If font registration fails, subsequent calls to 85 | load will fail unless unload is called first. 86 | */ 87 | - (BOOL)load; 88 | 89 | /** 90 | Attempts to unload the font. 91 | 92 | All instances of MDFFontDiskLoader with the same fontURL will reflect changes from this method. 93 | 94 | Returns true when the font is unloaded. Resets @c loadFailed back to false. 95 | */ 96 | - (BOOL)unload; 97 | 98 | /** A convience method for getting a font. */ 99 | - (nullable UIFont *)fontOfSize:(CGFloat)fontSize; 100 | 101 | @end 102 | -------------------------------------------------------------------------------- /src/MDFFontDiskLoader.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015-present Google Inc.. All Rights Reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MDFFontDiskLoader.h" 18 | 19 | #import 20 | 21 | @interface MDFFontDiskLoader () 22 | @property(nonatomic) BOOL disableSanityChecks; // For tests to turn off asserts 23 | @end 24 | 25 | // Use |isFontURLLoaded:| and |setFontURL:loaded:| for access to loaded fonts. 26 | static NSMutableSet *gLoadedFonts; 27 | // The queue that ensures |gLoadedFonts| is accessed in a thread safe manner. 28 | static dispatch_queue_t gLoadedFontsQueue; 29 | 30 | /* 31 | This class caches the registered state of fileURL because it is much faster than calling the 32 | CoreText api. 33 | 34 | Benchmark testing results for a iPod touch Model A1421 running 9.2.1 (13D11) on 7/21/2016: 35 | ============================== 36 | first load runtime: 6.729903 ms 37 | iterations: 1000 38 | 39 | single instance of FontDiskLoader 40 | unoptimizedLoad Avg. Runtime: 1.312834 ms 41 | load Avg. Runtime: 0.006540 ms 42 | ratio first/unoptimized: 5.126241 43 | ratio first/optimized: 1029.037109 44 | ratio unoptimized/optimized: 200.739151 45 | 46 | new instances of FontDiskLoader 47 | unoptimizedLoad Avg. Runtime: 1.384893 ms 48 | load Avg. Runtime: 0.096831 ms 49 | ratio first/unoptimized: 4.859511 50 | ratio first/optimized: 69.501534 51 | ratio unoptimized/optimized: 14.302166 52 | ============================== 53 | 54 | The unoptimizedLoad was calling just the CoreText API. As you can see the unoptimizedLoad was on 55 | average 1.3 ms. This is unacceptable in situations in which you may want to display more than 20 56 | different labels as is the case for a scrolling collection view because it would cause frame drops. 57 | */ 58 | @implementation MDFFontDiskLoader 59 | 60 | @synthesize loadFailed = _loadFailed; 61 | 62 | + (void)initialize { 63 | static dispatch_once_t once; 64 | dispatch_once(&once, ^{ 65 | gLoadedFonts = [[NSMutableSet alloc] init]; 66 | gLoadedFontsQueue = 67 | dispatch_queue_create("com.google.MDF.FontDiskLoaderQueue", DISPATCH_QUEUE_SERIAL); 68 | }); 69 | } 70 | 71 | // A font's loaded state is shared accross all fontloaders that share the same URL. This class 72 | // method ensures that the collection of URLs that are loaded are set in a thread safe manner. 73 | // By using a serial queue we ensure that reads and writes do not occur at the same time. 74 | + (void)setFontURL:(NSURL *)fontURL loaded:(BOOL)loaded { 75 | if (!fontURL) { 76 | return; 77 | } 78 | dispatch_async(gLoadedFontsQueue, ^{ 79 | // Defensive bool cast because https://www.bignerdranch.com/blog/bools-sharp-corners 80 | if ((bool)loaded == (bool)[gLoadedFonts containsObject:fontURL]) { 81 | return; // Already in the correct state; 82 | } 83 | if (loaded) { 84 | [gLoadedFonts addObject:fontURL]; 85 | } else { 86 | [gLoadedFonts removeObject:fontURL]; 87 | } 88 | }); 89 | } 90 | 91 | // A font's loaded state is shared accross all fontloaders that share the same URL. This class 92 | // method ensures that the collection of URLs that are loaded are gotten in a thread safe manner. 93 | // By using a serial queue we ensure that reads and writes do not occur at the same time. 94 | + (BOOL)isFontURLLoaded:(NSURL *)fontURL { 95 | if (!fontURL) { 96 | return NO; 97 | } 98 | __block BOOL isLoaded = NO; 99 | dispatch_sync(gLoadedFontsQueue, ^{ 100 | isLoaded = [gLoadedFonts containsObject:fontURL]; 101 | }); 102 | return isLoaded; 103 | } 104 | 105 | - (instancetype)initWithFontName:(NSString *)fontName fontURL:(NSURL *)fontURL { 106 | self = [super init]; 107 | if (self) { 108 | _fontName = [fontName copy]; 109 | _fontURL = [fontURL copy]; 110 | } 111 | return self; 112 | } 113 | 114 | - (instancetype)initWithFontName:(NSString *)fontName 115 | filename:(NSString *)filename 116 | bundleFileName:(NSString *)bundleFilename 117 | baseBundle:(NSBundle *)baseBundle { 118 | NSURL *fontURL = 119 | [baseBundle URLForResource:filename withExtension:nil subdirectory:bundleFilename]; 120 | if (!fontURL) { 121 | NSLog(@"Failed to locate: %@ in bundle: %@ %@.", filename, baseBundle, bundleFilename); 122 | return nil; 123 | } 124 | return [self initWithFontName:fontName fontURL:fontURL]; 125 | } 126 | 127 | #pragma mark - NSObject overridden methods 128 | 129 | - (NSString *)description { 130 | NSMutableString *description = [super.description mutableCopy]; 131 | [description appendFormat:@" font name: %@;", _fontName]; 132 | if (self.loaded) { 133 | [description appendString:@" loaded = YES;"]; 134 | } else if (_loadFailed) { 135 | [description appendString:@" failed registration = YES;"]; 136 | } 137 | [description appendFormat:@" font url: %@;", _fontURL]; 138 | return [description copy]; 139 | } 140 | 141 | - (BOOL)isEqual:(id)object { 142 | if (!object || ![object isKindOfClass:[self class]]) { 143 | return NO; 144 | } 145 | MDFFontDiskLoader *otherObject = (MDFFontDiskLoader *)object; 146 | BOOL fontNamesAreEqual = [otherObject.fontName isEqualToString:_fontName]; 147 | return fontNamesAreEqual && [otherObject.fontURL isEqual:_fontURL]; 148 | } 149 | 150 | - (NSUInteger)hash { 151 | return _fontName.hash ^ _fontURL.hash; 152 | } 153 | 154 | - (id)copyWithZone:(NSZone *)zone { 155 | return self; 156 | } 157 | 158 | #pragma mark - Public methods 159 | 160 | - (BOOL)load { 161 | @synchronized(self) { 162 | BOOL loaded = [MDFFontDiskLoader isFontURLLoaded:_fontURL]; 163 | if (loaded) { 164 | return YES; 165 | } 166 | if (_loadFailed) { 167 | return NO; 168 | } 169 | CFErrorRef error = NULL; 170 | loaded = CTFontManagerRegisterFontsForURL((__bridge CFURLRef)_fontURL, 171 | kCTFontManagerScopeProcess, &error); 172 | if (!loaded) { 173 | if (error && CFErrorGetCode(error) == kCTFontManagerErrorAlreadyRegistered) { 174 | // If it's already been loaded by somebody else, we don't care. 175 | // We do not check the error domain to make sure they match because 176 | // kCTFontManagerErrorDomain is not defined in the iOS 8 SDK. 177 | // Radar 18651170 iOS 8 SDK missing definition for kCTFontManagerErrorDomain 178 | loaded = YES; 179 | } else { 180 | NSLog(@"Failed to load font: %@", error); 181 | _loadFailed = YES; 182 | } 183 | } 184 | if (error) { 185 | CFRelease(error); 186 | } 187 | [MDFFontDiskLoader setFontURL:_fontURL loaded:loaded]; 188 | return loaded; 189 | } 190 | } 191 | 192 | - (BOOL)unload { 193 | @synchronized(self) { 194 | BOOL loaded = [MDFFontDiskLoader isFontURLLoaded:_fontURL]; 195 | _loadFailed = NO; 196 | if (!loaded) { 197 | return YES; 198 | } 199 | CFErrorRef error = NULL; 200 | loaded = !CTFontManagerUnregisterFontsForURL((__bridge CFURLRef)_fontURL, 201 | kCTFontManagerScopeProcess, &error); 202 | 203 | if (loaded || error) { 204 | NSLog(@"Failed to unload font: %@", error); 205 | } 206 | [MDFFontDiskLoader setFontURL:_fontURL loaded:loaded]; 207 | return !loaded; 208 | } 209 | } 210 | 211 | - (UIFont *)fontOfSize:(CGFloat)fontSize { 212 | [self load]; 213 | UIFont *font = [UIFont fontWithName:_fontName size:fontSize]; 214 | NSAssert(_disableSanityChecks || font, @"Failed to find font: %@ in file at %@", _fontName, 215 | _fontURL); 216 | return font; 217 | } 218 | 219 | - (BOOL)isLoaded { 220 | return [MDFFontDiskLoader isFontURLLoaded:_fontURL]; 221 | } 222 | 223 | - (BOOL)hasLoadFailed { 224 | @synchronized(self) { 225 | return _loadFailed; 226 | } 227 | } 228 | 229 | @end 230 | -------------------------------------------------------------------------------- /src/MaterialFontDiskLoader.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015-present Google Inc.. All Rights Reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #if !defined(__IPHONE_4_1) || (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_4_1) 20 | #error "This component only supports iOS 4.1 and above." 21 | #endif 22 | 23 | /** 24 | The FontDiskLoader component loads and registers a custom font by file url. 25 | 26 | This header is the umbrella header for the component and should be imported by consumers of the 27 | FontDiskLoader component. Please do not directly import other headers. This will allow the componet 28 | to expand or contract the header file space without consumer modifications. 29 | */ 30 | 31 | #import "MDFFontDiskLoader.h" 32 | -------------------------------------------------------------------------------- /tests/unit/FontDiskLoaderTests.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015-present Google Inc.. All Rights Reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MaterialFontDiskLoader.h" 20 | 21 | static const CGFloat kEpsilonAccuracy = 0.001f; 22 | 23 | // We use the bundle from MDFRobotoFontLoader to test loading functionality 24 | static NSString *MDFRobotoFontLoaderClassname = @"FontDiskLoaderSimpleExample"; 25 | static NSString *MDFRobotoRegularFontName = @"Roboto-Regular"; 26 | static NSString *MDFRobotoRegularFontFilename = @"Roboto-Regular.ttf"; 27 | static NSString *MDFRobotoBundle = @"CustomFont.bundle"; 28 | static NSString *kBlackPixel = @"BlackPixel.png"; 29 | 30 | /** 31 | For our tests we are following a Given When Then structure as defined in 32 | http://martinfowler.com/bliki/GivenWhenThen.html 33 | 34 | The essential idea is to break down writing a scenario (or test) into three sections: 35 | 36 | The |given| part describes the state of the world before you begin the behavior you're specifying 37 | in this scenario. You can think of it as the pre-conditions to the test. 38 | The |when| section is that behavior that you're specifying. 39 | Finally the |then| section describes the changes you expect due to the specified behavior. 40 | 41 | For us this just means that we have the Given When Then guide posts as comments for each unit test. 42 | */ 43 | 44 | @interface MDFFontDiskLoader (Testing) 45 | @property(nonatomic, assign) BOOL disableSanityChecks; 46 | @end 47 | 48 | @interface FontDiskLoaderTests : XCTestCase 49 | @end 50 | 51 | @implementation FontDiskLoaderTests 52 | 53 | - (MDFFontDiskLoader *)validFontLoader { 54 | NSBundle *bundle = [NSBundle bundleForClass:NSClassFromString(MDFRobotoFontLoaderClassname)]; 55 | return [[MDFFontDiskLoader alloc] initWithFontName:MDFRobotoRegularFontName 56 | filename:MDFRobotoRegularFontFilename 57 | bundleFileName:MDFRobotoBundle 58 | baseBundle:bundle]; 59 | } 60 | 61 | - (MDFFontDiskLoader *)invalidFontLoader { 62 | NSBundle *bundle = [NSBundle bundleForClass:NSClassFromString(MDFRobotoFontLoaderClassname)]; 63 | // This attempts to use a png asset instead of a valid font file. 64 | return [[MDFFontDiskLoader alloc] initWithFontName:@"some invalid font name" 65 | filename:kBlackPixel 66 | bundleFileName:MDFRobotoBundle 67 | baseBundle:bundle]; 68 | } 69 | 70 | - (void)testConvenienceInitCreatesAFontURL { 71 | // Given 72 | MDFFontDiskLoader *loader = [self validFontLoader]; 73 | 74 | // Then 75 | XCTAssertNotNil(loader.fontURL, @"The font URL must not be nil when using the convenience init."); 76 | XCTAssertTrue([[loader.fontURL path] containsString:MDFRobotoRegularFontFilename], 77 | @"The font URL's path must contain %@", MDFRobotoRegularFontFilename); 78 | XCTAssertTrue([[loader.fontURL path] containsString:MDFRobotoBundle], 79 | @"The font URL's path must contain %@", MDFRobotoBundle); 80 | } 81 | 82 | - (void)testload { 83 | // Given 84 | MDFFontDiskLoader *loader = [self validFontLoader]; 85 | 86 | // When 87 | [loader load]; 88 | 89 | // Then 90 | XCTAssertTrue(loader.loaded, @"Loading a valid font must mark its state loaded."); 91 | } 92 | 93 | - (void)testUnload { 94 | // Given 95 | MDFFontDiskLoader *loader = [self validFontLoader]; 96 | [loader load]; 97 | XCTAssertTrue(loader.loaded, @"Loading a valid font must mark its state loaded."); 98 | 99 | // When 100 | BOOL success = [loader unload]; 101 | 102 | // Then 103 | XCTAssertFalse(loader.loaded, @"Unloading a loaded font must not mark its state loaded."); 104 | XCTAssertTrue(success, @"Unloading a loaded font must return success."); 105 | } 106 | 107 | - (void)testUnloadFailedRegistration { 108 | // Given 109 | MDFFontDiskLoader *loader = [self invalidFontLoader]; 110 | [loader load]; 111 | 112 | // When 113 | [loader unload]; 114 | 115 | // Then 116 | XCTAssertFalse(loader.loaded, 117 | @"Unloading a previously failed fontloader must not mark it loaded"); 118 | XCTAssertFalse(loader.loadFailed, 119 | @"Unloading a previously failed fontloader must reset its loadFailed."); 120 | } 121 | 122 | - (void)testUnloadNotloaded { 123 | // Given 124 | MDFFontDiskLoader *loader = [self invalidFontLoader]; 125 | 126 | // When 127 | [loader unload]; 128 | 129 | // Then 130 | XCTAssertFalse(loader.loaded, 131 | @"Unloading a fontLoader that was never loaded must not mark it loaded."); 132 | XCTAssertFalse(loader.loadFailed, @"Unloading a fontloader must reset its loadFailed flag."); 133 | } 134 | 135 | - (void)testloadFailure { 136 | // Given 137 | MDFFontDiskLoader *loader = [self invalidFontLoader]; 138 | loader.disableSanityChecks = YES; 139 | 140 | // When 141 | [loader load]; 142 | 143 | // Then 144 | XCTAssertNil([loader fontOfSize:10], 145 | @"Asking for a font with an invalid font url must not return a UIFont."); 146 | XCTAssertTrue(loader.loadFailed, 147 | @"Asking for a font with an invalid font url must set the loadFailed flag to YES"); 148 | } 149 | 150 | - (void)testCopy { 151 | // Given 152 | MDFFontDiskLoader *loader = [self validFontLoader]; 153 | 154 | // When 155 | MDFFontDiskLoader *secondFontLoader = [loader copy]; 156 | 157 | // Then 158 | XCTAssertEqualObjects(secondFontLoader, loader, 159 | @"A copy of a fontloader must equal the original"); 160 | } 161 | 162 | - (void)testloadedOfSecondFontLoader { 163 | // Given 164 | MDFFontDiskLoader *loader = [self validFontLoader]; 165 | MDFFontDiskLoader *secondFontLoader = 166 | [[MDFFontDiskLoader alloc] initWithFontName:loader.fontName fontURL:loader.fontURL]; 167 | 168 | // When 169 | [loader load]; 170 | 171 | // Then 172 | XCTAssertEqual(secondFontLoader.loaded, loader.loaded, @"Loading the fontloader with the same " 173 | @"url and name must also update the " 174 | @"loaded state of both fontloaders."); 175 | } 176 | 177 | - (void)testProvidesACustomFont { 178 | // Given 179 | MDFFontDiskLoader *loader = [self validFontLoader]; 180 | CGFloat randomSize = arc4random() * 100 / CGFLOAT_MAX; 181 | 182 | // When 183 | UIFont *font = [loader fontOfSize:randomSize]; 184 | 185 | // Then 186 | XCTAssertNotNil(font, @"Asking for a font of any size of a valid font url and name must return a" 187 | @"font."); 188 | XCTAssertEqualWithAccuracy(font.pointSize, randomSize, kEpsilonAccuracy, 189 | @"The font size of the font returned from fontOfSize: must match "); 190 | XCTAssertEqualObjects(font.fontName, MDFRobotoRegularFontName); 191 | } 192 | 193 | - (void)testReturnNilWhenTheCustomFontCanNotBeFound { 194 | // Given 195 | MDFFontDiskLoader *validLoader = [self validFontLoader]; 196 | MDFFontDiskLoader *loader = [[MDFFontDiskLoader alloc] initWithFontName:@"some invalid font name" 197 | fontURL:validLoader.fontURL]; 198 | loader.disableSanityChecks = YES; 199 | CGFloat randomSize = arc4random() * 100 / CGFLOAT_MAX; 200 | 201 | // When 202 | UIFont *font = [loader fontOfSize:randomSize]; 203 | 204 | // Then 205 | XCTAssertNil(font, @"Asking for a font must not return a font when the font name is not found."); 206 | } 207 | 208 | - (void)testDescriptionNotloaded { 209 | // Given 210 | MDFFontDiskLoader *loader = [self validFontLoader]; 211 | [loader unload]; 212 | NSString *expected = 213 | [NSString stringWithFormat:@"font name: %@; font url: %@;", loader.fontName, loader.fontURL]; 214 | 215 | // When 216 | NSString *actual = [loader description]; 217 | 218 | // Then 219 | XCTAssertTrue([actual hasSuffix:expected], 220 | @"When not loaded the description of the font loader `%@` must end with: `%@`", 221 | actual, expected); 222 | } 223 | 224 | - (void)testDescriptionloaded { 225 | // Given 226 | MDFFontDiskLoader *loader = [self validFontLoader]; 227 | [loader load]; 228 | NSString *expected = [NSString stringWithFormat:@"font name: %@; loaded = YES; font url: %@;", 229 | loader.fontName, loader.fontURL]; 230 | UIView *view = [UIView new]; 231 | view.userInteractionEnabled = NO; 232 | 233 | // When 234 | NSString *actual = [loader description]; 235 | 236 | // Then 237 | XCTAssertTrue([actual hasSuffix:expected], 238 | @"When loaded the description of the font loader `%@` must end with: %@", actual, 239 | expected); 240 | } 241 | 242 | - (void)testDescriptionFailedRegistration { 243 | // Given 244 | MDFFontDiskLoader *loader = [self invalidFontLoader]; 245 | [loader load]; 246 | NSString *expected = [NSString stringWithFormat:@"font name: %@; failed registration = YES; " 247 | @"font url: %@;", 248 | loader.fontName, loader.fontURL]; 249 | UIView *view = [UIView new]; 250 | view.userInteractionEnabled = NO; 251 | 252 | // When 253 | NSString *actual = [loader description]; 254 | 255 | // Then 256 | XCTAssertTrue([actual hasSuffix:expected], 257 | @"When load fails the description of the font loader %@ must end with: %@", actual, 258 | expected); 259 | } 260 | 261 | - (void)testNotEquals { 262 | // Given 263 | NSString *name = @"some name"; 264 | NSString *otherName = @"some other name"; 265 | NSURL *url = [NSURL fileURLWithPath:@"some url string"]; 266 | NSURL *otherUrl = [NSURL fileURLWithPath:@"some other url string"]; 267 | MDFFontDiskLoader *loader = [[MDFFontDiskLoader alloc] initWithFontName:name fontURL:url]; 268 | MDFFontDiskLoader *secondLoader = 269 | [[MDFFontDiskLoader alloc] initWithFontName:otherName fontURL:url]; 270 | MDFFontDiskLoader *thirdLoader = 271 | [[MDFFontDiskLoader alloc] initWithFontName:name fontURL:otherUrl]; 272 | NSObject *object = [[NSObject alloc] init]; 273 | 274 | // Then 275 | XCTAssertNotEqualObjects(loader, secondLoader, 276 | @"Fontloaders with different font names must not equal eachother."); 277 | XCTAssertNotEqual([loader hash], [secondLoader hash], 278 | @"Fontloaders with different font names must not have equal hashes."); 279 | XCTAssertNotEqualObjects(loader, thirdLoader, 280 | @"Fontloaders with different font urls must not equal eachother."); 281 | XCTAssertNotEqual([loader hash], [secondLoader hash], 282 | @"Fontloaders with different font urls must not have equal hashes."); 283 | XCTAssertNotEqualObjects(secondLoader, thirdLoader, 284 | @"Fontloaders with different font names and different names must not" 285 | @"equal eachother."); 286 | XCTAssertNotEqual([loader hash], [secondLoader hash], 287 | @"Fontloaders with different font names and different names must not have equal" 288 | @"hashes."); 289 | XCTAssertNotEqualObjects(loader, object, @"A fontloader must not equal a object instance."); 290 | XCTAssertNotEqual([loader hash], [object hash], 291 | @"A fontloader must not have the same hash as a object instance."); 292 | XCTAssertNotEqualObjects(loader, nil, @"A font loader must not equal nil"); 293 | } 294 | 295 | - (void)testEquals { 296 | // Given 297 | NSURL *url = [NSURL fileURLWithPath:@"some url string"]; 298 | MDFFontDiskLoader *loader = [[MDFFontDiskLoader alloc] initWithFontName:@"some name" fontURL:url]; 299 | MDFFontDiskLoader *secondLoader = 300 | [[MDFFontDiskLoader alloc] initWithFontName:@"some name" fontURL:url]; 301 | 302 | // Then 303 | XCTAssertEqualObjects(loader, secondLoader, 304 | @"Fontloaders with the same font names and font urls must equal" 305 | @"eachother."); 306 | XCTAssertEqual([loader hash], [secondLoader hash], 307 | @"Fontloaders with the same font name and font urls must have the same hash."); 308 | } 309 | 310 | @end 311 | --------------------------------------------------------------------------------