Use Unicode Characters with FOP


How to use Unicode characters with FOP? I want to use the Latin small letter "Phi" in my FO file.



If you know the Unicode code value of the character you want to use, you can enter it in your FO file in the &#xnnnn format.

The following FO file shows you some Unicode characters in the Calibri font:

<?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 font-family="Calibri">ASCII: Welcome to!</fo:block>
      <fo:block font-family="Calibri">Unicode &amp;#x0278;...: &#x0278;&#x0279;&#x0290;</fo:block>

You can generate the PDF output from this FO file with Calibri font configuration:

\local\fop-2.2\fop>fop \fyicenter\ \temp\unicode-character.pdf
   -c \fyicenter\cfg-font.xml processEvent
INFO: Rendered page #1.

Open the PDF file with Acrobat Reader, you see those Unicode characters are generated correctly:
Use Unicode Character with FOP


4-Byte Unicode Not Supported in FOP

CharMap.exe - Find Character Unicode Value on Windows

Managing Fonts in FOP PDF Output

⇑⇑ FAQ for FOP (Formatting Object Processor)

2018-03-17, 727👍, 0💬