Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
FOP Missing Italic and Bold Fonts for PDF
Why I am getting the 'Font "Calibri,normal,700" not found. Substituting with "Calibri,normal,400"' error with FOP?
✍: FYIcenter.com
You are getting the "Font X,normal,700 not found. Substituting with X,normal,400" error,
if FOP can not find the "Bold" font definition for the font X.
Computer fonts are usually defined as a family of minimum 4 fonts: Normal, Bold, Italic and Bold-Italic. So that you can the font in 4 variations as shown in this FO file, calibri-bold-italic.fo:
<?xml version="1.0" encoding="utf-8"?> <!-- calibri-bold-italic.fo Copyright (c) 2018 FYIcenter.com --> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> <fo:simple-page-master master-name="myPage"> <fo:region-body margin="1in"/> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference="myPage"> <fo:flow flow-name="xsl-region-body"> <fo:block font-family="Calibri">Calibri: Welcome to jar.FYIcenter.com!</fo:block> <fo:block font-family="Calibri" font-weight="bold"> Calibri Bold: Welcome to jar.FYIcenter.com!</fo:block> <fo:block font-family="Calibri" font-style="italic"> Calibri Italic: Welcome to jar.FYIcenter.com!</fo:block> <fo:block font-family="Calibri" font-weight="bold" font-style="italic"> Calibri Bold and Italic: Welcome to jar.FYIcenter.com!</fo:block> </fo:flow> </fo:page-sequence> </fo:root>
If you try to generate the PDF output with only the normal "Calibri" font defined, you will get errors as shown below:
\local\fop-2.2\fop>fop \fyicenter\calibri-bold-italic.fo \temp\calibri-bold-italic.pdf -c \fyicenter\cfg-font.xml org.apache.fop.events.LoggingEventListener processEvent WARNING: Font "Calibri,normal,700" not found. Substituting with "Calibri,normal,400". org.apache.fop.events.LoggingEventListener processEvent WARNING: Font "Calibri,italic,400" not found. Substituting with "Calibri,normal,400". org.apache.fop.events.LoggingEventListener processEvent WARNING: Font "Calibri,italic,700" not found. Substituting with "Calibri,normal,400". org.apache.fop.events.LoggingEventListener processEvent INFO: Rendered page #1.
Notice that how a font is identified with 3 parameters: font family name, style and weight. For example, "Calibri,normal,700" identifies the "normal" style font with "700 (bold)" weight from the "Calibri" font family.
To resolve the issue, we need to build 3 more font definition files for "Calibri Bold", "Calibri Italic", and "Calibri Italic Bold".
This tutorial is valid in FOP 2.2, 2.1, and 2.0.
⇒ FOP TTFReader - Build Italic and Bold Fonts
⇐ Define Your Own Font in FOP cfg.xml
2018-04-12, 2347🔥, 0💬
Popular Posts:
What JAR files are required to run dom\Counter.java provided in the Apache Xerces package? You can f...
Apache Log4j Core Implementation provides the functional components of the logging system. Users are...
What Is javaws.jar in JRE (Java Runtime Environment) 8? javaws.jar in JRE (Java Runtime Environment)...
JDK 17 jdk.javadoc.jmod is the JMOD file for JDK 17 Java Document tool, which can be invoked by the ...
What Is poi-3.5.jar - Part 2? poi-3.5.jar is one of the JAR files for Apache POI 3.5, which provides...