根据博览网站,我加载了开放式无字体字体:
async componentDidMount() {
await Font.loadAsync({
'open-sans-regular': require('assets/fonts/OpenSans-Regular.ttf')
})
this.setState({ fontLoaded: true })
}
当我在文本上应用以下样式时,--它在安卓设备上工作,而不是在iOS设备上。我是否遗漏了什么,或者我需要加载‘open粗体’并使用fontFamily属性?
<Text style={{ fontWeight: 'bold' }}>Testing</Text>
发布于 2018-07-16 05:11:29
要使用字体,还需要安装粗体字体.
await Font.loadAsync({
'open-sans-regular': require('assets/fonts/OpenSans-Regular.ttf'),
'open-sans-bold': require('assets/fonts/OpenSans-Bold.ttf'),
})
并确保在样式中声明fontFamily
<Text style={{ fontFamily: 'open-sans-bold', fontSize: 56 }}>
Hello, world!
</Text>
更多信息,请参阅在世博文档中使用自定义字体
https://stackoverflow.com/questions/51354042
复制相似问题