Closed manjilkhambe closed 10 months ago
by default fonts you mean your system fonts right?
if yes you might use os-fonts or get-system-fonts or some other similar fonts.
But be aware that this might not work ec2 or lambda instances if you do not have any access rights to some ttf or other font files or system / library folders.
Best way is to package some default fonts with your app and retrieve path from env config so anyone using your app could just add a path and change font path without editing the code.
No no, I wanted to use fonts used in library itself. I don't want to give the file path to getFontForFile function. Is there a way to achieve it ?
i'm not sure what this exactly means. do you have a font in memory like a buffer?
Using reciepe approach I can directly use font: 'Roboto'. similarly is there a way so that I can directly provide font name - Robot | Helvetica etc fonts which are already there in the fonts folder of npm package.
please refer below code which is written in unit tests in
TestMaterials/ Reciepe/ text.js
Ahhh got it. There is currently no other option besides using receipt which loads the default fonts.
okay. thanks for the reply.
i could add a convinience function which adds a map of name -> pathes. that would make it easier. would that help?
yes. that would help I guess. Any sort of reference to the paths would do. It would be helpful in cases where user don't want to use custom fonts.
I am trying to add watermark to the pdf file. I don't want to provide any font path. Is there a way to do it? Please refer code below