How to render the text of a PDF document if the font is not embedded?

Every developer of a PDF viewer, a PDF printer and a PDF to Image Converter tool comes across the requirement to render non embedded fonts and is facing quite a challenging task. Not only developers but also users of these tools might be interested in non embedded fonts and how they are treated by these tools.

Every character of a text in a PDF document is assigned to a font which defines the appearance of the characters, e.g. the widths of the stems, the height of the small letters compared to the capital letters, serifs, character metrics and many more properties. All these properties and the exact appearance of  a character is described in a font program (essentially either a TrueType or a PostScript Type 1 program).

The creator of a PDF document can choose whether the font program is embedded in the file or whether it is only referred to by name. If the font program is embedded then it can be used by the rendering engine to display the text. However, if the font is not embedded and the file is displayed or printed on a different computer then it is not guaranteed that the original font program is still available. In this case the rendering engine has to find a replacement for the original font. However, this process can be quite challenging. Why? Consider the following:
  • The name of the font does not guarantee that a system font with the same name is identical to the original font, e.g. the Arial font which was used to create the document might be different to the Arial font which is installed on the system which is used to display the document.
  • The name of the embedded font might be different to the name of the installed font, e.g. the embedded font may be named TimesRoman and the equivalent installed font may be named Times New Roman.
  • The embedded font may not be available at all on the target system, e.g. there doesn't exist an installed font named Coronet.
In order to solve these problems some rendering engines do not use system fonts as replacement fonts but provide a set of font templates which are used to construct the definitive font program on-the-fly based on some font metrics such as the font weight, the height of the small characters, the character widths etc. 

Multiple master fonts are one of these technologies to tailor font programs. Multiple master fonts are font templates from which specific font instances can be produced by providing a font design vector containing elements such as the font weight and the character width. Conventional fonts such as TrueType or PostScript Type 1 fonts are not suited for this purpose. Why? If you want to change the width of a character of a TrueType font then you e.g. automatically change its stem width which is not the case with multiple master fonts where you can change the stem width and the character width independently.

Multiple master fonts are only available as a replacement for simple fonts, that is fonts with a small, defined set of characters. For fonts with large character sets such as Chinese, Korean and Japanese fonts it is better to use a set of defined font program resources.

Our 3-Heights(TM) PDF Rendering Engine uses a mixture between the described technologies to tailor replacement fonts and to use installed system fonts.

I hope this article was useful to you. If you have further questions or comments, please post a comment.



2 comments :

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. Hello Mr. Bachman. You commented "It is useful information for me. The post your having the idea about the pdf document editing. Thank for your great post with awesome tips." Thank you for the input. But as you might not be aware, our blog policy does not allow for the posting of external linking, which is why we have removed your post.

    ReplyDelete