I am using the latest version of jsPDF: 1.4.1
I have also tried using jspdf.debug.js
I have been able to get the basic example to work with the sample font.
however, i have not been able to inject courier prime into the pdf
Steps to reproduce
BUGGY RESULT: lots of exclamation marks
BUGGY RESULT: some # signs
Similarly, I have had no success embedding
https://www.1001fonts.com/open-sans-font.html
I did a little more digging into the font files themselves.
For the working sample font, the indexToLocFormat is 1 [Meaning Long Offsets (32)] whereas for the two fonts which do not load, the indexToLocFormat is 0 [meaning Short Offset(16)]
That might be the issue.
I have confirmed with several fonts that TTF fonts which have indexToLocFormat 1 will display whereas those with indexToLocFormat0 do not display.
Here's a bit of perl which will dump out the TTF headers:
use strict;
use warnings;
use Font::TTF::Font;
use Font::TTF::Dumper;
die "Provide One Argument: Filename" if !$ARGV[0];
my $font = Font::TTF::Font->open($ARGV[0]);
print ttfdump($font->{'head'}, 'head');
Thank you very much! I will try to figure out a solution ;).
Well Aras, who are certainly worth a beer and lots of thumbs up if you find a solution to this! :-)
@hdale
Well, there are alot of issues in the pipe... :-/
I am excited to see progress on this issue.
Thanks. just keep plugging away at it.
Any update on this? This is breaking some important functionality on my site as well :(.
fixed with #2019 which was adapted work of @briandevet <-- thank you very much.
Confirmed working! Thank you so much both @arasabbasi and @briandevet for the fixes.
I can also confirm that the fix works for us.
Thank you very much - greatly appreciated!
Most helpful comment
fixed with #2019 which was adapted work of @briandevet <-- thank you very much.