Skip to content

Latest commit

 

History

History
35 lines (24 loc) · 938 Bytes

File metadata and controls

35 lines (24 loc) · 938 Bytes

React Native:

link

With Expo-font:

installation

update expo-font/ios/EXFont/EXFontLoader.m

 UM_EXPORT_METHOD_AS(loadAsync,
                    loadAsyncWithFontFamilyName:(NSString *)fontFamilyName
                    withLocalUri:(NSString *)path
                    resolver:(UMPromiseResolveBlock)resolve
                    rejecter:(UMPromiseRejectBlock)reject)
{
    
    ...


   + CFErrorRef error;
   + if (! CTFontManagerRegisterGraphicsFont(font, &error)) {
   +     reject(@"E_FONT_CREATION_FAILED",
   +            [NSString stringWithFormat:@"Could not create font from loaded data for '%@'", fontFamilyName],
               nil);
    +       return;
    +}

  [_manager setFont:[[EXFont alloc] initWithCGFont:font] forName:fontFamilyName];
  resolve(nil);
}