All about embedding font in the document

 

Some designers wish to include only a few specific fonts in a PDF to ensure all possible end-users have access to those fonts, especially if the fonts are uncommon. Some other designers wish to embed fonts, but exclude fonts that they know exist on their end-users’ systems.

Adobe LiveCycle Forms and Output both supports these kind of use cases. This blog posts demonstrates how to do that. There are two constructs in XCI (configuration packet of XDP) to support this alwaysEmbed and neverEmbed. The following examples show this.

Example 1: How to use alwaysEmbed

In this example, a form uses the fonts “FontIsRare”, “FontIsCommon”, “FontC”, and “FontD”. Given the following in the configuration:

</fontInfo>
    <embed>0</embed> <!- - embed is off - - >
    <alwaysEmbed>FontIsRare</alwaysEmbed>
    <neverEmbed>FontIsCommon</neverEmbed>
</fontInfo>
The output file is expected to have only "FontIsRare" embedded.

Example 2: How to use neverEmbed

In this example, a form uses the fonts “FontIsRare”, “FontIsCommon”, “FontC”, and “FontD”. Given the following in the configuration:

 

<fontInfo>
    <embed>1</embed> <!- - embed is on - - >
    <alwaysEmbed>FontIsRare</alwaysEmbed>
    <neverEmbed>FontIsCommon</neverEmbed>
</fontInfo>

The output file is expected to have “FontIsRare”, “FontC”, and “FontD” embedded. “FontIsCommon” is not embedded.

 

The fontInfo element may appear in the configuration file as a child of pdf, pcl, zpl, ps, and image. The elements alwaysEmbed and neverEmbed will only be meaningful under the pdf element and will not be meaningful for image, pcl, zpl, and ps, the reason being that there is no support for adding non-embedded fonts that are not recognized by the printer in pcl, zpl and ps.

alwaysEmbed is only honored if embed is set to ‘0’.  Here is how your full xci file look like:

<xfa xmlns:xfa="http://www.xfa.org/schema/xci/1.0/">
    <config xmlns="http://www.xfa.org/schema/xci/1.0/">
        <present desc='Presentation Agent'>
        <pdf> <!--  [0..n]  -->
            <fontInfo>
                <embed>0</embed>
                <alwaysEmbed>Wingdings</alwaysEmbed>
                <alwaysEmbed>Book Antiqua</alwaysEmbed>
                <alwaysEmbed/>
                <neverEmbed>Wingdings</neverEmbed>
                <neverEmbed>Book Antiqua</neverEmbed>
                <neverEmbed/>
            </fontInfo>
         </pdf>
        </present>
    </config>
</xfa>