├── .gitignore ├── .swift-version ├── .travis.yml ├── LICENSE ├── README.md ├── _config.yml ├── demo.gif ├── demo.png ├── fbCharm.podspec ├── fbCharm.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── fbCharm ├── Info.plist ├── fbCharm+NSMutableAttributedString.swift ├── fbCharm+UIFont.swift └── fbCharm.h ├── fbCharmDemo ├── Podfile ├── fbCharmDemo.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── fbCharmDemo.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── fbCharmDemo │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── App Store-1024.png │ │ ├── CarPlay-60@2x.png │ │ ├── CarPlay-60@3x.png │ │ ├── Contents.json │ │ ├── iPad App-76.png │ │ ├── iPad App-76@2x.png │ │ ├── iPad Notifications-20.png │ │ ├── iPad Notifications-20@2x.png │ │ ├── iPad Pro App-83.5@2x.png │ │ ├── iPad Settings-29.png │ │ ├── iPad Settings-29@2x.png │ │ ├── iPad Spotlight-40.png │ │ ├── iPad Spotlight-40@2x.png │ │ ├── iPhone App-60@2x.png │ │ ├── iPhone App-60@3x.png │ │ ├── iPhone Notification-20@2x.png │ │ ├── iPhone Notification-20@3x.png │ │ ├── iPhone Settings-29@2x.png │ │ ├── iPhone Settings-29@3x.png │ │ ├── iPhone Spotlight-40@2x.png │ │ └── iPhone Spotlight-40@3x.png │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ ├── NextViewController.swift │ ├── ViewController.swift │ └── fonts │ ├── IBMPlexSans-Regular.ttf │ ├── LucidaGrande.ttc │ └── WawaSC-Regular.otf └── logo.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | ## Playgrounds 32 | timeline.xctimeline 33 | playground.xcworkspace 34 | 35 | # Swift Package Manager 36 | # 37 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 38 | # Packages/ 39 | # Package.pins 40 | # Package.resolved 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 | Podfile.lock 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://docs.fastlane.tools/best-practices/source-control/#source-control 65 | 66 | fastlane/report.xml 67 | fastlane/Preview.html 68 | fastlane/screenshots/**/*.png 69 | fastlane/test_output 70 | 71 | # DS_Store 72 | .DS_Store 73 | -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 4.2 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | 2 | language: swift 3 | osx_image: xcode10 4 | 5 | env: 6 | global: 7 | - LC_CTYPE=en_US.UTF-8 8 | - LANG=en_US.UTF-8 9 | 10 | 11 | before_install: 12 | - env 13 | - locale 14 | # - gem install cocoapods --no-rdoc --no-ri --no-document --quiet 15 | - gem install xcpretty --no-document --quiet 16 | - pod --version 17 | # - pod repo remove master 18 | - pod setup --silent > /dev/null 19 | - pod repo update --silent 20 | - xcpretty --version 21 | - xcodebuild -version 22 | - xcodebuild -showsdks 23 | 24 | script: 25 | - set -o pipefail 26 | 27 | - echo Build as framework 28 | - xcodebuild clean build -project fbCharm.xcodeproj -scheme fbCharm -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty -c 29 | 30 | #after_success: 31 | # - bash <(curl -s https://codecov.io/bash) 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 pcjbird 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![logo](https://github.com/pcjbird/fbCharm/raw/master/logo.png) 2 | [![Build Status](http://img.shields.io/travis/pcjbird/fbCharm/master.svg?style=flat)](https://travis-ci.org/pcjbird/fbCharm) 3 | [![Pod Version](http://img.shields.io/cocoapods/v/fbCharm.svg?style=flat)](http://cocoadocs.org/docsets/fbCharm/) 4 | [![Pod Platform](http://img.shields.io/cocoapods/p/fbCharm.svg?style=flat)](http://cocoadocs.org/docsets/fbCharm/) 5 | [![Pod License](http://img.shields.io/cocoapods/l/fbCharm.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0.html) 6 | [![GitHub release](https://img.shields.io/github/release/pcjbird/fbCharm.svg)](https://github.com/pcjbird/fbCharm/releases) 7 | [![GitHub release](https://img.shields.io/github/release-date/pcjbird/fbCharm.svg)](https://github.com/pcjbird/fbCharm/releases) 8 | [![Website](https://img.shields.io/website-pcjbird-down-green-red/https/shields.io.svg?label=author)](https://pcjbird.github.io) 9 | 10 | # fbCharm (Charm of Fallback) 11 | ### iOS 上利用 fallback 机制为不同语言的文字 (script) 设定字体,从而使得文本混排更为优雅。 12 | 13 | 如果您是一位 WEB 开发者,相信您对 CSS 的 font-family 属性一定不会陌生。通常我们会为 font-family 属性设置一长串的字体(家族)列表,就像这样的: 14 | 15 | ```css 16 | .text { font-family: Menlo, Monaco, Consolas, "Courier New", monospace, Arial, "Microsoft YaHei", "黑体", "宋体", sans-serif; } 17 | ``` 18 | 19 | 有人肯定会问,为什么要这么设置啊?如果你足够细心,你一定会发现当你浏览该网页时英文字体和中文字体并不是同一种字体,如果你在不同的操作系统甚至不同的电脑上看到网页所呈现的字体也不一样。这又是为什么呢? 20 | 21 | 此外,在您使用 Microsoft Word 进行段落排版的时候,你会发现 Word 可以自动对中文样式应用中文字体,对英文样式应用英文字体。这又是如何做到的呢? 22 | 23 | 在实际的排版需求中,为了好看,我们通常会需要针对不同语言的文字 (script) 进行不同的字体设定,以达到最佳的视觉效果。当然,对于我们来说,最常见的还是中英文混排。通常设计人员给出的设计稿非常漂亮,可是中英文使用了不同的字体,我们开发人员该如何高保真地还原设计稿的原始设计呢? 24 | 25 | 很显然,对于 WEB 开发者来说,已经有了很好的解决方案,而对于其他客户端的同学来说,这估计应该就有点犯难了,我们通常会告诉设计人员:“系统不支持” 抑或 “做不了” 之类的话。那事实上,到底能不能做到呢?答案是肯定的。 26 | 27 | ## 特性 / Features 28 | 29 | 1. 支持类似 CSS 的 font-family 属性一样设置一个字体家族 (font-family) 列表或字体名称 (font-name) 列表从而创建一个混合字体 (UIFont)。 30 | 2. 支持同样的方式创建带样式的NSAttributedString,支持设置文本间隔 (kern), 字重 (weight) 等。 31 | 3. 支持 fallback 到指定的系统字体。 32 | 33 | ## 演示 / Demo 34 | 35 |

36 | 37 |

