> For the complete documentation index, see [llms.txt](https://onestopconcept.gitbook.io/open-endpoints/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://onestopconcept.gitbook.io/open-endpoints/configuration/pdf-created-with-xslt/embedding-fonts.md).

# Embedding Fonts

Depending on what fonts readers have available on their local computer, fonts used in your PDF will be seen as you intended it to be seen, or the computer may substitute fonts. Substitution can result in significant differences between your intended output and what the reader will see.

Embedding fonts prevents font substitution. This ensures that text is displayed and printed in its original font.

## True Type Fonts

Offer-Ready supports embedding of True Type fonts, which have a “ttf” file extension.

Create a directory “fonts” in the root directory of your configuration. Within this “fonts” directory, there is

* an overall fonts configuration file called “**apache-fop-config.xml**”.
* A TTF file for each font refered to in the apache-fop-config.xml. For example: “HelveticaNeue-Light.ttf”.

The “**apache-fop-config.xml**” declares the ttf fonts in the fop processor:

```xml
<fop>
    <renderers>
        <renderer mime="application/pdf">
            <fonts>
                <!-- zero or many font tags -->
                <font kerning="yes" embed-url="the-name-of-the-ttf-file.ttf">
                      <font-triplet name="Font Name as used in your XSL Template" style="normal" weight="normal">
                </font>
            </fonts>
        </renderer>
    </renderers>
</fop>
```

## How-to use your embedded fonts in XSL-FO

On developing your XSL-FO template, use the (embedded) font-triplet name as if it were available on your local computer. Technically your XSL-FO file may contain any font-name with any font-style and font-weight. The behaviour of a common PDF reader will be:

1. If a font-name/font-style/font-weight triplet used in the PDF is available as an embedded font-triplet, than this will be used.
2. If a font-name/font-style/font-weight triplet used in the PDF is not available as an embedded font-triplet, but on the local computer, than the font from the local computer will be used.
3. If both previous options do not apply, the PDF reader will substitute that font by some other font.

**Beware of these “traps”:**

* If your PDF for example does not show a text in bold letters, although your intention was to use bold letters, than you maybe have defined the font-triplet for “weight=normal”, but not also for “weight=bold”. You need to declare all required combinations of name/style/weight.
* If your local computer has a font “Helvetica Neue”, and your font-triplet name is “HelveticaNeue” (without a blank), than you must use “HelveticaNeue” in your XSL-FO. A WYSIWYG editor (like Altova Stylevision) likely will offer local fonts only in a dropdown.
* The preview of your PDF in a local development environment may look different than the PDF generated by Offer-Ready. The fonts used by the local development environment will use fonts on your computer, and not fonts checked in in the above structure.

## Third Party License Constraints

{% hint style="info" %}
**Using a font may require a licence**

It is your responsibility to respect license constraints. While many fonts can be used without restrictions, other fonts for example might require to pay a license fee.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://onestopconcept.gitbook.io/open-endpoints/configuration/pdf-created-with-xslt/embedding-fonts.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
