Jspdf-autotable: Custom Font Bug v3.4.1

Created on 12 Apr 2020  路  3Comments  路  Source: simonbengtsson/jsPDF-AutoTable

In v3.4.1 and v3.4.2 a bug was introduced which breaks custom fonts.
I get the error:
Unable to look up font label for font 'ARIALN', 'bold'. Refer to getFontList() for available fonts.
Unable to look up font label for font 'ARIALNB', 'normal'. Refer to getFontList() for available fonts.

It seems to be inverting either the font or fontStyle between lines of fonts I am printing out.
If I switch back to v3.4.0 then it works.

The issue has to do with this block of code, if I copy the stylesMofifiers block from the previous version then everything is working again.

https://github.com/simonbengtsson/jsPDF-AutoTable/commit/d6e69dab2c194ffd135f42e79b67a0f7c51709b2?diff=split
image

bug

Most helpful comment

Got it, it's a matter of order of lines, fontStyle should be applied before font, will send PR now.

All 3 comments

Custom fonts works well for me, Could you edit this example to make it not work?
custom-font.zip

Here you go. If you change the version back to 3.4.0 then the errors go away.

custom-font.zip
image

Got it, it's a matter of order of lines, fontStyle should be applied before font, will send PR now.

Was this page helpful?
0 / 5 - 0 ratings