From af9b47466c03c862463b525f16cca386c96bbf45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=B0=9A=E6=98=86?= Date: Thu, 3 Mar 2022 17:07:51 +0800 Subject: [PATCH] [UIFont familyNames] before CGFontCreateWithDataProvider() --- .../doric/src/main/java/pub/doric/shader/TextNode.java | 4 +--- doric-iOS/Pod/Classes/Shader/DoricTextNode.m | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/doric-android/doric/src/main/java/pub/doric/shader/TextNode.java b/doric-android/doric/src/main/java/pub/doric/shader/TextNode.java index 162b94b0..d78b669e 100644 --- a/doric-android/doric/src/main/java/pub/doric/shader/TextNode.java +++ b/doric-android/doric/src/main/java/pub/doric/shader/TextNode.java @@ -460,13 +460,12 @@ public class TextNode extends ViewNode { BufferedOutputStream bos = null; FileOutputStream fos = null; try { - File file = null; File dir = new File(filePath); if(!dir.exists()){ dir.mkdirs(); } String pathName = filePath + File.separator + fileName; - file = new File(pathName); + File file = new File(pathName); if (file.exists()) { return file; } @@ -475,7 +474,6 @@ public class TextNode extends ViewNode { bos.write(bfile); return file; } catch (Exception e) { - e.printStackTrace(); throw e; } finally { if (bos != null) { diff --git a/doric-iOS/Pod/Classes/Shader/DoricTextNode.m b/doric-iOS/Pod/Classes/Shader/DoricTextNode.m index 31ce3513..26bbe6a2 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricTextNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricTextNode.m @@ -325,10 +325,10 @@ - (void)requestLayout { - (UIFont *)registerFontWithFontData:(NSData *)fontData fontSize:(CGFloat)fontSize{ CGDataProviderRef fontDataProvider = CGDataProviderCreateWithCFData((__bridge CFDataRef)fontData); - CGFontRef fontRef = CGFontCreateWithDataProvider(fontDataProvider); // THE NEXT LINE IS RELEVANT PART // https://stackoverflow.com/questions/24900979/cgfontcreatewithdataprovider-hangs-in-airplane-mode [UIFont familyNames]; + CGFontRef fontRef = CGFontCreateWithDataProvider(fontDataProvider); CGDataProviderRelease(fontDataProvider); CTFontManagerRegisterGraphicsFont(fontRef, NULL); NSString *fontName = CFBridgingRelease(CGFontCopyPostScriptName(fontRef));