React-pdf: FontFamily is not working

Created on 29 Dec 2019  路  4Comments  路  Source: diegomura/react-pdf

When I try to register a font with Font.register() and then I try to style a Text, the document is just loading.
Even in the documentation the error occurs. When you remove fontFamily from all Text, the pdf is rendered. Am I doing something wrong?

Here is repl.it:

https://react-pdf.org/repl?example=font-register

The issue may relate to the following: #806 #796 #793

Most helpful comment

Can you try importing the font directly in your import statements of JS file like
_import someFont from 'someDir/Lato-Italic.ttf';_
and then use _someFont_ in your src attribute of Font.register().
The only disadvantage is that you have to import all the fonts individually.

All 4 comments

Can you try importing the font directly in your import statements of JS file like
_import someFont from 'someDir/Lato-Italic.ttf';_
and then use _someFont_ in your src attribute of Font.register().
The only disadvantage is that you have to import all the fonts individually.

I think I still have issues to load fonts properly. In my case, I am trying to load the Korean language.
But, I can see only few alphabets. the other alphabets are not invisible.

Is there any workaround I can apply?

Thanks a lot @NishRaj I was struggling for last 3 days just to solve this issue, and finally with your suggestion of importing font directly as a JS import it worked, earlier I was not able to render non latin characters by any means. Thanks again.

+1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yellowBanano picture yellowBanano  路  3Comments

cheald picture cheald  路  3Comments

saratonite picture saratonite  路  3Comments

redcranesolutions picture redcranesolutions  路  4Comments

diegomura picture diegomura  路  4Comments