FOP Missing Font Error for PDF


Why I am getting the "Font Calibri,normal,400 not found. Substituting with any,normal,400" error with FOP?



FOP has built-in definitions only for generic fonts: serif, sans-serif, monospace, and Base-14 fonts: Helvetica, Times, Courier, Symbol, ZapfDingbats. If you are using a font that has not built-in definition, you will get the "Font X not found. Substituting with any" error.

For example, "Calibri" is a popular font, but it has not built-in definition in FOP. So if you use font "Calibri" in your FO file as show below, FOP will give you an error:

<?xml version="1.0" encoding="utf-8"?>
     Copyright (c) 2018
<fo:root xmlns:fo="">
    <fo:simple-page-master master-name="myPage">
      <fo:region-body margin="1in"/>
  <fo:page-sequence master-reference="myPage">
    <fo:flow flow-name="xsl-region-body">
      <fo:block>Default: Welcome to!</fo:block>
      <fo:block font-family="Calibri">Calibri: Welcome to!</fo:block>
      <fo:block font-family="Gothic">Gothic: Welcome to!</fo:block>

Try to generate the PDF output from this FO file:

\local\fop-2.2\fop>fop \fyicenter\ \temp\missing-font.pdf processEvent
WARNING: Font "Calibri,normal,400" not found. Substituting with "any,normal,400". processEvent
WARNING: Font "Gothic,normal,400" not found. Substituting with "any,normal,400". processEvent
INFO: Rendered page #1.

The 'WARNING: Font "Calibri,normal,400" not found. Substituting with "any,normal,400"' is actually an error. FOP will replace "Calibri" font with the placeholder "any" font.

Open the PDF output file, missing-font.pdf in Acrobat Reader and check the font properties, you will see "any" font is mapped to "Time Roman":
FOP Missing Font Error for PDF

This tutorial is valid in FOP 2.2, 2.1, and 2.0.


FOP TTFReader - Build Font Definitions

FOP Font Missing Glyph Error for PDF

Managing Fonts in FOP PDF Output

⇑⇑ FAQ for FOP (Formatting Object Processor)

2018-04-21, 172👍, 0💬