ios - 在 react-native 0.61.4 中出现错误 Unrecognized font family 'din-next-lt-w23-regular' 仅适用于 iOS
问题描述
我在我的应用程序中使用字体。所以我需要在我的应用程序中添加字体din-next-lt-w23-regular。但我在 iOS 中遇到错误,即Unrecognized font family 'din-next-lt-w23-regular'
. 我在ios/Resources和info.plist中添加了.ttf文件。这是我的代码
react-native.config.js
module.exports = {
project: {
ios: {},
android: {},
},
assets: ['./assets/fonts/'],
};
解决方案
检查字体的PostScript 名称,它是 IOS 用来识别字体的。您可以在 Font book 中查看字体文件的postscript 名称。
这是向 react-native 添加字体的好指南https://medium.com/@mehran.khan/ultimate-guide-to-use-custom-fonts-in-react-native-77fcdf859cf4
推荐阅读
- amazon-web-services - 将 Nexus 存储库中的工件同步到 s3 存储桶中的文件夹
- javascript - 在页面加载时更改选择选项值
- java - 在java中从两列csv文件制作一棵树
- python - numpy fft2 函数中的值不一致
- spring - 从 CAS 服务器注销后无法重定向到 Spring 应用程序页面
- sql-server - 如何将此列中的负值替换为 0
- linux - 新创建的 Docker 容器是否与新的 cgroup 关联?
- python - 如何将变量 names_and_ranks 分配给一个列表,每个元素都等于城市名称和相应的排名?
- c++ - 不正确的 NULL 终止 c/c++
- java - 杰克逊反序列化错误:MismatchedInputException