Firebird Documentation IndexUsing non-Western fonts → 4: Create FOP userconfig file
Firebird Home Firebird Home Prev: 3: Create metrics filesFirebird Documentation IndexUp: Using non-Western fontsNext: 5: Build PDF and commit

Step 4: Create a FOP userconfig file

This is the most complicated step. You have to edit the fop-userconfig.xml file to tell FOP:

OK, let's go for it:

  1. If necessary, copy fop-userconfig.xml from the general config dir into your language subdirectory (e.g. config/ja).

  2. Open the file in a text or XML editor and find the font-base entry. Replace xx in the value with your language code, so that the URL points to the correct config subdirectory. Uncomment the entry!

  3. Now go on to the <fonts> element. You will find some commented-out example fonts already present.

  4. Insert a <font> element for the first font to add:

    <font metrics-url="msmincho.xml" kerning="yes"
          embed-url="file:///D:/WINNT/Fonts/MSMincho.ttf">
      <font-triplet name="MSMincho" style="normal" weight="normal"/>
    </font>

    Notes:

    • metrics-url refers to the font metrics file you've created before, and which is in the same folder as fop-userconfig.xml.

    • embed-url must be a URL pointing to the font file itself. Attention! For Type 1 fonts, you must specify the .pfb file here, not the .pfm like you did when creating the metrics file.

      Important

      Even if the entire setup already exists, it may be necessary to edit the embed-url, as it is possible that you have the font in another location than the person who committed the setup to CVS. Other than that, no configuration changes should be necessary.

    • The font-triplet name must be the same as the name you used in fo-params.txt to override the default font.

  5. Now you have to add information for the bold, italic, and bold-italic variations of the font. Often these come from different font files and you will have generated separate metrics files for them. If that is indeed the case, each variation gets its own <font> entry, e.g. for bold-italic:

    <font metrics-url="msmincho-bi.xml" kerning="yes"
          embed-url="file:///D:/WINNT/Fonts/MSMinchoBI.ttf">
      <font-triplet name="MSMincho" style="italic" weight="bold"/>
    </font>

    Note that the font-triplet name must be the same for each variation: the name you used in fo-params.txt.

    Sometimes there are no bold or italic variations of a font. In that case you must fake it, because the intermediate .fo file does specify these variations in places, and if they don't seem to exist you'll get the dreaded ### #### ## in the PDF again. For every non-existing variation, add a <font-triplet> element to the variation that should be used instead:

    <font metrics-url="msmincho.xml" kerning="yes"
          embed-url="file:///D:/WINNT/Fonts/MSMincho.ttf">
      <font-triplet name="MSMincho" style="normal" weight="normal"/>
      <font-triplet name="MSMincho" style="italic" weight="normal"/>
    </font>

    If neither bold nor italic exist, you'll end up with four <font-triplet> children in the <font> element.

  6. Repeat items 4 and 5 for every font family you've added to fo-params.txt.

If everything has gone right, you should now be able to generate PDFs in your language.

Important

The older FOP userconfig files (which we used until February 2020) don't have the right format for our current FOP version (2.4 or higher). If FOP complains about this, do a git update. If the format still isn't right, look in config/fop-userconfig.xml and give your localised userconfig file the same structure.

Prev: 3: Create metrics filesFirebird Documentation IndexUp: Using non-Western fontsNext: 5: Build PDF and commit
Firebird Documentation IndexUsing non-Western fonts → 4: Create FOP userconfig file