jsPDF-CustomFonts-support icon indicating copy to clipboard operation
jsPDF-CustomFonts-support copied to clipboard

Optimizing pdf file size

Open HackbrettXXX opened this issue 7 years ago • 4 comments

Hello,

currently, when I add a font, it is included into the final pdf file as a whole. Is this right? Would it be possible to only include characters or character ranges that are actually used?

I suppose this would massively reduce the file size. Especially if one adds a huge font as fallback-font that supports the whole Unicode range.

Greetings

HackbrettXXX avatar Jan 11 '18 16:01 HackbrettXXX

Hi, @HackbrettXXX Which fonts were all included in the PDF when you used them? I only examined the Unicode used by the user and extracted only the corresponding glyph table.

sphilee avatar Jan 12 '18 04:01 sphilee

Oh, so you're already including only subsets of the fonts? I haven't tested it or looked through the code before.

So, sorry for bothering you...

HackbrettXXX avatar Jan 12 '18 13:01 HackbrettXXX

It's okay. Thanks for your interest in the project. Let me know if there is something strange at any time.

sphilee avatar Jan 13 '18 14:01 sphilee

Thanks again for your library,

I found something strange, when I embed Batang.ttf as MacRomanEncoding, then the file size is small, however when I embed Lato.ttf as WinAnsiEncoding, then the file is large, even if I do not use the font. Could it be that the different encoding have a different effect?

JP

jean343 avatar Feb 02 '18 13:02 jean343