Skip to content
This repository has been archived by the owner on Feb 28, 2019. It is now read-only.

Incorrect characters pulled from custom font #44

Open
devops-at-alinea opened this issue Jun 7, 2018 · 4 comments
Open

Incorrect characters pulled from custom font #44

devops-at-alinea opened this issue Jun 7, 2018 · 4 comments

Comments

@devops-at-alinea
Copy link

Using: https://sphilee.github.io/jsPDF-CustomFonts-support/# with this font
baloo-tamma-v3-latin.zip
Downloaded from here: https://google-webfonts-helper.herokuapp.com/fonts/baloo-tammudu?subsets=latin
With the following code:
`
doc.addFont('baloo-tamma-v3-latin-regular.ttf', 'custom', 'normal');

doc.setFont('custom');
doc.text(15, 15, 'ABCDEFabcdefgAAAAAAAAAAAAAAAAAAAB');
`

Gnerates a pdf with the following text:
!"#$%&'()*+,-!!!!!!!!!!!!!!!!!!!"

demo (2).pdf

Base64 decoding the file using https://www.base64decode.org/ generates a ttf file which looks correct so it can't be the font data.

@tomgloeckler
Copy link

tomgloeckler commented Aug 8, 2018

Exactly the same problem here: When using certain TTF fonts in the test editor I get the mentioned output while others work with no problems. Cannot seem to find a reason or pattern when or why this happens. The TTF is not damaged or corrupt, can be normally used. Any ideas..?

I've attached 2 TTFs: Academy-F2W ist not working, Autour-One is.

Academy-F2W.ttf.zip
Autour-One.ttf.zip

@tomgloeckler
Copy link

tomgloeckler commented Aug 8, 2018

Obviously the char map/glyph order, or however you call it, seems to get shifted or offset for fonts like the Academy-F2W I have attached above.

This code:

doc.text(15, 15, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ '\nabcdefghijklmnopqrstuvwxyz'
+ '\n1234567890'
+ '\näöüß ÄÖÜ'
+ '\n!"§$%&/()=?'
);

Outputs the following:

!"#$%&'()*+,-./0123456789:
;<=>?@ABCDEFGHIJKLMNOPQRST
UVWXYZ[\]^
_`abcdef
ghijklmnonpqr

Strange …

@ideogram
Copy link

I experience the same problem.

It also happens when using the Base64 encoder on https://www.giftofspeed.com/base64-encoder/

or when uploading the files to the authors' demo page: https://sphilee.github.io/jsPDF-CustomFonts-support/

This last thing is kind of a good thing, because you first check a font in this demo. If it works there, it will work in your project.

BTW, I triend quite a lot of fonts. 75% of them did not work. Among them, "Source Sans" and "Fira Sans",... which really are quite common.

@abisewski
Copy link

@ideogram @tomgloeckler @devops-at-alinea Do you guys solved this problem?

Having same problem here with other font...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants