ソースを参照

[iOS] Simplify dynamically loading fonts

master
Saúl Ibarra Corretgé 6年前
コミット
9407f562f6

+ 0
- 2
ios/sdk/sdk.xcodeproj/project.pbxproj ファイルの表示

@@ -14,7 +14,6 @@
14 14
 		0B49424520AD8DBD00BD2DE0 /* outgoingStart.wav in Resources */ = {isa = PBXBuildFile; fileRef = 0B49424320AD8DBD00BD2DE0 /* outgoingStart.wav */; };
15 15
 		0B49424620AD8DBD00BD2DE0 /* outgoingRinging.wav in Resources */ = {isa = PBXBuildFile; fileRef = 0B49424420AD8DBD00BD2DE0 /* outgoingRinging.wav */; };
16 16
 		0B7C2CFD200F51D60060D076 /* LaunchOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B7C2CFC200F51D60060D076 /* LaunchOptions.m */; };
17
-		0B93EF7B1EC608550030D24D /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0B93EF7A1EC608550030D24D /* CoreText.framework */; };
18 17
 		0B93EF7E1EC9DDCD0030D24D /* RCTBridgeWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 0B93EF7C1EC9DDCD0030D24D /* RCTBridgeWrapper.h */; };
19 18
 		0B93EF7F1EC9DDCD0030D24D /* RCTBridgeWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B93EF7D1EC9DDCD0030D24D /* RCTBridgeWrapper.m */; };
20 19
 		0BA13D311EE83FF8007BEF7F /* ExternalAPI.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BA13D301EE83FF8007BEF7F /* ExternalAPI.m */; };
@@ -114,7 +113,6 @@
114 113
 			files = (
115 114
 				0BB9AD791F5EC6D7001C08DB /* Intents.framework in Frameworks */,
116 115
 				0BB9AD771F5EC6CE001C08DB /* CallKit.framework in Frameworks */,
117
-				0B93EF7B1EC608550030D24D /* CoreText.framework in Frameworks */,
118 116
 				0F65EECE1D95DA94561BB47E /* libPods-JitsiMeet.a in Frameworks */,
119 117
 			);
120 118
 			runOnlyForDeploymentPostprocessing = 0;

+ 0
- 4
ios/sdk/src/Info.plist ファイルの表示

@@ -18,10 +18,6 @@
18 18
 	<string>1.9.0</string>
19 19
 	<key>CFBundleVersion</key>
20 20
 	<string>$(CURRENT_PROJECT_VERSION)</string>
21
-	<key>JitsiMeetFonts</key>
22
-	<array>
23
-		<string>jitsi.ttf</string>
24
-	</array>
25 21
 	<key>LSApplicationQueriesSchemes</key>
26 22
 	<array>
27 23
 		<string>dbapi-2</string>

+ 0
- 33
ios/sdk/src/JitsiMeetView.m ファイルの表示

@@ -14,7 +14,6 @@
14 14
  * limitations under the License.
15 15
  */
16 16
 
17
-#import <CoreText/CoreText.h>
18 17
 #import <Intents/Intents.h>
19 18
 
20 19
 #include <mach/mach_time.h>
@@ -53,35 +52,6 @@ RCTFatalHandler _RCTFatal = ^(NSError *error) {
53 52
     }
54 53
 };
55 54
 
56
-/**
57
- * Helper function to dynamically load custom fonts. The `UIAppFonts` key in the
58
- * plist file doesn't work for frameworks, so fonts have to be manually loaded.
59
- */
60
-void loadCustomFonts(Class clazz) {
61
-    NSBundle *bundle = [NSBundle bundleForClass:clazz];
62
-    NSArray *fonts = [bundle objectForInfoDictionaryKey:@"JitsiMeetFonts"];
63
-
64
-    for (NSString *item in fonts) {
65
-        NSString *fontName = [item stringByDeletingPathExtension];
66
-        NSString *fontExt = [item pathExtension];
67
-        NSString *fontPath = [bundle pathForResource:fontName ofType:fontExt];
68
-        NSData *inData = [NSData dataWithContentsOfFile:fontPath];
69
-        CFErrorRef error;
70
-        CGDataProviderRef provider
71
-            = CGDataProviderCreateWithCFData((__bridge CFDataRef)inData);
72
-        CGFontRef font = CGFontCreateWithDataProvider(provider);
73
-
74
-        if (!CTFontManagerRegisterGraphicsFont(font, &error)) {
75
-            CFStringRef errorDescription = CFErrorCopyDescription(error);
76
-
77
-            NSLog(@"Failed to load font: %@", errorDescription);
78
-            CFRelease(errorDescription);
79
-        }
80
-        CFRelease(font);
81
-        CFRelease(provider);
82
-    }
83
-}
84
-
85 55
 /**
86 56
  * Helper function to register a fatal error handler for React. Our handler
87 57
  * won't kill the process, it will swallow JS errors and print stack traces
@@ -410,9 +380,6 @@ static NSMapTable<NSString *, JitsiMeetView *> *views;
410 380
             = [[RCTBridgeWrapper alloc] initWithLaunchOptions:_launchOptions];
411 381
         views = [NSMapTable strongToWeakObjectsMapTable];
412 382
 
413
-        // Dynamically load custom bundled fonts.
414
-        loadCustomFonts(self.class);
415
-
416 383
         // Register a fatal error handler for React.
417 384
         registerFatalErrorHandler();
418 385
     });

+ 7
- 0
react/features/base/font-icons/Icon.js ファイルの表示

@@ -1,3 +1,5 @@
1
+import { Platform } from 'react-native';
2
+
1 3
 // FIXME The import of react-native-vector-icons makes the file native-specific
2 4
 // but the file's name and/or location (within the directory structure) don't
3 5
 // reflect that, it suggests the file is platform-independent.
@@ -10,3 +12,8 @@ import icoMoonConfig from './jitsi.json';
10 12
  * Creates the Jitsi icon set from the ico moon project config file.
11 13
  */
12 14
 export const Icon = createIconSetFromIcoMoon(icoMoonConfig);
15
+
16
+// Dynamically load font on iOS
17
+if (Platform.OS === 'ios') {
18
+    Icon.loadFont('jitsi.ttf');
19
+}

読み込み中…
キャンセル
保存