[UIFont familyNames] before CGFontCreateWithDataProvider()
This commit is contained in:
parent
b75e42dac3
commit
af9b47466c
@ -460,13 +460,12 @@ public class TextNode extends ViewNode<TextView> {
|
|||||||
BufferedOutputStream bos = null;
|
BufferedOutputStream bos = null;
|
||||||
FileOutputStream fos = null;
|
FileOutputStream fos = null;
|
||||||
try {
|
try {
|
||||||
File file = null;
|
|
||||||
File dir = new File(filePath);
|
File dir = new File(filePath);
|
||||||
if(!dir.exists()){
|
if(!dir.exists()){
|
||||||
dir.mkdirs();
|
dir.mkdirs();
|
||||||
}
|
}
|
||||||
String pathName = filePath + File.separator + fileName;
|
String pathName = filePath + File.separator + fileName;
|
||||||
file = new File(pathName);
|
File file = new File(pathName);
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
@ -475,7 +474,6 @@ public class TextNode extends ViewNode<TextView> {
|
|||||||
bos.write(bfile);
|
bos.write(bfile);
|
||||||
return file;
|
return file;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
|
||||||
throw e;
|
throw e;
|
||||||
} finally {
|
} finally {
|
||||||
if (bos != null) {
|
if (bos != null) {
|
||||||
|
@ -325,10 +325,10 @@ - (void)requestLayout {
|
|||||||
|
|
||||||
- (UIFont *)registerFontWithFontData:(NSData *)fontData fontSize:(CGFloat)fontSize{
|
- (UIFont *)registerFontWithFontData:(NSData *)fontData fontSize:(CGFloat)fontSize{
|
||||||
CGDataProviderRef fontDataProvider = CGDataProviderCreateWithCFData((__bridge CFDataRef)fontData);
|
CGDataProviderRef fontDataProvider = CGDataProviderCreateWithCFData((__bridge CFDataRef)fontData);
|
||||||
CGFontRef fontRef = CGFontCreateWithDataProvider(fontDataProvider);
|
|
||||||
// THE NEXT LINE IS RELEVANT PART
|
// THE NEXT LINE IS RELEVANT PART
|
||||||
// https://stackoverflow.com/questions/24900979/cgfontcreatewithdataprovider-hangs-in-airplane-mode
|
// https://stackoverflow.com/questions/24900979/cgfontcreatewithdataprovider-hangs-in-airplane-mode
|
||||||
[UIFont familyNames];
|
[UIFont familyNames];
|
||||||
|
CGFontRef fontRef = CGFontCreateWithDataProvider(fontDataProvider);
|
||||||
CGDataProviderRelease(fontDataProvider);
|
CGDataProviderRelease(fontDataProvider);
|
||||||
CTFontManagerRegisterGraphicsFont(fontRef, NULL);
|
CTFontManagerRegisterGraphicsFont(fontRef, NULL);
|
||||||
NSString *fontName = CFBridgingRelease(CGFontCopyPostScriptName(fontRef));
|
NSString *fontName = CFBridgingRelease(CGFontCopyPostScriptName(fontRef));
|
||||||
|
Reference in New Issue
Block a user