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 TTFReader - Build Font Definitions
How to build font definition file with FOP? I have the font file for my favorite font in TTF format.
✍: FYIcenter.com
If you the font file in TTF format, you can build the font definition file with the FOP TTFReader program.
For example, you see "Calibri" and "Gothic" font files located in \windows\fonts folder:
813,876 calibri.ttf 137,568 gothic.ttf
You can run FOP TTFReader program to build the "Calibri" font definition file:
\local\fop-2.2\fop>java -cp %FOP_PATH%\build\fop.jar; %FOP_PATH%\lib\xercesImpl-2.9.1.jar; %FOP_PATH%\lib\xalan-2.7.2.jar; %FOP_PATH%\lib\avalon-framework-4.3.1.jar; %FOP_PATH%\lib\commons-logging-1.0.4.jar; %FOP_PATH%\lib\commons-io-1.3.1.jar; %FOP_PATH%\lib\serializer-2.7.2.jar; %FOP_PATH%\lib\xmlgraphics-commons-2.2.jar org.apache.fop.fonts.apps.TTFReader -d \windows\calibri.ttf \fyicenter\calibri.xml org.apache.fop.fonts.apps.TTFReader main INFO: TTF Reader for Apache FOP 2.2 org.apache.fop.fonts.apps.TTFReader main INFO: Parsing font... org.apache.fop.fonts.apps.TTFReader loadTTF INFO: Reading C:\windows\fonts\calibri.ttf... org.apache.fop.fonts.apps.TTFReader loadTTF INFO: Font Family: [Calibri] org.apache.fop.fonts.apps.TTFReader constructFontXML INFO: Creating xml font file... org.apache.fop.fonts.apps.TTFReader main INFO: Creating CID encoded metrics... org.apache.fop.fonts.apps.AbstractFontReader writeFontXML INFO: Writing xml font file calibri.xml... org.apache.fop.fonts.apps.TTFReader main INFO: This font contains no embedding license restrictions. INFO: XML font metrics file successfully created.
Run FOP TTFReader program again to build the "Gothic" font definition file.
Open the \fyicenter\calibri.xml to see details of a font definition file:
<font-metrics metrics-version="2" type="TYPE0"> <font-name>Calibri</font-name> <full-name>Calibri</full-name> <family-name>Calibri</family-name> <embed/> <cap-height>634</cap-height> <x-height>466</x-height> <ascender>750</ascender> <descender>-250</descender> <bbox> <left>-502</left> <bottom>-307</bottom> <right>1240</right> <top>963</top> </bbox> <flags>33</flags> <stemv>0</stemv> <italicangle>0</italicangle> <subtype>TYPE0</subtype> <multibyte-extras>
This tutorial is valid in FOP 2.2, 2.1, and 2.0.
⇒ Define Your Own Font in FOP cfg.xml
⇐ FOP Missing Font Error for PDF
2018-04-12, 1734🔥, 0💬
Popular Posts:
Apache Log4j SLF4J Binding allows applications coded to the SLF4J API to use Log4j 2 as the implemen...
JDK 11 jdk.jfr.jmod is the JMOD file for JDK 11 JFR module. JDK 11 JFR module compiled class files a...
How to download and install Apache XMLBeans-2.6.0.zip? If you want to try the XMLBeans Java library,...
JDK 11 jdk.jfr.jmod is the JMOD file for JDK 11 JFR module. JDK 11 JFR module compiled class files a...
What Is poi-scratchpad-3.5.jar? poi-scratchpad-3.5.jar is one of the JAR files for Apache POI 3.5, w...