Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
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 (309)
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, 2210🔥, 0💬
Popular Posts:
iText is an ideal library for developers looking to enhance web- and other applications with dynamic...
JDK 11 jdk.jshell.jmod is the JMOD file for JDK 11 JShell tool, which can be invoked by the "jshell"...
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...
Apache ZooKeeper is an open-source server which enables highly reliable distributed coordination. Ap...
What Is javamail1_1_3.zip? javamail1_1_3.zip is the binary package of JavaMail API 1.1.3 in ZIP form...