38 | 39 | ## 安装 / Installation 40 | 41 | 方法一:`fbCharm` is available through CocoaPods. To install it, simply add the following line to your Podfile: 42 | ``` 43 | pod 'fbCharm' 44 | ``` 45 | ## 使用 / Usage 46 | ```swift 47 | let text = "これは日本語文章と Roman Text の混植文章です。美しいヒラギノと San Francisco で日本語とローマ字を書きます。System Font のフォントメトリクスには独自の調整が入っています。\n\n这是一段中文简体。\n這是一段中文繁體。\nうつくしい森で飾られたモーリオ市、\n郊外のぎらぎらひかる草の波。\n祇辻飴葛蛸鯖鰯噌庖箸\n底辺直卿蝕薩化\nABCDEFGHIJKLM\nabcdefghijklm\n1234567890\niClockᴹᴵᴺᴵ\nClockª" 48 | let fontSize: CGFloat = 22.0 49 | 50 | // 適当に行間を空ける処理 51 | let paragraphStyle: NSMutableParagraphStyle = NSMutableParagraphStyle() 52 | paragraphStyle.minimumLineHeight = fontSize * 1.5 53 | paragraphStyle.maximumLineHeight = paragraphStyle.minimumLineHeight 54 | 55 | let attributedString = NSMutableAttributedString(text: text, families: ["Lucida Grande", "Baskerville", "Apple SD Gothic Neo"], size: 18.0, weight: .light, kern: 4.0, paragraphStyle: paragraphStyle) 56 | self.label.attributedText = attributedString 57 | 58 | //let font = UIFont(families: ["Lucida Grande", "Baskerville", "Apple SD Gothic Neo"], size: 20, weight: .medium) 59 | //self.label.font = font 60 | //self.label.text = text 61 | ``` 62 | ## 关注我们 / Follow us 63 |    64 |    65 |    66 |   [![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=https://github.com/pcjbird/fbCharm) 67 |   [![Twitter Follow](https://img.shields.io/twitter/follow/pcjbird.svg?style=social)](https://twitter.com/pcjbird) 68 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-slate -------------------------------------------------------------------------------- /demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/demo.gif -------------------------------------------------------------------------------- /demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/demo.png -------------------------------------------------------------------------------- /fbCharm.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "fbCharm" 3 | s.version = "1.0.5" 4 | s.summary = "iOS 上利用 fallback 机制为不同语言的文字 (script) 设定字体,从而使得文本混排更为优雅。" 5 | s.description = <<-DESC 6 | iOS 上利用 fallback 机制为不同语言的文字 (script) 设定字体,从而使得文本混排更为优雅。 7 | 8 | 如果您是一位 WEB 开发者,相信您对 CSS 的 font-family 属性一定不会陌生。通常我们会为 font-family 属性设置一长串的字体(家族)列表,就像这样的: 9 | 10 | .text { font-family: Menlo, Monaco, Consolas, "Courier New", monospace, Arial, "Microsoft YaHei", "黑体", "宋体", sans-serif; } 11 | 12 | 有人肯定会问,为什么要这么设置啊?如果你足够细心,你一定会发现当你浏览该网页时英文字体和中文字体并不是同一种字体,如果你在不同的操作系统甚至不同的电脑上看到网页所呈现的字体也不一样。这又是为什么呢? 13 | 14 | 此外,在您使用 Microsoft Word 进行段落排版的时候,你会发现 Word 可以自动对中文样式应用中文字体,对英文样式应用英文字体。这又是如何做到的呢? 15 | 16 | 在实际的排版需求中,为了好看,我们通常会需要针对不同语言的文字 (script) 进行不同的字体设定,以达到最佳的视觉效果。当然,对于我们来说,最常见的还是中英文混排。通常设计人员给出的设计稿非常漂亮,可是中英文使用了不同的字体,我们开发人员该如何高保真地还原设计稿的原始设计呢? 17 | 18 | 很显然,对于 WEB 开发者来说,已经有了很好的解决方案,而对于其他客户端的同学来说,这估计应该就有点犯难了,我们通常会告诉设计人员:“系统不支持” 抑或 “做不了” 之类的话。那事实上,到底能不能做到呢?答案是肯定的。 19 | DESC 20 | s.homepage = "https://github.com/pcjbird/fbCharm" 21 | s.license = 'MIT' 22 | s.author = {"pcjbird" => "pcjbird@hotmail.com"} 23 | s.source = {:git => "https://github.com/pcjbird/fbCharm.git", :tag => s.version.to_s} 24 | s.social_media_url = 'http://www.lessney.com' 25 | s.requires_arc = true 26 | s.documentation_url = 'https://github.com/pcjbird/fbCharm/blob/master/README.md' 27 | s.screenshot = 'https://github.com/pcjbird/fbCharm/raw/master/logo.png' 28 | 29 | s.platform = :ios, '8.0' 30 | s.frameworks = 'Foundation', 'UIKit' 31 | 32 | s.source_files = 'fbCharm/*.swift' 33 | 34 | s.pod_target_xcconfig = { 'OTHER_LDFLAGS' => '-lObjC' } 35 | 36 | end 37 | -------------------------------------------------------------------------------- /fbCharm.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 89EE179D21C4E1A5005F2F56 /* fbCharm.h in Headers */ = {isa = PBXBuildFile; fileRef = 89EE179B21C4E1A5005F2F56 /* fbCharm.h */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | 89EE17AA21C4E31B005F2F56 /* fbCharm+UIFont.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89EE17A921C4E31B005F2F56 /* fbCharm+UIFont.swift */; }; 12 | 89EE17D621C565ED005F2F56 /* fbCharm+NSMutableAttributedString.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89EE17D521C565ED005F2F56 /* fbCharm+NSMutableAttributedString.swift */; }; 13 | /* End PBXBuildFile section */ 14 | 15 | /* Begin PBXFileReference section */ 16 | 89EE179821C4E1A5005F2F56 /* fbCharm.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = fbCharm.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 17 | 89EE179B21C4E1A5005F2F56 /* fbCharm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fbCharm.h; sourceTree = ""; }; 18 | 89EE179C21C4E1A5005F2F56 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 19 | 89EE17A921C4E31B005F2F56 /* fbCharm+UIFont.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "fbCharm+UIFont.swift"; sourceTree = ""; }; 20 | 89EE17AD21C54834005F2F56 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; 21 | 89EE17AE21C54834005F2F56 /* fbCharm.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = fbCharm.podspec; sourceTree = ""; }; 22 | 89EE17AF21C54834005F2F56 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; 23 | 89EE17D521C565ED005F2F56 /* fbCharm+NSMutableAttributedString.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "fbCharm+NSMutableAttributedString.swift"; sourceTree = ""; }; 24 | /* End PBXFileReference section */ 25 | 26 | /* Begin PBXFrameworksBuildPhase section */ 27 | 89EE179521C4E1A5005F2F56 /* Frameworks */ = { 28 | isa = PBXFrameworksBuildPhase; 29 | buildActionMask = 2147483647; 30 | files = ( 31 | ); 32 | runOnlyForDeploymentPostprocessing = 0; 33 | }; 34 | /* End PBXFrameworksBuildPhase section */ 35 | 36 | /* Begin PBXGroup section */ 37 | 89EE178E21C4E1A5005F2F56 = { 38 | isa = PBXGroup; 39 | children = ( 40 | 89EE17A421C4E252005F2F56 /* metadata */, 41 | 89EE179A21C4E1A5005F2F56 /* fbCharm */, 42 | 89EE179921C4E1A5005F2F56 /* Products */, 43 | ); 44 | sourceTree = ""; 45 | }; 46 | 89EE179921C4E1A5005F2F56 /* Products */ = { 47 | isa = PBXGroup; 48 | children = ( 49 | 89EE179821C4E1A5005F2F56 /* fbCharm.framework */, 50 | ); 51 | name = Products; 52 | sourceTree = ""; 53 | }; 54 | 89EE179A21C4E1A5005F2F56 /* fbCharm */ = { 55 | isa = PBXGroup; 56 | children = ( 57 | 89EE179B21C4E1A5005F2F56 /* fbCharm.h */, 58 | 89EE17D521C565ED005F2F56 /* fbCharm+NSMutableAttributedString.swift */, 59 | 89EE17A921C4E31B005F2F56 /* fbCharm+UIFont.swift */, 60 | 89EE179C21C4E1A5005F2F56 /* Info.plist */, 61 | ); 62 | path = fbCharm; 63 | sourceTree = ""; 64 | }; 65 | 89EE17A421C4E252005F2F56 /* metadata */ = { 66 | isa = PBXGroup; 67 | children = ( 68 | 89EE17AE21C54834005F2F56 /* fbCharm.podspec */, 69 | 89EE17AD21C54834005F2F56 /* LICENSE */, 70 | 89EE17AF21C54834005F2F56 /* README.md */, 71 | ); 72 | name = metadata; 73 | sourceTree = ""; 74 | }; 75 | /* End PBXGroup section */ 76 | 77 | /* Begin PBXHeadersBuildPhase section */ 78 | 89EE179321C4E1A5005F2F56 /* Headers */ = { 79 | isa = PBXHeadersBuildPhase; 80 | buildActionMask = 2147483647; 81 | files = ( 82 | 89EE179D21C4E1A5005F2F56 /* fbCharm.h in Headers */, 83 | ); 84 | runOnlyForDeploymentPostprocessing = 0; 85 | }; 86 | /* End PBXHeadersBuildPhase section */ 87 | 88 | /* Begin PBXNativeTarget section */ 89 | 89EE179721C4E1A5005F2F56 /* fbCharm */ = { 90 | isa = PBXNativeTarget; 91 | buildConfigurationList = 89EE17A021C4E1A5005F2F56 /* Build configuration list for PBXNativeTarget "fbCharm" */; 92 | buildPhases = ( 93 | 89EE179321C4E1A5005F2F56 /* Headers */, 94 | 89EE179421C4E1A5005F2F56 /* Sources */, 95 | 89EE179521C4E1A5005F2F56 /* Frameworks */, 96 | 89EE179621C4E1A5005F2F56 /* Resources */, 97 | ); 98 | buildRules = ( 99 | ); 100 | dependencies = ( 101 | ); 102 | name = fbCharm; 103 | productName = fbCharm; 104 | productReference = 89EE179821C4E1A5005F2F56 /* fbCharm.framework */; 105 | productType = "com.apple.product-type.framework"; 106 | }; 107 | /* End PBXNativeTarget section */ 108 | 109 | /* Begin PBXProject section */ 110 | 89EE178F21C4E1A5005F2F56 /* Project object */ = { 111 | isa = PBXProject; 112 | attributes = { 113 | LastUpgradeCheck = 1010; 114 | ORGANIZATIONNAME = "Zero Status"; 115 | TargetAttributes = { 116 | 89EE179721C4E1A5005F2F56 = { 117 | CreatedOnToolsVersion = 10.1; 118 | LastSwiftMigration = 1010; 119 | }; 120 | }; 121 | }; 122 | buildConfigurationList = 89EE179221C4E1A5005F2F56 /* Build configuration list for PBXProject "fbCharm" */; 123 | compatibilityVersion = "Xcode 9.3"; 124 | developmentRegion = en; 125 | hasScannedForEncodings = 0; 126 | knownRegions = ( 127 | en, 128 | ); 129 | mainGroup = 89EE178E21C4E1A5005F2F56; 130 | productRefGroup = 89EE179921C4E1A5005F2F56 /* Products */; 131 | projectDirPath = ""; 132 | projectRoot = ""; 133 | targets = ( 134 | 89EE179721C4E1A5005F2F56 /* fbCharm */, 135 | ); 136 | }; 137 | /* End PBXProject section */ 138 | 139 | /* Begin PBXResourcesBuildPhase section */ 140 | 89EE179621C4E1A5005F2F56 /* Resources */ = { 141 | isa = PBXResourcesBuildPhase; 142 | buildActionMask = 2147483647; 143 | files = ( 144 | ); 145 | runOnlyForDeploymentPostprocessing = 0; 146 | }; 147 | /* End PBXResourcesBuildPhase section */ 148 | 149 | /* Begin PBXSourcesBuildPhase section */ 150 | 89EE179421C4E1A5005F2F56 /* Sources */ = { 151 | isa = PBXSourcesBuildPhase; 152 | buildActionMask = 2147483647; 153 | files = ( 154 | 89EE17AA21C4E31B005F2F56 /* fbCharm+UIFont.swift in Sources */, 155 | 89EE17D621C565ED005F2F56 /* fbCharm+NSMutableAttributedString.swift in Sources */, 156 | ); 157 | runOnlyForDeploymentPostprocessing = 0; 158 | }; 159 | /* End PBXSourcesBuildPhase section */ 160 | 161 | /* Begin XCBuildConfiguration section */ 162 | 89EE179E21C4E1A5005F2F56 /* Debug */ = { 163 | isa = XCBuildConfiguration; 164 | buildSettings = { 165 | ALWAYS_SEARCH_USER_PATHS = NO; 166 | CLANG_ANALYZER_NONNULL = YES; 167 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 168 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 169 | CLANG_CXX_LIBRARY = "libc++"; 170 | CLANG_ENABLE_MODULES = YES; 171 | CLANG_ENABLE_OBJC_ARC = YES; 172 | CLANG_ENABLE_OBJC_WEAK = YES; 173 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 174 | CLANG_WARN_BOOL_CONVERSION = YES; 175 | CLANG_WARN_COMMA = YES; 176 | CLANG_WARN_CONSTANT_CONVERSION = YES; 177 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 178 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 179 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 180 | CLANG_WARN_EMPTY_BODY = YES; 181 | CLANG_WARN_ENUM_CONVERSION = YES; 182 | CLANG_WARN_INFINITE_RECURSION = YES; 183 | CLANG_WARN_INT_CONVERSION = YES; 184 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 185 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 186 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 187 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 188 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 189 | CLANG_WARN_STRICT_PROTOTYPES = YES; 190 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 191 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 192 | CLANG_WARN_UNREACHABLE_CODE = YES; 193 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 194 | CODE_SIGN_IDENTITY = "iPhone Developer"; 195 | COPY_PHASE_STRIP = NO; 196 | CURRENT_PROJECT_VERSION = 1; 197 | DEBUG_INFORMATION_FORMAT = dwarf; 198 | ENABLE_STRICT_OBJC_MSGSEND = YES; 199 | ENABLE_TESTABILITY = YES; 200 | GCC_C_LANGUAGE_STANDARD = gnu11; 201 | GCC_DYNAMIC_NO_PIC = NO; 202 | GCC_NO_COMMON_BLOCKS = YES; 203 | GCC_OPTIMIZATION_LEVEL = 0; 204 | GCC_PREPROCESSOR_DEFINITIONS = ( 205 | "DEBUG=1", 206 | "$(inherited)", 207 | ); 208 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 209 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 210 | GCC_WARN_UNDECLARED_SELECTOR = YES; 211 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 212 | GCC_WARN_UNUSED_FUNCTION = YES; 213 | GCC_WARN_UNUSED_VARIABLE = YES; 214 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 215 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 216 | MTL_FAST_MATH = YES; 217 | ONLY_ACTIVE_ARCH = YES; 218 | SDKROOT = iphoneos; 219 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 220 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 221 | VERSIONING_SYSTEM = "apple-generic"; 222 | VERSION_INFO_PREFIX = ""; 223 | }; 224 | name = Debug; 225 | }; 226 | 89EE179F21C4E1A5005F2F56 /* Release */ = { 227 | isa = XCBuildConfiguration; 228 | buildSettings = { 229 | ALWAYS_SEARCH_USER_PATHS = NO; 230 | CLANG_ANALYZER_NONNULL = YES; 231 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 232 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 233 | CLANG_CXX_LIBRARY = "libc++"; 234 | CLANG_ENABLE_MODULES = YES; 235 | CLANG_ENABLE_OBJC_ARC = YES; 236 | CLANG_ENABLE_OBJC_WEAK = YES; 237 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 238 | CLANG_WARN_BOOL_CONVERSION = YES; 239 | CLANG_WARN_COMMA = YES; 240 | CLANG_WARN_CONSTANT_CONVERSION = YES; 241 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 242 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 243 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 244 | CLANG_WARN_EMPTY_BODY = YES; 245 | CLANG_WARN_ENUM_CONVERSION = YES; 246 | CLANG_WARN_INFINITE_RECURSION = YES; 247 | CLANG_WARN_INT_CONVERSION = YES; 248 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 249 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 250 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 251 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 252 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 253 | CLANG_WARN_STRICT_PROTOTYPES = YES; 254 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 255 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 256 | CLANG_WARN_UNREACHABLE_CODE = YES; 257 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 258 | CODE_SIGN_IDENTITY = "iPhone Developer"; 259 | COPY_PHASE_STRIP = NO; 260 | CURRENT_PROJECT_VERSION = 1; 261 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 262 | ENABLE_NS_ASSERTIONS = NO; 263 | ENABLE_STRICT_OBJC_MSGSEND = YES; 264 | GCC_C_LANGUAGE_STANDARD = gnu11; 265 | GCC_NO_COMMON_BLOCKS = YES; 266 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 267 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 268 | GCC_WARN_UNDECLARED_SELECTOR = YES; 269 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 270 | GCC_WARN_UNUSED_FUNCTION = YES; 271 | GCC_WARN_UNUSED_VARIABLE = YES; 272 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 273 | MTL_ENABLE_DEBUG_INFO = NO; 274 | MTL_FAST_MATH = YES; 275 | SDKROOT = iphoneos; 276 | SWIFT_COMPILATION_MODE = wholemodule; 277 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 278 | VALIDATE_PRODUCT = YES; 279 | VERSIONING_SYSTEM = "apple-generic"; 280 | VERSION_INFO_PREFIX = ""; 281 | }; 282 | name = Release; 283 | }; 284 | 89EE17A121C4E1A5005F2F56 /* Debug */ = { 285 | isa = XCBuildConfiguration; 286 | buildSettings = { 287 | CLANG_ENABLE_MODULES = YES; 288 | CODE_SIGN_IDENTITY = ""; 289 | CODE_SIGN_STYLE = Automatic; 290 | DEFINES_MODULE = YES; 291 | DYLIB_COMPATIBILITY_VERSION = 1; 292 | DYLIB_CURRENT_VERSION = 1; 293 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 294 | INFOPLIST_FILE = fbCharm/Info.plist; 295 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 296 | LD_RUNPATH_SEARCH_PATHS = ( 297 | "$(inherited)", 298 | "@executable_path/Frameworks", 299 | "@loader_path/Frameworks", 300 | ); 301 | PRODUCT_BUNDLE_IDENTIFIER = com.lessney.fbCharm; 302 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 303 | SKIP_INSTALL = YES; 304 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 305 | SWIFT_VERSION = 4.2; 306 | TARGETED_DEVICE_FAMILY = "1,2"; 307 | }; 308 | name = Debug; 309 | }; 310 | 89EE17A221C4E1A5005F2F56 /* Release */ = { 311 | isa = XCBuildConfiguration; 312 | buildSettings = { 313 | CLANG_ENABLE_MODULES = YES; 314 | CODE_SIGN_IDENTITY = ""; 315 | CODE_SIGN_STYLE = Automatic; 316 | DEFINES_MODULE = YES; 317 | DYLIB_COMPATIBILITY_VERSION = 1; 318 | DYLIB_CURRENT_VERSION = 1; 319 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 320 | INFOPLIST_FILE = fbCharm/Info.plist; 321 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 322 | LD_RUNPATH_SEARCH_PATHS = ( 323 | "$(inherited)", 324 | "@executable_path/Frameworks", 325 | "@loader_path/Frameworks", 326 | ); 327 | PRODUCT_BUNDLE_IDENTIFIER = com.lessney.fbCharm; 328 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 329 | SKIP_INSTALL = YES; 330 | SWIFT_VERSION = 4.2; 331 | TARGETED_DEVICE_FAMILY = "1,2"; 332 | }; 333 | name = Release; 334 | }; 335 | /* End XCBuildConfiguration section */ 336 | 337 | /* Begin XCConfigurationList section */ 338 | 89EE179221C4E1A5005F2F56 /* Build configuration list for PBXProject "fbCharm" */ = { 339 | isa = XCConfigurationList; 340 | buildConfigurations = ( 341 | 89EE179E21C4E1A5005F2F56 /* Debug */, 342 | 89EE179F21C4E1A5005F2F56 /* Release */, 343 | ); 344 | defaultConfigurationIsVisible = 0; 345 | defaultConfigurationName = Release; 346 | }; 347 | 89EE17A021C4E1A5005F2F56 /* Build configuration list for PBXNativeTarget "fbCharm" */ = { 348 | isa = XCConfigurationList; 349 | buildConfigurations = ( 350 | 89EE17A121C4E1A5005F2F56 /* Debug */, 351 | 89EE17A221C4E1A5005F2F56 /* Release */, 352 | ); 353 | defaultConfigurationIsVisible = 0; 354 | defaultConfigurationName = Release; 355 | }; 356 | /* End XCConfigurationList section */ 357 | }; 358 | rootObject = 89EE178F21C4E1A5005F2F56 /* Project object */; 359 | } 360 | -------------------------------------------------------------------------------- /fbCharm.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /fbCharm.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fbCharm/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.5 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | 22 | 23 | -------------------------------------------------------------------------------- /fbCharm/fbCharm+NSMutableAttributedString.swift: -------------------------------------------------------------------------------- 1 | // 2 | // fbCharm+NSMutableAttributedString.swift 3 | // fbCharm 4 | // 5 | // Created by pcjbird on 2018/12/16. 6 | // Copyright © 2018 Zero Status. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | /** 13 | * NSMutableAttributedString 混合字体字符串扩展 14 | */ 15 | @objc public extension NSMutableAttributedString { 16 | 17 | /// 使用字体名称(font-name)列表初始化混合字体字符串 18 | /// - Parameter text: 文本内容 19 | /// - Parameter names: 字体名称列表,顺序建议遵循 fallback 机制,通常是首先是拉丁字母、西里尔字母、希腊字母等西文的字体,然后以一定的顺序分别是阿拉伯字母、天城文(例如印度文)、日文、韩文、简体中文、繁体中文等文字的字体。 20 | /// - Parameter size: 文本大小 21 | /// - Parameter kern: 文字间隔,默认不指定文本间隔 22 | /// - Parameter paragraphStyle: 段落样式,默认不设定段落样式 23 | /// - Parameter fallback: 指定 fallback 到某种语言的系统字体,默认不设定 24 | /// - Returns: 混合字体字符串(NSMutableAttributedString) 25 | convenience init(text: String, names: [String], size: CGFloat, kern: CGFloat = 0.0, paragraphStyle: NSParagraphStyle? = nil, fallback: String? = nil){ 26 | let font = UIFont(names: names, size: size) 27 | var attributes = Dictionary() 28 | attributes[NSAttributedString.Key.font] = font 29 | if kern > 0 { 30 | attributes[NSAttributedString.Key.kern] = kern 31 | } 32 | if paragraphStyle != nil { 33 | attributes[NSAttributedString.Key.paragraphStyle] = paragraphStyle 34 | } 35 | if fallback != nil { 36 | let languages = Locale.preferredLanguages 37 | if languages.contains(fallback!) { 38 | attributes[NSAttributedString.Key(rawValue: kCTLanguageAttributeName as String as String)] = fallback 39 | } 40 | } 41 | let attributedString = NSMutableAttributedString(string: text, attributes:attributes) 42 | self.init(attributedString: attributedString) 43 | } 44 | 45 | /// 使用字体家族(font-family)列表初始化混合字体字符串 46 | /// - Parameter text: 文本内容 47 | /// - Parameter families: 字体家族列表,顺序建议遵循 fallback 机制,通常是首先是拉丁字母、西里尔字母、希腊字母等西文的字体,然后以一定的顺序分别是阿拉伯字母、天城文(例如印度文)、日文、韩文、简体中文、繁体中文等文字的字体。 48 | /// - Parameter size: 文本大小 49 | /// - Parameter kern: 文字间隔,默认不指定文本间隔 50 | /// - Parameter paragraphStyle: 段落样式,默认不设定段落样式 51 | /// - Parameter fallback: 指定 fallback 到某种语言的系统字体,默认不设定 52 | /// - Returns: 混合字体字符串(NSMutableAttributedString) 53 | convenience init(text: String, families: [String], size: CGFloat, kern: CGFloat = 0.0, paragraphStyle: NSParagraphStyle? = nil, fallback: String? = nil){ 54 | let font = UIFont(families: families, size: size) 55 | var attributes = Dictionary() 56 | attributes[NSAttributedString.Key.font] = font 57 | if kern > 0 { 58 | attributes[NSAttributedString.Key.kern] = kern 59 | } 60 | if paragraphStyle != nil { 61 | attributes[NSAttributedString.Key.paragraphStyle] = paragraphStyle 62 | } 63 | if fallback != nil { 64 | let languages = Locale.preferredLanguages 65 | if languages.contains(fallback!) { 66 | attributes[NSAttributedString.Key(rawValue: kCTLanguageAttributeName as String as String)] = fallback 67 | } 68 | } 69 | let attributedString = NSMutableAttributedString(string: text, attributes:attributes) 70 | self.init(attributedString: attributedString) 71 | } 72 | 73 | /// 使用字体家族(font-family)列表初始化混合字体字符串,并制定文本的字重,使用 iOS 8.2 之后的系统 74 | /// - Parameter text: 文本内容 75 | /// - Parameter families: 字体家族列表,顺序建议遵循 fallback 机制,通常是首先是拉丁字母、西里尔字母、希腊字母等西文的字体,然后以一定的顺序分别是阿拉伯字母、天城文(例如印度文)、日文、韩文、简体中文、繁体中文等文字的字体。 76 | /// - Parameter size: 文本大小 77 | /// - Parameter weight: 字重,默认 regular 78 | /// - Parameter kern: 文字间隔,默认不指定文本间隔 79 | /// - Parameter paragraphStyle: 段落样式,默认不设定段落样式 80 | /// - Parameter fallback: 指定 fallback 到某种语言的系统字体,默认不设定 81 | /// - Returns: 混合字体字符串(NSMutableAttributedString) 82 | @available(iOS 8.2, *) 83 | convenience init(text: String, families: [String], size: CGFloat, weight: UIFont.Weight = .regular, kern: CGFloat = 0.0, paragraphStyle: NSParagraphStyle? = nil, fallback: String? = nil){ 84 | let font = UIFont(families: families, size: size, weight: weight) 85 | var attributes = Dictionary() 86 | attributes[NSAttributedString.Key.font] = font 87 | if kern > 0 { 88 | attributes[NSAttributedString.Key.kern] = kern 89 | } 90 | if paragraphStyle != nil { 91 | attributes[NSAttributedString.Key.paragraphStyle] = paragraphStyle 92 | } 93 | if fallback != nil { 94 | let languages = Locale.preferredLanguages 95 | if languages.contains(fallback!) { 96 | attributes[NSAttributedString.Key(rawValue: kCTLanguageAttributeName as String as String)] = fallback 97 | } 98 | } 99 | let attributedString = NSMutableAttributedString(string: text, attributes:attributes) 100 | 101 | self.init(attributedString: attributedString) 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /fbCharm/fbCharm+UIFont.swift: -------------------------------------------------------------------------------- 1 | // 2 | // fbCharm+UIFont.swift 3 | // fbCharm 4 | // 5 | // Created by pcjbird on 2018/12/15. 6 | // Copyright © 2018 Zero Status. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | /** 13 | * UIFont 扩展 14 | */ 15 | @objc public extension UIFont { 16 | convenience init(names: [String], size: CGFloat) { 17 | 18 | if names.first != nil { 19 | let mainFontName = names.first! 20 | 21 | let descriptors = names.map { UIFontDescriptor(fontAttributes: [.name: $0]) } 22 | 23 | let attributes: [UIFontDescriptor.AttributeName: Any] = [ 24 | UIFontDescriptor.AttributeName.cascadeList: descriptors, 25 | UIFontDescriptor.AttributeName.name: mainFontName, 26 | UIFontDescriptor.AttributeName.size: size, 27 | ] 28 | 29 | let customFontDescriptor: UIFontDescriptor = UIFontDescriptor(fontAttributes: attributes) 30 | self.init(descriptor: customFontDescriptor, size: size) 31 | } 32 | else{ 33 | let systemFont = UIFont.systemFont(ofSize: size) 34 | let systemFontDescriptor: UIFontDescriptor = systemFont.fontDescriptor 35 | self.init(descriptor: systemFontDescriptor, size: size) 36 | } 37 | } 38 | 39 | convenience init(families: [String], size: CGFloat) { 40 | 41 | if families.first != nil { 42 | let mainFontFamily = families.first! 43 | let descriptors = families.map { UIFontDescriptor(fontAttributes: [.family: $0]) } 44 | 45 | let attributes: [UIFontDescriptor.AttributeName: Any] = [ 46 | UIFontDescriptor.AttributeName.cascadeList: descriptors, 47 | UIFontDescriptor.AttributeName.family: mainFontFamily, 48 | UIFontDescriptor.AttributeName.size: size 49 | ] 50 | 51 | let customFontDescriptor: UIFontDescriptor = UIFontDescriptor(fontAttributes: attributes) 52 | self.init(descriptor: customFontDescriptor, size: size) 53 | } 54 | else{ 55 | let systemFont = UIFont.systemFont(ofSize: size) 56 | let systemFontDescriptor: UIFontDescriptor = systemFont.fontDescriptor 57 | self.init(descriptor: systemFontDescriptor, size: size) 58 | } 59 | } 60 | 61 | @available(iOS 8.2, *) 62 | convenience init(families: [String], size: CGFloat, weight: UIFont.Weight = .regular) { 63 | 64 | if families.first != nil { 65 | let mainFontFamily = families.first! 66 | let descriptors = families.map { UIFontDescriptor(fontAttributes: [.family: $0]) } 67 | let traits = [UIFontDescriptor.TraitKey.weight: weight] 68 | 69 | let attributes: [UIFontDescriptor.AttributeName: Any] = [ 70 | UIFontDescriptor.AttributeName.cascadeList: descriptors, 71 | UIFontDescriptor.AttributeName.family: mainFontFamily, 72 | UIFontDescriptor.AttributeName.size: size, 73 | UIFontDescriptor.AttributeName.traits: traits 74 | ] 75 | 76 | let customFontDescriptor: UIFontDescriptor = UIFontDescriptor(fontAttributes: attributes) 77 | self.init(descriptor: customFontDescriptor, size: size) 78 | } 79 | else{ 80 | let systemFont = UIFont.systemFont(ofSize: size, weight: weight) 81 | let systemFontDescriptor: UIFontDescriptor = systemFont.fontDescriptor 82 | self.init(descriptor: systemFontDescriptor, size: size) 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /fbCharm/fbCharm.h: -------------------------------------------------------------------------------- 1 | // 2 | // fbCharm.h 3 | // fbCharm 4 | // 5 | // Created by pcjbird on 2018/12/15. 6 | // Copyright © 2018 Zero Status. All rights reserved. 7 | // 8 | // 框架名称:fbCharm 9 | // 框架功能:iOS 上利用 fallback 机制为不同语言的文字 (script) 设定字体,从而使得文本混排更为优雅。 10 | // 修改记录: 11 | // pcjbird 2019-01-06 Version:1.0.5 Build:201801060001 12 | // 1.支持 Objective-C 调用 13 | // 14 | // pcjbird 2018-12-18 Version:1.0.4 Build:201812180003 15 | // 1.更新Cocoapods上的logo 16 | // 17 | // pcjbird 2018-12-18 Version:1.0.3 Build:201812180002 18 | // 1.更新README.md 19 | // 20 | // pcjbird 2018-12-18 Version:1.0.2 Build:201812180001 21 | // 1.更新演示Demo 22 | // 23 | // pcjbird 2018-12-16 Version:1.0.1 Build:201812160001 24 | // 1.重新修改实现 25 | // 26 | // pcjbird 2018-12-15 Version:1.0.0 Build:201812150001 27 | // 1.首次发布SDK版本 28 | // 29 | 30 | #import 31 | 32 | //! Project version number for fbCharm. 33 | FOUNDATION_EXPORT double fbCharmVersionNumber; 34 | 35 | //! Project version string for fbCharm. 36 | FOUNDATION_EXPORT const unsigned char fbCharmVersionString[]; 37 | 38 | // In this header, you should import all the public headers of your framework using statements like #import 39 | 40 | 41 | -------------------------------------------------------------------------------- /fbCharmDemo/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | platform :ios, '8.0' 3 | 4 | workspace 'fbCharmDemo.xcworkspace' 5 | project 'fbCharmDemo.xcodeproj' 6 | 7 | target 'fbCharmDemo' do 8 | # Uncomment this line if you're using Swift or would like to use dynamic frameworks 9 | use_frameworks! 10 | 11 | # Pods for fbCharmDemo 12 | pod 'fbCharm' 13 | end 14 | -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4AD8C745C1BAAE2B69EABCE0 /* Pods_fbCharmDemo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 74734D28688EDC94A3CF1975 /* Pods_fbCharmDemo.framework */; }; 11 | 89EE17C021C55918005F2F56 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89EE17BF21C55918005F2F56 /* AppDelegate.swift */; }; 12 | 89EE17C221C55918005F2F56 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89EE17C121C55918005F2F56 /* ViewController.swift */; }; 13 | 89EE17C521C55918005F2F56 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 89EE17C321C55918005F2F56 /* Main.storyboard */; }; 14 | 89EE17C721C5591A005F2F56 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 89EE17C621C5591A005F2F56 /* Assets.xcassets */; }; 15 | 89EE17CA21C5591A005F2F56 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 89EE17C821C5591A005F2F56 /* LaunchScreen.storyboard */; }; 16 | 89EE17D321C55A04005F2F56 /* LucidaGrande.ttc in Resources */ = {isa = PBXBuildFile; fileRef = 89EE17D221C55A04005F2F56 /* LucidaGrande.ttc */; }; 17 | 89EE17D821C64917005F2F56 /* WawaSC-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = 89EE17D721C64917005F2F56 /* WawaSC-Regular.otf */; }; 18 | 89EE17DA21C6650E005F2F56 /* NextViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89EE17D921C6650E005F2F56 /* NextViewController.swift */; }; 19 | 89EE17DC21C666D3005F2F56 /* IBMPlexSans-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 89EE17DB21C666D3005F2F56 /* IBMPlexSans-Regular.ttf */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXFileReference section */ 23 | 74734D28688EDC94A3CF1975 /* Pods_fbCharmDemo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_fbCharmDemo.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | 89EE17BC21C55918005F2F56 /* fbCharmDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = fbCharmDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 25 | 89EE17BF21C55918005F2F56 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 26 | 89EE17C121C55918005F2F56 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 27 | 89EE17C421C55918005F2F56 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 28 | 89EE17C621C5591A005F2F56 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 29 | 89EE17C921C5591A005F2F56 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 30 | 89EE17CB21C5591A005F2F56 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 31 | 89EE17D221C55A04005F2F56 /* LucidaGrande.ttc */ = {isa = PBXFileReference; lastKnownFileType = file; path = LucidaGrande.ttc; sourceTree = ""; }; 32 | 89EE17D721C64917005F2F56 /* WawaSC-Regular.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "WawaSC-Regular.otf"; sourceTree = ""; }; 33 | 89EE17D921C6650E005F2F56 /* NextViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NextViewController.swift; sourceTree = ""; }; 34 | 89EE17DB21C666D3005F2F56 /* IBMPlexSans-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "IBMPlexSans-Regular.ttf"; sourceTree = ""; }; 35 | F73352CAC1DCF1D8A0EE1347 /* Pods-fbCharmDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-fbCharmDemo.release.xcconfig"; path = "Pods/Target Support Files/Pods-fbCharmDemo/Pods-fbCharmDemo.release.xcconfig"; sourceTree = ""; }; 36 | FABA77907F35669B1DA1DAE5 /* Pods-fbCharmDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-fbCharmDemo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-fbCharmDemo/Pods-fbCharmDemo.debug.xcconfig"; sourceTree = ""; }; 37 | /* End PBXFileReference section */ 38 | 39 | /* Begin PBXFrameworksBuildPhase section */ 40 | 89EE17B921C55918005F2F56 /* Frameworks */ = { 41 | isa = PBXFrameworksBuildPhase; 42 | buildActionMask = 2147483647; 43 | files = ( 44 | 4AD8C745C1BAAE2B69EABCE0 /* Pods_fbCharmDemo.framework in Frameworks */, 45 | ); 46 | runOnlyForDeploymentPostprocessing = 0; 47 | }; 48 | /* End PBXFrameworksBuildPhase section */ 49 | 50 | /* Begin PBXGroup section */ 51 | 83736632071B0FC44C29143C /* Pods */ = { 52 | isa = PBXGroup; 53 | children = ( 54 | FABA77907F35669B1DA1DAE5 /* Pods-fbCharmDemo.debug.xcconfig */, 55 | F73352CAC1DCF1D8A0EE1347 /* Pods-fbCharmDemo.release.xcconfig */, 56 | ); 57 | name = Pods; 58 | sourceTree = ""; 59 | }; 60 | 89EE17B321C55918005F2F56 = { 61 | isa = PBXGroup; 62 | children = ( 63 | 89EE17BE21C55918005F2F56 /* fbCharmDemo */, 64 | 89EE17BD21C55918005F2F56 /* Products */, 65 | 83736632071B0FC44C29143C /* Pods */, 66 | AA468704DB491F7D08DB9275 /* Frameworks */, 67 | ); 68 | sourceTree = ""; 69 | }; 70 | 89EE17BD21C55918005F2F56 /* Products */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 89EE17BC21C55918005F2F56 /* fbCharmDemo.app */, 74 | ); 75 | name = Products; 76 | sourceTree = ""; 77 | }; 78 | 89EE17BE21C55918005F2F56 /* fbCharmDemo */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 89EE17D121C55A04005F2F56 /* fonts */, 82 | 89EE17BF21C55918005F2F56 /* AppDelegate.swift */, 83 | 89EE17C121C55918005F2F56 /* ViewController.swift */, 84 | 89EE17D921C6650E005F2F56 /* NextViewController.swift */, 85 | 89EE17C321C55918005F2F56 /* Main.storyboard */, 86 | 89EE17C621C5591A005F2F56 /* Assets.xcassets */, 87 | 89EE17C821C5591A005F2F56 /* LaunchScreen.storyboard */, 88 | 89EE17CB21C5591A005F2F56 /* Info.plist */, 89 | ); 90 | path = fbCharmDemo; 91 | sourceTree = ""; 92 | }; 93 | 89EE17D121C55A04005F2F56 /* fonts */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 89EE17D721C64917005F2F56 /* WawaSC-Regular.otf */, 97 | 89EE17D221C55A04005F2F56 /* LucidaGrande.ttc */, 98 | 89EE17DB21C666D3005F2F56 /* IBMPlexSans-Regular.ttf */, 99 | ); 100 | path = fonts; 101 | sourceTree = ""; 102 | }; 103 | AA468704DB491F7D08DB9275 /* Frameworks */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | 74734D28688EDC94A3CF1975 /* Pods_fbCharmDemo.framework */, 107 | ); 108 | name = Frameworks; 109 | sourceTree = ""; 110 | }; 111 | /* End PBXGroup section */ 112 | 113 | /* Begin PBXNativeTarget section */ 114 | 89EE17BB21C55918005F2F56 /* fbCharmDemo */ = { 115 | isa = PBXNativeTarget; 116 | buildConfigurationList = 89EE17CE21C5591A005F2F56 /* Build configuration list for PBXNativeTarget "fbCharmDemo" */; 117 | buildPhases = ( 118 | 4E3A847F7C1D20A1207C21A2 /* [CP] Check Pods Manifest.lock */, 119 | 89EE17B821C55918005F2F56 /* Sources */, 120 | 89EE17B921C55918005F2F56 /* Frameworks */, 121 | 89EE17BA21C55918005F2F56 /* Resources */, 122 | E50148335EF4B21817505526 /* [CP] Embed Pods Frameworks */, 123 | ); 124 | buildRules = ( 125 | ); 126 | dependencies = ( 127 | ); 128 | name = fbCharmDemo; 129 | productName = fbCharmDemo; 130 | productReference = 89EE17BC21C55918005F2F56 /* fbCharmDemo.app */; 131 | productType = "com.apple.product-type.application"; 132 | }; 133 | /* End PBXNativeTarget section */ 134 | 135 | /* Begin PBXProject section */ 136 | 89EE17B421C55918005F2F56 /* Project object */ = { 137 | isa = PBXProject; 138 | attributes = { 139 | LastSwiftUpdateCheck = 1010; 140 | LastUpgradeCheck = 1010; 141 | ORGANIZATIONNAME = "Zero Status"; 142 | TargetAttributes = { 143 | 89EE17BB21C55918005F2F56 = { 144 | CreatedOnToolsVersion = 10.1; 145 | }; 146 | }; 147 | }; 148 | buildConfigurationList = 89EE17B721C55918005F2F56 /* Build configuration list for PBXProject "fbCharmDemo" */; 149 | compatibilityVersion = "Xcode 9.3"; 150 | developmentRegion = en; 151 | hasScannedForEncodings = 0; 152 | knownRegions = ( 153 | en, 154 | Base, 155 | ); 156 | mainGroup = 89EE17B321C55918005F2F56; 157 | productRefGroup = 89EE17BD21C55918005F2F56 /* Products */; 158 | projectDirPath = ""; 159 | projectRoot = ""; 160 | targets = ( 161 | 89EE17BB21C55918005F2F56 /* fbCharmDemo */, 162 | ); 163 | }; 164 | /* End PBXProject section */ 165 | 166 | /* Begin PBXResourcesBuildPhase section */ 167 | 89EE17BA21C55918005F2F56 /* Resources */ = { 168 | isa = PBXResourcesBuildPhase; 169 | buildActionMask = 2147483647; 170 | files = ( 171 | 89EE17D321C55A04005F2F56 /* LucidaGrande.ttc in Resources */, 172 | 89EE17CA21C5591A005F2F56 /* LaunchScreen.storyboard in Resources */, 173 | 89EE17C721C5591A005F2F56 /* Assets.xcassets in Resources */, 174 | 89EE17D821C64917005F2F56 /* WawaSC-Regular.otf in Resources */, 175 | 89EE17DC21C666D3005F2F56 /* IBMPlexSans-Regular.ttf in Resources */, 176 | 89EE17C521C55918005F2F56 /* Main.storyboard in Resources */, 177 | ); 178 | runOnlyForDeploymentPostprocessing = 0; 179 | }; 180 | /* End PBXResourcesBuildPhase section */ 181 | 182 | /* Begin PBXShellScriptBuildPhase section */ 183 | 4E3A847F7C1D20A1207C21A2 /* [CP] Check Pods Manifest.lock */ = { 184 | isa = PBXShellScriptBuildPhase; 185 | buildActionMask = 2147483647; 186 | files = ( 187 | ); 188 | inputPaths = ( 189 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 190 | "${PODS_ROOT}/Manifest.lock", 191 | ); 192 | name = "[CP] Check Pods Manifest.lock"; 193 | outputPaths = ( 194 | "$(DERIVED_FILE_DIR)/Pods-fbCharmDemo-checkManifestLockResult.txt", 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | shellPath = /bin/sh; 198 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 199 | showEnvVarsInLog = 0; 200 | }; 201 | E50148335EF4B21817505526 /* [CP] Embed Pods Frameworks */ = { 202 | isa = PBXShellScriptBuildPhase; 203 | buildActionMask = 2147483647; 204 | files = ( 205 | ); 206 | inputPaths = ( 207 | "${SRCROOT}/Pods/Target Support Files/Pods-fbCharmDemo/Pods-fbCharmDemo-frameworks.sh", 208 | "${BUILT_PRODUCTS_DIR}/fbCharm/fbCharm.framework", 209 | ); 210 | name = "[CP] Embed Pods Frameworks"; 211 | outputPaths = ( 212 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/fbCharm.framework", 213 | ); 214 | runOnlyForDeploymentPostprocessing = 0; 215 | shellPath = /bin/sh; 216 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-fbCharmDemo/Pods-fbCharmDemo-frameworks.sh\"\n"; 217 | showEnvVarsInLog = 0; 218 | }; 219 | /* End PBXShellScriptBuildPhase section */ 220 | 221 | /* Begin PBXSourcesBuildPhase section */ 222 | 89EE17B821C55918005F2F56 /* Sources */ = { 223 | isa = PBXSourcesBuildPhase; 224 | buildActionMask = 2147483647; 225 | files = ( 226 | 89EE17C221C55918005F2F56 /* ViewController.swift in Sources */, 227 | 89EE17DA21C6650E005F2F56 /* NextViewController.swift in Sources */, 228 | 89EE17C021C55918005F2F56 /* AppDelegate.swift in Sources */, 229 | ); 230 | runOnlyForDeploymentPostprocessing = 0; 231 | }; 232 | /* End PBXSourcesBuildPhase section */ 233 | 234 | /* Begin PBXVariantGroup section */ 235 | 89EE17C321C55918005F2F56 /* Main.storyboard */ = { 236 | isa = PBXVariantGroup; 237 | children = ( 238 | 89EE17C421C55918005F2F56 /* Base */, 239 | ); 240 | name = Main.storyboard; 241 | sourceTree = ""; 242 | }; 243 | 89EE17C821C5591A005F2F56 /* LaunchScreen.storyboard */ = { 244 | isa = PBXVariantGroup; 245 | children = ( 246 | 89EE17C921C5591A005F2F56 /* Base */, 247 | ); 248 | name = LaunchScreen.storyboard; 249 | sourceTree = ""; 250 | }; 251 | /* End PBXVariantGroup section */ 252 | 253 | /* Begin XCBuildConfiguration section */ 254 | 89EE17CC21C5591A005F2F56 /* Debug */ = { 255 | isa = XCBuildConfiguration; 256 | buildSettings = { 257 | ALWAYS_SEARCH_USER_PATHS = NO; 258 | CLANG_ANALYZER_NONNULL = YES; 259 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 260 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 261 | CLANG_CXX_LIBRARY = "libc++"; 262 | CLANG_ENABLE_MODULES = YES; 263 | CLANG_ENABLE_OBJC_ARC = YES; 264 | CLANG_ENABLE_OBJC_WEAK = YES; 265 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 266 | CLANG_WARN_BOOL_CONVERSION = YES; 267 | CLANG_WARN_COMMA = YES; 268 | CLANG_WARN_CONSTANT_CONVERSION = YES; 269 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 270 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 271 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 272 | CLANG_WARN_EMPTY_BODY = YES; 273 | CLANG_WARN_ENUM_CONVERSION = YES; 274 | CLANG_WARN_INFINITE_RECURSION = YES; 275 | CLANG_WARN_INT_CONVERSION = YES; 276 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 277 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 278 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 279 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 280 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 281 | CLANG_WARN_STRICT_PROTOTYPES = YES; 282 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 283 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 284 | CLANG_WARN_UNREACHABLE_CODE = YES; 285 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 286 | CODE_SIGN_IDENTITY = "iPhone Developer"; 287 | COPY_PHASE_STRIP = NO; 288 | DEBUG_INFORMATION_FORMAT = dwarf; 289 | ENABLE_STRICT_OBJC_MSGSEND = YES; 290 | ENABLE_TESTABILITY = YES; 291 | GCC_C_LANGUAGE_STANDARD = gnu11; 292 | GCC_DYNAMIC_NO_PIC = NO; 293 | GCC_NO_COMMON_BLOCKS = YES; 294 | GCC_OPTIMIZATION_LEVEL = 0; 295 | GCC_PREPROCESSOR_DEFINITIONS = ( 296 | "DEBUG=1", 297 | "$(inherited)", 298 | ); 299 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 300 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 301 | GCC_WARN_UNDECLARED_SELECTOR = YES; 302 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 303 | GCC_WARN_UNUSED_FUNCTION = YES; 304 | GCC_WARN_UNUSED_VARIABLE = YES; 305 | IPHONEOS_DEPLOYMENT_TARGET = 12.1; 306 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 307 | MTL_FAST_MATH = YES; 308 | ONLY_ACTIVE_ARCH = YES; 309 | SDKROOT = iphoneos; 310 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 311 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 312 | }; 313 | name = Debug; 314 | }; 315 | 89EE17CD21C5591A005F2F56 /* Release */ = { 316 | isa = XCBuildConfiguration; 317 | buildSettings = { 318 | ALWAYS_SEARCH_USER_PATHS = NO; 319 | CLANG_ANALYZER_NONNULL = YES; 320 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 321 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 322 | CLANG_CXX_LIBRARY = "libc++"; 323 | CLANG_ENABLE_MODULES = YES; 324 | CLANG_ENABLE_OBJC_ARC = YES; 325 | CLANG_ENABLE_OBJC_WEAK = YES; 326 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 327 | CLANG_WARN_BOOL_CONVERSION = YES; 328 | CLANG_WARN_COMMA = YES; 329 | CLANG_WARN_CONSTANT_CONVERSION = YES; 330 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 331 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 332 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 333 | CLANG_WARN_EMPTY_BODY = YES; 334 | CLANG_WARN_ENUM_CONVERSION = YES; 335 | CLANG_WARN_INFINITE_RECURSION = YES; 336 | CLANG_WARN_INT_CONVERSION = YES; 337 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 338 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 339 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 340 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 341 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 342 | CLANG_WARN_STRICT_PROTOTYPES = YES; 343 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 344 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 345 | CLANG_WARN_UNREACHABLE_CODE = YES; 346 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 347 | CODE_SIGN_IDENTITY = "iPhone Developer"; 348 | COPY_PHASE_STRIP = NO; 349 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 350 | ENABLE_NS_ASSERTIONS = NO; 351 | ENABLE_STRICT_OBJC_MSGSEND = YES; 352 | GCC_C_LANGUAGE_STANDARD = gnu11; 353 | GCC_NO_COMMON_BLOCKS = YES; 354 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 355 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 356 | GCC_WARN_UNDECLARED_SELECTOR = YES; 357 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 358 | GCC_WARN_UNUSED_FUNCTION = YES; 359 | GCC_WARN_UNUSED_VARIABLE = YES; 360 | IPHONEOS_DEPLOYMENT_TARGET = 12.1; 361 | MTL_ENABLE_DEBUG_INFO = NO; 362 | MTL_FAST_MATH = YES; 363 | SDKROOT = iphoneos; 364 | SWIFT_COMPILATION_MODE = wholemodule; 365 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 366 | VALIDATE_PRODUCT = YES; 367 | }; 368 | name = Release; 369 | }; 370 | 89EE17CF21C5591A005F2F56 /* Debug */ = { 371 | isa = XCBuildConfiguration; 372 | baseConfigurationReference = FABA77907F35669B1DA1DAE5 /* Pods-fbCharmDemo.debug.xcconfig */; 373 | buildSettings = { 374 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 375 | CODE_SIGN_STYLE = Automatic; 376 | INFOPLIST_FILE = fbCharmDemo/Info.plist; 377 | LD_RUNPATH_SEARCH_PATHS = ( 378 | "$(inherited)", 379 | "@executable_path/Frameworks", 380 | ); 381 | PRODUCT_BUNDLE_IDENTIFIER = com.lessney.fbCharmDemo; 382 | PRODUCT_NAME = "$(TARGET_NAME)"; 383 | SWIFT_VERSION = 4.2; 384 | TARGETED_DEVICE_FAMILY = "1,2"; 385 | }; 386 | name = Debug; 387 | }; 388 | 89EE17D021C5591A005F2F56 /* Release */ = { 389 | isa = XCBuildConfiguration; 390 | baseConfigurationReference = F73352CAC1DCF1D8A0EE1347 /* Pods-fbCharmDemo.release.xcconfig */; 391 | buildSettings = { 392 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 393 | CODE_SIGN_STYLE = Automatic; 394 | INFOPLIST_FILE = fbCharmDemo/Info.plist; 395 | LD_RUNPATH_SEARCH_PATHS = ( 396 | "$(inherited)", 397 | "@executable_path/Frameworks", 398 | ); 399 | PRODUCT_BUNDLE_IDENTIFIER = com.lessney.fbCharmDemo; 400 | PRODUCT_NAME = "$(TARGET_NAME)"; 401 | SWIFT_VERSION = 4.2; 402 | TARGETED_DEVICE_FAMILY = "1,2"; 403 | }; 404 | name = Release; 405 | }; 406 | /* End XCBuildConfiguration section */ 407 | 408 | /* Begin XCConfigurationList section */ 409 | 89EE17B721C55918005F2F56 /* Build configuration list for PBXProject "fbCharmDemo" */ = { 410 | isa = XCConfigurationList; 411 | buildConfigurations = ( 412 | 89EE17CC21C5591A005F2F56 /* Debug */, 413 | 89EE17CD21C5591A005F2F56 /* Release */, 414 | ); 415 | defaultConfigurationIsVisible = 0; 416 | defaultConfigurationName = Release; 417 | }; 418 | 89EE17CE21C5591A005F2F56 /* Build configuration list for PBXNativeTarget "fbCharmDemo" */ = { 419 | isa = XCConfigurationList; 420 | buildConfigurations = ( 421 | 89EE17CF21C5591A005F2F56 /* Debug */, 422 | 89EE17D021C5591A005F2F56 /* Release */, 423 | ); 424 | defaultConfigurationIsVisible = 0; 425 | defaultConfigurationName = Release; 426 | }; 427 | /* End XCConfigurationList section */ 428 | }; 429 | rootObject = 89EE17B421C55918005F2F56 /* Project object */; 430 | } 431 | -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // fbCharmDemo 4 | // 5 | // Created by pcjbird on 2018/12/15. 6 | // Copyright © 2018 Zero Status. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // 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. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // 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. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/App Store-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/App Store-1024.png -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/CarPlay-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/CarPlay-60@2x.png -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/CarPlay-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/CarPlay-60@3x.png -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | {"images":[{"size":"20x20","idiom":"iphone","filename":"iPhone Notification-20@2x.png","scale":"2x"},{"size":"20x20","idiom":"iphone","filename":"iPhone Notification-20@3x.png","scale":"3x"},{"size":"29x29","idiom":"iphone","filename":"iPhone Settings-29@2x.png","scale":"2x"},{"size":"29x29","idiom":"iphone","filename":"iPhone Settings-29@3x.png","scale":"3x"},{"size":"40x40","idiom":"iphone","filename":"iPhone Spotlight-40@2x.png","scale":"2x"},{"size":"40x40","idiom":"iphone","filename":"iPhone Spotlight-40@3x.png","scale":"3x"},{"size":"60x60","idiom":"iphone","filename":"iPhone App-60@2x.png","scale":"2x"},{"size":"60x60","idiom":"iphone","filename":"iPhone App-60@3x.png","scale":"3x"},{"size":"20x20","idiom":"ipad","filename":"iPad Notifications-20.png","scale":"1x"},{"size":"20x20","idiom":"ipad","filename":"iPad Notifications-20@2x.png","scale":"2x"},{"size":"29x29","idiom":"ipad","filename":"iPad Settings-29.png","scale":"1x"},{"size":"29x29","idiom":"ipad","filename":"iPad Settings-29@2x.png","scale":"2x"},{"size":"40x40","idiom":"ipad","filename":"iPad Spotlight-40.png","scale":"1x"},{"size":"40x40","idiom":"ipad","filename":"iPad Spotlight-40@2x.png","scale":"2x"},{"size":"76x76","idiom":"ipad","filename":"iPad App-76.png","scale":"1x"},{"size":"76x76","idiom":"ipad","filename":"iPad App-76@2x.png","scale":"2x"},{"size":"83.5x83.5","idiom":"ipad","filename":"iPad Pro App-83.5@2x.png","scale":"2x"},{"size":"60x60","idiom":"car","filename":"CarPlay-60@2x.png","scale":"2x"},{"size":"60x60","idiom":"car","filename":"CarPlay-60@3x.png","scale":"3x"},{"size":"1024x1024","idiom":"ios-marketing","filename":"App Store-1024.png","scale":"1x"}],"info":{"version":1,"author":"xcode"}} -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPad App-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPad App-76.png -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPad App-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPad App-76@2x.png -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPad Notifications-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPad Notifications-20.png -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPad Notifications-20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPad Notifications-20@2x.png -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPad Pro App-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPad Pro App-83.5@2x.png -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPad Settings-29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPad Settings-29.png -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPad Settings-29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPad Settings-29@2x.png -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPad Spotlight-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPad Spotlight-40.png -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPad Spotlight-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPad Spotlight-40@2x.png -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPhone App-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPhone App-60@2x.png -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPhone App-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPhone App-60@3x.png -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPhone Notification-20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPhone Notification-20@2x.png -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPhone Notification-20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPhone Notification-20@3x.png -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPhone Settings-29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPhone Settings-29@2x.png -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPhone Settings-29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPhone Settings-29@3x.png -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPhone Spotlight-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPhone Spotlight-40@2x.png -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPhone Spotlight-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/fbCharmDemo/fbCharmDemo/Assets.xcassets/AppIcon.appiconset/iPhone Spotlight-40@3x.png -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/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 | -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | IBMPlexSans 15 | 16 | 17 | LucidaGrande 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 35 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 109 | 116 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 166 | 174 | 182 | 189 | 197 | 205 | 212 | 219 | 226 | 233 | 240 | 247 | 254 | 261 | 268 | 275 | 283 | 290 | 297 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | fallback 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0.0 21 | CFBundleVersion 22 | 201812160001 23 | LSRequiresIPhoneOS 24 | 25 | UIAppFonts 26 | 27 | LucidaGrande.ttc 28 | WawaSC-Regular.otf 29 | IBMPlexSans-Regular.ttf 30 | 31 | UILaunchStoryboardName 32 | LaunchScreen 33 | UIMainStoryboardFile 34 | Main 35 | UIRequiredDeviceCapabilities 36 | 37 | armv7 38 | 39 | UISupportedInterfaceOrientations 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationLandscapeLeft 43 | UIInterfaceOrientationLandscapeRight 44 | 45 | UISupportedInterfaceOrientations~ipad 46 | 47 | UIInterfaceOrientationPortrait 48 | UIInterfaceOrientationPortraitUpsideDown 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/NextViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NextViewController.swift 3 | // fbCharmDemo 4 | // 5 | // Created by pcjbird on 2018/12/16. 6 | // Copyright © 2018 Zero Status. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class NextViewController: UIViewController { 12 | 13 | @IBOutlet weak var label1: UILabel! 14 | @IBOutlet weak var label2: UILabel! 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | 19 | self.label1.font = UIFont.init(families: ["IBM Plex Sans", "Wawati SC"], size: 24, weight: .regular) 20 | self.label2.font = UIFont.init(families: [UIFont.systemFont(ofSize: 24).familyName, "Lucida Grande"], size: 24, weight: .regular) 21 | } 22 | 23 | 24 | @IBAction func OnCloseBtnClick(_ sender: Any) { 25 | self.dismiss(animated: true, completion: nil) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // fbCharmDemo 4 | // 5 | // Created by pcjbird on 2018/12/15. 6 | // Copyright © 2018 Zero Status. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import fbCharm 11 | 12 | class ViewController: UIViewController { 13 | 14 | @IBOutlet weak var label: UILabel! 15 | @IBOutlet weak var fallbackSwitch: UISwitch! 16 | @IBOutlet weak var paragraphSwitch: UISwitch! 17 | @IBOutlet weak var kernSwitch: UISwitch! 18 | @IBOutlet weak var fontweightSwitch: UISwitch! 19 | @IBOutlet weak var jpSwitch: UISwitch! 20 | 21 | override func viewDidLoad() { 22 | super.viewDidLoad() 23 | // Do any additional setup after loading the view, typically from a nib. 24 | self.updateText() 25 | } 26 | 27 | 28 | @IBAction func OnFallbackChanged(_ sender: Any) { 29 | self.updateText() 30 | } 31 | 32 | 33 | @IBAction func OnParagrahChanged(_ sender: Any) { 34 | if !paragraphSwitch.isOn { 35 | kernSwitch.isOn = false 36 | kernSwitch.isEnabled = false 37 | jpSwitch.isOn = false 38 | jpSwitch.isEnabled = false 39 | } 40 | else{ 41 | kernSwitch.isEnabled = true 42 | jpSwitch.isEnabled = true 43 | } 44 | self.updateText() 45 | } 46 | 47 | @IBAction func OnKernChanged(_ sender: Any) { 48 | self.updateText() 49 | } 50 | 51 | @IBAction func OnFontWeightChanged(_ sender: Any) { 52 | self.updateText() 53 | } 54 | 55 | @IBAction func OnFallbackToJPChanged(_ sender: Any) { 56 | self.updateText() 57 | } 58 | 59 | func updateText() { 60 | let text = "これは日本語文章と Roman Text の混植文章です。美しいヒラギノと San Francisco で日本語とローマ字を書きます。System Font のフォントメトリクスには独自の調整が入っています。\n\n这是一段中文简体。\n這是一段中文繁體。\nうつくしい森で飾られたモーリオ市、\n郊外のぎらぎらひかる草の波。\n祇辻飴葛蛸鯖鰯噌庖箸\n底辺直卿蝕薩化\nABCDEFGHIJKLM\nabcdefghijklm\n1234567890\niClockᴹᴵᴺᴵ\nClockª" 61 | let fontSize: CGFloat = 18.0 62 | 63 | let bHeavy = fontweightSwitch.isOn 64 | let bParagragh = paragraphSwitch.isOn 65 | let bKern = kernSwitch.isOn 66 | let bFallback = fallbackSwitch.isOn 67 | let bJPFallback = jpSwitch.isOn 68 | 69 | let paragraphStyle: NSMutableParagraphStyle = NSMutableParagraphStyle() 70 | paragraphStyle.alignment = .justified 71 | paragraphStyle.minimumLineHeight = fontSize * 1.5 72 | paragraphStyle.maximumLineHeight = paragraphStyle.minimumLineHeight 73 | self.label.attributedText = NSMutableAttributedString(string: "") 74 | if !bFallback { 75 | if !bParagragh { 76 | self.label.font = UIFont(families: [], size: fontSize, weight: bHeavy ? .heavy : .regular) 77 | self.label.text = text 78 | } 79 | else{ 80 | self.label.attributedText = NSMutableAttributedString(text: text, families: [], size: fontSize, weight: bHeavy ? .heavy : .regular, kern: bKern ? 4.0 : 0.0, paragraphStyle:paragraphStyle) 81 | } 82 | } 83 | else { 84 | if !bParagragh { 85 | self.label.font = UIFont(families: ["Lucida Grande", "Baskerville", "Apple SD Gothic Neo", "Wawati SC"], size: fontSize, weight: bHeavy ? .heavy : .regular) 86 | self.label.text = text 87 | } 88 | else{ 89 | self.label.attributedText = NSMutableAttributedString(text: text, families: ["Lucida Grande", "Baskerville", "Apple SD Gothic Neo", "Wawati SC"], size: fontSize, weight: bHeavy ? .heavy : .regular, kern: bKern ? 4.0 : 0.0, paragraphStyle:paragraphStyle, fallback: bJPFallback ? "jp" : nil) 90 | 91 | } 92 | } 93 | } 94 | } 95 | 96 | -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/fonts/IBMPlexSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/fbCharmDemo/fbCharmDemo/fonts/IBMPlexSans-Regular.ttf -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/fonts/LucidaGrande.ttc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/fbCharmDemo/fbCharmDemo/fonts/LucidaGrande.ttc -------------------------------------------------------------------------------- /fbCharmDemo/fbCharmDemo/fonts/WawaSC-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/fbCharmDemo/fbCharmDemo/fonts/WawaSC-Regular.otf -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcjbird/fbCharm/8b3dc4f5e75acae4795cac1914d901a9abb6b289/logo.png --------------------------------------------------------------------------------