bpampuch/pdfmake

custom fonts via HTTP are not asynchrounous

dr0neform opened this issue · 1 comments

Hi,

I have an application that creates PDF-s in several languages including chinese. For chinese I'm using the googles NotoSansSC font family. The problem is that the font file is quite large (10+MB for each regular/bold etc). Passing the fonts via vfs causes unacceptable levels of bloat to the built application and therefore I have to get the fonts via http. The problem is that this method doesn't seem to be asynchronous, meaning that the pdf gets built before the font is fetched. When I click on the button to build the pdf second time, the fonts have been downloaded and everything works fine.

So my question is, if there is a way to download and apply the fonts on application load or perhaps there is another development pattern that should be used?

Solved it via creating a promise as described here:

#866