apache / incubator-weex

Apache Weex (Incubating)
https://weex.apache.org
Apache License 2.0
13.75k stars 1.82k forks source link

[iOS] weex引用原生本地自定义字体文件频繁打印error信息 #3338

Open demoker opened 3 years ago

demoker commented 3 years ago

iOS原生与Weex页面使用同一种字体,会导致一些Weex Error打印, 猜测原因是:原生plist中会先注册一边,然后weex界面加载的时候会根据DomModule中原生提供的字体本地沙盒路径再次进行注册,字体显示是正常的,只是控制台会频繁打印error信息,影响性能

对于原生已经注册的字体,weex SDK里面应该作出相应的判断处理

Log info:

[error]WXUtility.m:568, Unable to register font, but will unregister previous one and retry with new font file, { src = "file:///private/var/containers/Bundle/Application/E62577F7-C573-414A-89BE-513D9F017BAB/%E7%95%85%E5%90%AC%E6%9E%81%E9%80%9F%E7%89%88.app/Akrobat_kw_Regular.ttf"; localSrc = file:///private/var/containers/Bundle/Application/E62577F7-C573-414A-89BE-513D9F017BAB/%E7%95%85%E5%90%AC%E6%9E%81%E9%80%9F%E7%89%88.app/Akrobat_kw_Regular.ttf; }. [error]WXUtility.m:573, We cannot register the font finally. Error Domain=com.apple.CoreText.CTFontManagerErrorDomain Code=105 "Could not register the CGFont ''" UserInfo={NSDescription=Could not register the CGFont '', CTFailedCGFont=}