Font Subset

gcogco
edited 4:55AM in FastReport 4.0
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

Comments

  • edited 4:55AM
    Is this feature already implemented in FR 6 VCL? We make thousends of small pdf files per month so file size is important to us. Without font subset a pdf size is 220KB, with font subset about 60KB. So thats a huge difference..

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.