Unable to render text in arabic using React-pdf

Viewed 375

I am trying to display Arabic text in pdf using react-pdf but it shows un-appropriate text

Following is the text in png that I have tried to show in Arabic and English but only English letters are displayed but not the Arabic text.

enter image description here

And Following is the small snippet which I have used for setting the font family

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,
    },
  ],
});
1 Answers

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

Do you have any plans for supporting other languages in the typeface especially Arabic ?!

Nope! Thanks for asking. It would be cool if someone familiar with Arabic script would take this on as a separate project :–)

read also https://github.com/rsms/inter/issues/391

which suggests using https://github.com/ryanoasis/nerd-fonts

Related