Font Subset
Hello,
I write this as I noticed that font embedding in fast-report generated PDFs is currently very inefficient, because it includes an entire font file structure. Embedded fonts are recomended by PDF standard for any characters beside US character set. Given hundreds of kB of a typical ttf file and the fact that bold and italic characters are usually stored in separated files, the resulting PDFs are unnecessarily large.
Decent PDF generators solve this by font subsetting, which means that structure of embedded font is rebuild in such a way that it contains just characters actually needed in a particular PDF file. Remember that ttf files usually contain characters of many diffenent codepages, which means that such a reduced ttf leads to a substantial size reduction of the resulting PDF file.
Simple font subset can be made by standard windows font embedding functions in T2embed library (TTEmbedFont etc.). Better solution howewer is to make the font subset youself, because, while it requires to write your own parser of ttf and otf file structures, it allows you to make more compact font structures and address the character glyphs in an unambiguous way. You may look for example at iTextSharp project sources to get on idea how it could work.
Font subsetting would help Fast-Report produce more usable PDF files, which would certainly be appreciated by many of your customers.
Regards,
Michal
I write this as I noticed that font embedding in fast-report generated PDFs is currently very inefficient, because it includes an entire font file structure. Embedded fonts are recomended by PDF standard for any characters beside US character set. Given hundreds of kB of a typical ttf file and the fact that bold and italic characters are usually stored in separated files, the resulting PDFs are unnecessarily large.
Decent PDF generators solve this by font subsetting, which means that structure of embedded font is rebuild in such a way that it contains just characters actually needed in a particular PDF file. Remember that ttf files usually contain characters of many diffenent codepages, which means that such a reduced ttf leads to a substantial size reduction of the resulting PDF file.
Simple font subset can be made by standard windows font embedding functions in T2embed library (TTEmbedFont etc.). Better solution howewer is to make the font subset youself, because, while it requires to write your own parser of ttf and otf file structures, it allows you to make more compact font structures and address the character glyphs in an unambiguous way. You may look for example at iTextSharp project sources to get on idea how it could work.
Font subsetting would help Fast-Report produce more usable PDF files, which would certainly be appreciated by many of your customers.
Regards,
Michal
Comments