Troubleshooting
Problem
Environment
Resolving The Problem
Resolution 1) We first suggest to verify if ADDITIONAL FONTS have been installed to the IBMi OS.
DSPSFWRSC
Resource
ID Option Feature Description
5770SS1 43 5050 Additional Fonts
TrueType and OpenType fonts are expected to be found in one of two integrated file system directories:
/QIBM/ProdData/OS400/Fonts/TTFontsfor IBM supplied fonts./QIBM/UserData/OS400/Fonts/TTFontsfor user fonts.
You can specify additional directories for user fonts by using environment variable QIBM_FONT_RESOURCES_PATH. One or more directories, separated by a colon, can be specified.
Resolution 2) Many of the standard fonts used today within Windows can be found in the C:\WINDOWS\Fonts directory, including the Arial, Courier New, and Times New Roman fonts. In the Windows default font directory, you find the fonts are listed as True Type Font (TTF) files. TrueType is an outline font standard, which is a common format for fonts on the Mac operating system and Windows operating systems.
Included below is a listing of a few standard fonts available through the Windows operating system:
| Arial | C:\WINDOWS\Fonts\arial.ttf |
| Arial Bold | C:\WINDOWS\Fonts\arialbd.ttf |
| Arial Bold Italic | C:\WINDOWS\Fonts\arialbi.ttf |
| Courier New | C:\WINDOWS\Fonts\cour.ttf |
| Courier New Bold | C:\WINDOWS\Fonts\courbd.ttf |
| Courier New Bold Italic | C:\WINDOWS\Fonts\courbi.ttf |
| Times New Roman | C:\WINDOWS\Fonts\times.ttf |
| Times New Roman Bold | C:\WINDOWS\Fonts\timesbd.ttf |
| Times New Roman Bold Italic | C:\WINDOWS\Fonts\timesbi.ttf |
Default IBM Technology for Java (J9) JDK font directories
JV1 Option 17 - JDK 8.0 64 bit
/QOpenSys/QIBM/ProdData/JavaVM/jdk80/64bit/jre/lib/fonts
JV1 Option 16 - JDK 8.0 32 bit
/QOpenSys/QIBM/ProdData/JavaVM/jdk80/32bit/jre/lib/fonts
JV1 Option 15 - JDK 7.0 64 bit
/QOpenSys/QIBM/ProdData/JavaVM/jdk70/64bit/jre/lib/fonts
JV1 Option 14 - JDK 7.0 32 bit
/QOpenSys/QIBM/ProdData/JavaVM/jdk70/32bit/jre/lib/fonts
or
-Dsun.java2d.fontpath=prepend:<pathto>/myfonts
| 1. | Locate the custom TrueType Font (TTF) file(s). The default Windows font location is C:\WINDOWS\Fonts. |
| 2. | Copy/FTP the custom TTF file(s) to the IBM i Integrated File System (IFS). Note: You can copy the files to the IBM i IFS using FTP, a mapped network drive, or IBM i Navigator. The target IBM i IFS location can either be an existing, user specified directory, or the default JDK font directory. You should refer to the section above entitled Default IBM Technology for Java (J9) JDK font directories to obtain the default JDK font directory. Important Note: IBM highly recommends the use of a custom font directory. This allows the client a more granular use of the custom font(s). Adding the TTF file to a default JDK font directory will automatically make the font available only for the specified JDK. User specified directory example: MKDIR DIR('/fonts') The TTF files would then be copied into the /fonts directory. Example: /fonts/arial.ttf, /fonts/cour.ttf, /fonts/times.ttf If you decide to only use the default JDK font directory, you should skip to Step 4. If you would like to use a custom font directory, you should proceed to Step 3. |
| 3. | Add the JAVA_FONTS environment variable to specify the custom font directory(ies). Qshell/PASE export JAVA_FONTS=/fonts export JAVA_FONTS=/fonts:/fonts2 System-wide - IBM i ADDENVVAR ENVVAR(JAVA_FONTS) VALUE('/fonts:/fonts2') LEVEL(*SYS) Note: This will load the fonts in the specified directories for all JVMs on the system. ADDENVVAR ENVVAR(JAVA_FONTS) VALUE('/fonts') LEVEL(*JOB) |
| 4. | The IBM Technology for Java JDK(s) will now use the custom font(s) added to the default JDK font directory and/or in the directory(ies) specified on the JAVA_FONTS environment variable. |
Sample Java Source (ListAvailableFonts.java) for Listing Available Fonts
| import java.awt.GraphicsEnvironment; public class ListAvailableFonts { public static void main(String[] args) { String fonts[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); for ( int i = 0; i < fonts.length; i++ ) { System.out.println(fonts[i]); } } } |
When calling the above program on the IBM i, use the JVM argument -Djava.awt.headless=true
Example:
STRQSH
java -Djava.awt.headless=true ListAvailableFonts
Related Information
Historical Number
622714229
Was this topic helpful?
Document Information
Modified date:
04 December 2024
UID
nas8N1011186