PDF font embedding implementation
Developer
Adobe PDF output
Native pdf output is implemented, you may experiment that the pdf output is lighting fast compared to Acrobat Distiller and other print drivers that output pdf, this is because the translation is done directly from Report Manager native format to Adobe PDF format.
To enable truetype font embedding in a report, at the designer select Edit->Select all texts, then at object inspector select Truetype font option in PDF Font property.
But you may take consideration the following issues and limitations:
- Unicode is supported only if the original font supports unicode
- True type font linking and embedding is available from version 2.2, but see bellow details of the implementation.
- Only Jpeg and Windows Bitmap image formats are supported.
- Compression is available, and used by default, but some pdf viewers does not read PDF compressed files, the official Adobe PDF reader does not have such problems.
- Composite fonts and CID Fonts are not supported, that is are supported but PDF output processed as single fonts.
- The engine is faster and the file is smaller if you use standard Type 1 fonts (Courier/Times/Helvetica)
- The TrueType font embedding enlarges the file size of the PDF file. Better optimization is hard to done (remove unused glyphs for example). You can use TrueType font linking if you know the destination computers have the font installed.
Linux and Windows, different technologies, different implementation
Microsoft Windows already has a font cache: any application can query information about the installed fonts, obtain the whole font file (to embed it), and ask the operating system for the closest match when the requested font is not available (font matching). This works for TrueType and OpenType fonts, although a few fonts cannot be embedded because the API does not allow retrieving their font data, perhaps because of distribution-license restrictions.
Linux does not provide a single standard font service in the operating system; instead, fonts are handled through libraries such as Fontconfig and FreeType.
Font selection on Linux (since version 3.9)
Since version 3.9 the Report Manager engine uses Fontconfig to select fonts on Linux, providing a sensible fallback when the requested font is not available. The older mechanism — scanning the font directories listed in /etc/fonts/fonts.conf and matching fonts with a simple built-in algorithm — is used only when Fontconfig is not present on the system.
Installing Fontconfig is recommended for correct font selection. It is available on virtually every Linux distribution (package fontconfig, shared object libfontconfig.so) and is already present on most desktop systems; minimal or console installations may need to add it.
For the font data itself — reading glyphs and embedding the font file in the PDF — Report Manager uses the FreeType library (package freetype2, shared object libfreetype.so), which is also installed by default on most distributions and is needed only when you embed or link TrueType, OpenType or Type1 fonts. Because FreeType exposes Type1 font information, Type1 fonts can be linked in the PDF, while TrueType and OpenType fonts can be fully embedded.
Font information is cached the first time a TrueType font is embedded; building that cache means reading the installed font files to obtain their names and styles, so the first run of a single report (for example with the printreptopdf command line tool) carries a one-off cost. It does not appear if you do not embed PDF fonts, and is usually unnoticeable depending on how many fonts are installed.
The good thing is that you do not need a running X server to generate PDFs with TrueType embedding.