'Unable to render text in arabic using React-pdf

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


Solution 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 K J