Browse Source

【字体】找不到字体crash修复

lizhe 2 years ago
parent
commit
6178ac86a8
1 changed files with 4 additions and 4 deletions
  1. 4 4
      PDF Office/PDF Office/Source/Font/NSFont+SFProText.swift

+ 4 - 4
PDF Office/PDF Office/Source/Font/NSFont+SFProText.swift

@@ -7,11 +7,11 @@
 
 import Foundation
 extension NSFont {
-    static func SFProTextRegular(_ size: CGFloat) -> NSFont{
-        return NSFont(name: "SFProText-Regular", size: max(1, size))!
+    static func SFProTextRegular(_ size: CGFloat) -> NSFont? {
+        return NSFont(name: "SFProText-Regular", size: max(1, size))
     }
     
-    static func SFProTextSemibold(_ size: CGFloat) -> NSFont{
-        return NSFont(name: "SFProText-Semibold", size: max(1, size))!
+    static func SFProTextSemibold(_ size: CGFloat) -> NSFont? {
+        return NSFont(name: "SFProText-Semibold", size: max(1, size))
     }
 }