Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

[iOS] Simplify dynamically loading fonts

Saúl Ibarra Corretgé9407f562f6d7
diff --git a/ios/sdk/sdk.xcodeproj/project.pbxproj b/ios/sdk/sdk.xcodeproj/project.pbxproj
index 1aa5def589..7659543270 100644
--- a/ios/sdk/sdk.xcodeproj/project.pbxproj
+++ b/ios/sdk/sdk.xcodeproj/project.pbxproj
@@ -14,7 +14,6 @@
0B49424520AD8DBD00BD2DE0 /* outgoingStart.wav in Resources */ = {isa = PBXBuildFile; fileRef = 0B49424320AD8DBD00BD2DE0 /* outgoingStart.wav */; };
0B49424620AD8DBD00BD2DE0 /* outgoingRinging.wav in Resources */ = {isa = PBXBuildFile; fileRef = 0B49424420AD8DBD00BD2DE0 /* outgoingRinging.wav */; };
0B7C2CFD200F51D60060D076 /* LaunchOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B7C2CFC200F51D60060D076 /* LaunchOptions.m */; };
- 0B93EF7B1EC608550030D24D /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0B93EF7A1EC608550030D24D /* CoreText.framework */; };
0B93EF7E1EC9DDCD0030D24D /* RCTBridgeWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 0B93EF7C1EC9DDCD0030D24D /* RCTBridgeWrapper.h */; };
0B93EF7F1EC9DDCD0030D24D /* RCTBridgeWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B93EF7D1EC9DDCD0030D24D /* RCTBridgeWrapper.m */; };
0BA13D311EE83FF8007BEF7F /* ExternalAPI.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BA13D301EE83FF8007BEF7F /* ExternalAPI.m */; };
@@ -114,7 +113,6 @@
files = (
0BB9AD791F5EC6D7001C08DB /* Intents.framework in Frameworks */,
0BB9AD771F5EC6CE001C08DB /* CallKit.framework in Frameworks */,
- 0B93EF7B1EC608550030D24D /* CoreText.framework in Frameworks */,
0F65EECE1D95DA94561BB47E /* libPods-JitsiMeet.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
diff --git a/ios/sdk/src/Info.plist b/ios/sdk/src/Info.plist
index 0b9c0fb0f6..b534be789e 100644
--- a/ios/sdk/src/Info.plist
+++ b/ios/sdk/src/Info.plist
@@ -18,10 +18,6 @@
<string>1.9.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
- <key>JitsiMeetFonts</key>
- <array>
- <string>jitsi.ttf</string>
- </array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>dbapi-2</string>
diff --git a/ios/sdk/src/JitsiMeetView.m b/ios/sdk/src/JitsiMeetView.m
index 75f05932d6..0799ef0cbe 100644
--- a/ios/sdk/src/JitsiMeetView.m
+++ b/ios/sdk/src/JitsiMeetView.m
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-#import <CoreText/CoreText.h>
#import <Intents/Intents.h>
#include <mach/mach_time.h>
@@ -53,35 +52,6 @@ RCTFatalHandler _RCTFatal = ^(NSError *error) {
}
};
-/**
- * Helper function to dynamically load custom fonts. The `UIAppFonts` key in the
- * plist file doesn't work for frameworks, so fonts have to be manually loaded.
- */
-void loadCustomFonts(Class clazz) {
- NSBundle *bundle = [NSBundle bundleForClass:clazz];
- NSArray *fonts = [bundle objectForInfoDictionaryKey:@"JitsiMeetFonts"];
-
- for (NSString *item in fonts) {
- NSString *fontName = [item stringByDeletingPathExtension];
- NSString *fontExt = [item pathExtension];
- NSString *fontPath = [bundle pathForResource:fontName ofType:fontExt];
- NSData *inData = [NSData dataWithContentsOfFile:fontPath];
- CFErrorRef error;
- CGDataProviderRef provider
- = CGDataProviderCreateWithCFData((__bridge CFDataRef)inData);
- CGFontRef font = CGFontCreateWithDataProvider(provider);
-
- if (!CTFontManagerRegisterGraphicsFont(font, &error)) {
- CFStringRef errorDescription = CFErrorCopyDescription(error);
-
- NSLog(@"Failed to load font: %@", errorDescription);
- CFRelease(errorDescription);
- }
- CFRelease(font);
- CFRelease(provider);
- }
-}
-
/**
* Helper function to register a fatal error handler for React. Our handler
* won't kill the process, it will swallow JS errors and print stack traces
@@ -410,9 +380,6 @@ static NSMapTable<NSString *, JitsiMeetView *> *views;
= [[RCTBridgeWrapper alloc] initWithLaunchOptions:_launchOptions];
views = [NSMapTable strongToWeakObjectsMapTable];
- // Dynamically load custom bundled fonts.
- loadCustomFonts(self.class);
-
// Register a fatal error handler for React.
registerFatalErrorHandler();
});
diff --git a/react/features/base/font-icons/Icon.js b/react/features/base/font-icons/Icon.js
index 622b4a4336..85a561fac3 100644
--- a/react/features/base/font-icons/Icon.js
+++ b/react/features/base/font-icons/Icon.js
@@ -1,3 +1,5 @@
+import { Platform } from 'react-native';
+
// FIXME The import of react-native-vector-icons makes the file native-specific
// but the file's name and/or location (within the directory structure) don't
// reflect that, it suggests the file is platform-independent.
@@ -10,3 +12,8 @@ import icoMoonConfig from './jitsi.json';
* Creates the Jitsi icon set from the ico moon project config file.
*/
export const Icon = createIconSetFromIcoMoon(icoMoonConfig);
+
+// Dynamically load font on iOS
+if (Platform.OS === 'ios') {
+ Icon.loadFont('jitsi.ttf');
+}