react-pdf icon indicating copy to clipboard operation
react-pdf copied to clipboard

FontFamily is not working

Open vrmartins opened this issue 6 years ago • 4 comments

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

vrmartins avatar Dec 29 '19 19:12 vrmartins

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.

NishRaj avatar Jan 22 '20 11:01 NishRaj

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?

seonghyeonkimm avatar Mar 10 '20 15:03 seonghyeonkimm

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.

DeepakKapiswe avatar Mar 17 '20 09:03 DeepakKapiswe

+1

juby-gif avatar Jun 05 '20 18:06 juby-gif