无法使用React-PDF用阿拉伯语呈现文本
我试图使用React-PDF在PDF中显示阿拉伯文本,但它显示了不适当的文本,
以下是我试图用阿拉伯语和英语显示的PNG中的文本,但仅显示英文字母,但不显示阿拉伯语文本。
,以下是我用于设置字体系列的小片段
import FontBold from '@assets/fonts/Inter/Inter-Bold.ttf';
import {styles} from './styles';
Font.register({
family: 'Inter',
fonts: [
{
src: FontRegular,
},
{
src: FontMedium,
fontWeight: 500,
},
{
src: FontSemiBold,
fontWeight: 600,
},
{
src: FontBold,
fontWeight: 700,
},
],
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
许多字体没有阿拉伯语字符,在您的情况下,如果不改用其他字体或修改,这将是不可能的。
也阅读 https://github.com/rsms/inters/issues/391
建议使用 https ://github.com/ryanoasis/nerd-fonts
以后的编辑
最近,提出了一种通过范围应用两种字体的手段
https://github.com.com.com/rsms/rsms/rsms/rsms/inter/inter/inter/issues/391#issuecomment--391#issuecomment-- 1475339407
Many fonts do not have arabic characters and in your case that is not going to be possible without changing to another font, or modifications.
https://github.com/rsms/inter/issues/358
read also https://github.com/rsms/inter/issues/391
which suggests using https://github.com/ryanoasis/nerd-fonts
Later edit
Most recently suggests a means to apply two fonts by ranges see
https://github.com/rsms/inter/issues/391#issuecomment-1475339407
尝试此尝试作为src
它对我有用,我从Google Fonts响应中得到了font
Try this one as a src https://fonts.gstatic.com/s/tajawal/v10/Iura6YBj_oCad4k1rzaLCr5IlLA.ttf
It works for me, I got it from google fonts response when downloading the font