IBM Support

How to Add Custom X11 TrueType Fonts to AIX Font Path

Question & Answer


Question

How can I Add Custom X11 TrueType Fonts to the AIX Font Path?
NOTE: If non-AIX fonts are required by a product to display within an AIX X11 environment, consult with the product vendor to obtain one or more of the following:

1.  The licensed fonts
2.  Instructions for obtaining and installing the fonts
3.  Instructions for configuring font aliases

Answer

The following instructions provide steps to add custom X11 TrueType fonts (ttf) to the default AIX X11 font path.

Recommended:

- Contact the font vendor to address issues with the font (loading, rasterizing, and so on).
- Obtain proper licensing to download and use the font in your environment

The first example in this document assumes:

  • There are 4 versions of the downloaded font
    • Regular, Bold, Bold Italic, Italic
  • The type is MonoType
  • The encoding is ISO8859-1
NOTE:  Customize the instructions to match the file names, font names, descriptions, and encoding provided by the font vendor.

1.  Download the new fonts to /usr/lpp/X11/lib/X11/fonts/TrueType.

CUSTOM_FONT.ttf
CUSTOM_FONTbd.ttf
CUSTOM_FONTbi.ttf
CUSTOM_FONTi.ttf

2.  Change to the TrueType font directory.

# cd /usr/lpp/X11/lib/X11/fonts/TrueType

3.  Edit the fonts.scale to include the exact new font descriptions.

# vi fonts.scale

3.1) Add the following entries:

 NOTE: The following text is an EXAMPLE. All values in the FontName (CUSTOM_FONTx.ttfmust EXACTLY MATCH descriptions from the font vendor. (See the XLFD link under Related URLs for more info)
CUSTOM_FONT.ttf -Monotype-CUSTOM_FONT-medium-r-normal--0-0-0-0-m-0-iso8859-1
CUSTOM_FONTi.ttf -Monotype-CUSTOM_FONT-medium-r-italic--0-0-0-0-m-0-iso8859-1
CUSTOM_FONTbd.ttf -Monotype-CUSTOM_FONT-medium-r-bold--0-0-0-0-m-0-iso8859-1
CUSTOM_FONTbi.ttf -Monotype-CUSTOM_FONT-medium-r-bolditalic--0-0-0-0-m-0-iso8859-1

3.2) Update the number in the first line of the fonts.scale file.

- Increase this number by the number of fonts that you are adding.

  For example, if you are adding 4 font lines, and the original number was 42, change the first line value to 46.

3.3) Save the fonts.scale file.

4.  Rebuild the fonts.dir for this directory.

# mkfontdir /usr/lpp/X11/lib/X11/fonts/TrueType

5.  Reload the font path to pick up new fonts in /usr/lpp/X11/lib/X11/fonts/TrueType.

# export DISPLAY=YOUR_XSERVER:YOUR_SCREEN
For example,
# export DISPLAY=myAIX_Xserver.com:0
# xset fp rehash
NOTE:  The previous step works only for a local graphical display.  For remote displays, you must serve these fonts from an X11 font server.  (See #8), and the display must use the tcp font server path.
For example, where AIXhostname has a fontserver configured (See #8),
# xset +fp tcp/AIXhostname:7100

6. Check the available font listing for the new font.

# cd $HOME
# xlsfonts -l "*CUSTOM_FONT*"

 - This should return the following entries:

-monotype-CUSTOM_FONT-medium-r-bold--0-0-0-0-m-0-iso8859-1
-monotype-CUSTOM_FONT-medium-r-bolditalic--0-0-0-0-m-0-iso8859-1
-monotype-CUSTOM_FONT-medium-r-italic--0-0-0-0-m-0-iso8859-1
-monotype-CUSTOM_FONT-medium-r-normal--0-0-0-0-m-0-iso8859-1

7.  You can view the font by running the following X11 client, and selecting the CUSTOM_FONT font family. (Optional)

# export DISPLAY=YOUR_XSERVER:YOUR_SCREEN
# xfontsel

8. Install and configure the AIX X11 Fontserver. (Required for remote displays)

8.1) Install the AIX X11 font server file set.

# installp -qaXgY -e /tmp/inst.log -d . X11.fnt.fontServer

8.2) Configure the font server to start at reboot.

# /usr/bin/X11/xfsconf

8.3) If a reboot is not possible, start the font server from the command line.

# startsrc -s xfs

9.  If the font fails to load, check the following.

a.  Be sure you downloaded the font in binary mode
 (Check file size against download site)
b.  Use 'xset' to verify that the font path includes the correct font path:
# xset -q

Expected output:
* If local display: /usr/lib/X11/fonts/TrueType
* If remote display with font server:  tcp/AIX_FONTSERVER_HOSTNAME:7100

10.  Edit the TrueType fonts.alias file to add a short name font alias. (Optional)

# vi /usr/lib/X11/fonts/TrueType/fonts.alias

10.1) Add the following to the end of the file

   "FONT_ALIAS_STRING" "FONT_NAME_STRING"

      ** (The double quotation marks are required in this file)
For example, add the following line to the /usr/lib/X11/fonts/TrueType/fonts.alias file, to create an alias for the medium normal string from the earlier example:
   "custom_alias" "-Monotype-CUSTOM_FONT-medium-r-normal--0-0-0-0-m-0-iso8859-1"

10.2) Save the fonts.alias file.

10.3) Reload the font path to pick up new font alias.

# export DISPLAY=YOUR_XSERVER:YOUR_SCREEN
For example,
# export DISPLAY=myAIX_Xserver.com:0
# xset fp rehash

10.4) Test the font availability and retrieve long listing of information.

# xlsfonts -lll "custom_alias"
Simple demonstration with Open Source "mkfontscale"
Important Notes:
Prereqs:
AIX Fontserver (X11.fnt.fontServer)
X11 True Type Fonts (X11.ucs.ttf)
AIX Virtual Frame Buffer (X11.vfb)
AIX Toolbox for Open Source (mkfontscale)
Non-AIX True Type or World Type Font (This example uses GNU Free Fonts )

Steps:
X.1) Download the Free Fonts
# cd /sftp
# wget http://ftp.gnu.org/gnu/freefont/freefont-ttf-20120503.zip
# unzip /sftp/freefont-ttf-20120503.zip *.ttf

X.2) Install the required X11 file sets from AIX Base Media
# installp -qaXgY  -d <image path> X11.fnt.ucs.ttf X11.vfb X11.fnt.fontServer
X.3) Install the Open Source mkfontscale package
Visit Get Started with the AIX Toolbox for Open Source Software to learn more about DNF and the dnf_aixtoolbox.sh installer script.
 
# dnf install mkfontscale
X.4) Use mkfontscale to create fonts.scale.
# mkfontscale /tmp/freefont-20120503
  
X.5) Get font scale headings for the font.scale files.
We need to increase the TrueType file by the count from the custom "freefont" file.
# head -1 /tmp/freefont-20120503/fonts.scale --> 184
# head -1 /usr/lib/X11/fonts/TrueType/fonts.scale --> 423
X.6) Calculate the new value
 184
+423
----
 607
X.7) Backup the TrueType fonts.scale
# cp /usr/lib/X11/fonts/TrueType/fonts.scale /usr/lib/X11/fonts/TrueType/fonts.scale.backup
X.8) Copy the new font files to the default /usr/lib/X11/fonts/TrueType directory.
# cp /tmp/freefont-20120503/*.ttf /usr/lib/X11/fonts/TrueType
 
X.9) Modify the first line in the TrueType fonts.scale
# sed -e '1s/423/607/' /usr/lib/X11/fonts/TrueType/fonts.scale.backup > /usr/lib/X11/fonts/TrueType/fonts.scale
X.10) Append the TrueType fonts.scale with the Free Fonts fonts.scale stanzas
# tail -n +2 /tmp/freefont-20120503/fonts.scale >> /usr/lib/X11/fonts/TrueType/fonts.scale
X.11) Verify the new line counts.  
The count should be the value of the (first line +1 )
# wc -l  /usr/lib/X11/fonts/TrueType/fonts.scale
608 /usr/lib/X11/fonts/TrueType/fonts.scale
X.12) Rebuild the fonts.dir
# mkfontdir /usr/lpp/X11/lib/X11/fonts/TrueType
X.13) Start a local virtual Xserver 
This step verifies that the new fonts are loaded in to the X11 font path. You will not be able to see the fonts.
# X -vfb :0
# DISPLAY=:0;xlsfonts | grep -i freemono
-misc-freemono-bold-o-normal--0-0-0-0-m-0-iso10646-1
-misc-freemono-bold-o-normal--0-0-0-0-m-0-iso8859-1
-misc-freemono-bold-o-normal--0-0-0-0-m-0-iso8859-10
-misc-freemono-bold-o-normal--0-0-0-0-m-0-iso8859-15
-misc-freemono-bold-o-normal--0-0-0-0-m-0-iso8859-2
-misc-freemono-bold-o-normal--0-0-0-0-m-0-iso8859-3
-misc-freemono-bold-o-normal--0-0-0-0-m-0-iso8859-4
-misc-freemono-bold-o-normal--0-0-0-0-m-0-iso8859-5
-misc-freemono-bold-o-normal--0-0-0-0-m-0-iso8859-8
-misc-freemono-bold-o-normal--0-0-0-0-m-0-iso8859-9
-misc-freemono-bold-o-normal--0-0-0-0-m-0-koi8-e
-misc-freemono-bold-o-normal--0-0-0-0-m-0-koi8-r
-misc-freemono-bold-o-normal--0-0-0-0-m-0-koi8-ru
-misc-freemono-bold-o-normal--0-0-0-0-m-0-koi8-u
-misc-freemono-bold-o-normal--0-0-0-0-m-0-koi8-uni
-misc-freemono-bold-r-normal--0-0-0-0-m-0-iso10646-1
-misc-freemono-bold-r-normal--0-0-0-0-m-0-iso8859-1
-misc-freemono-bold-r-normal--0-0-0-0-m-0-iso8859-10
-misc-freemono-bold-r-normal--0-0-0-0-m-0-iso8859-15
-misc-freemono-bold-r-normal--0-0-0-0-m-0-iso8859-2
-misc-freemono-bold-r-normal--0-0-0-0-m-0-iso8859-3
-misc-freemono-bold-r-normal--0-0-0-0-m-0-iso8859-4
-misc-freemono-bold-r-normal--0-0-0-0-m-0-iso8859-5
-misc-freemono-bold-r-normal--0-0-0-0-m-0-iso8859-8
-misc-freemono-bold-r-normal--0-0-0-0-m-0-iso8859-9
-misc-freemono-bold-r-normal--0-0-0-0-m-0-koi8-e
-misc-freemono-bold-r-normal--0-0-0-0-m-0-koi8-r
-misc-freemono-bold-r-normal--0-0-0-0-m-0-koi8-ru
-misc-freemono-bold-r-normal--0-0-0-0-m-0-koi8-u
-misc-freemono-bold-r-normal--0-0-0-0-m-0-koi8-uni
-misc-freemono-medium-o-normal--0-0-0-0-m-0-iso10646-1
-misc-freemono-medium-o-normal--0-0-0-0-m-0-iso8859-1
-misc-freemono-medium-o-normal--0-0-0-0-m-0-iso8859-10
-misc-freemono-medium-o-normal--0-0-0-0-m-0-iso8859-15
-misc-freemono-medium-o-normal--0-0-0-0-m-0-iso8859-2
-misc-freemono-medium-o-normal--0-0-0-0-m-0-iso8859-3
-misc-freemono-medium-o-normal--0-0-0-0-m-0-iso8859-4
-misc-freemono-medium-o-normal--0-0-0-0-m-0-iso8859-5
-misc-freemono-medium-o-normal--0-0-0-0-m-0-iso8859-8
-misc-freemono-medium-o-normal--0-0-0-0-m-0-iso8859-9
-misc-freemono-medium-o-normal--0-0-0-0-m-0-koi8-e
-misc-freemono-medium-o-normal--0-0-0-0-m-0-koi8-r
-misc-freemono-medium-o-normal--0-0-0-0-m-0-koi8-ru
-misc-freemono-medium-o-normal--0-0-0-0-m-0-koi8-u
-misc-freemono-medium-o-normal--0-0-0-0-m-0-koi8-uni
-misc-freemono-medium-r-normal--0-0-0-0-m-0-iso10646-1
-misc-freemono-medium-r-normal--0-0-0-0-m-0-iso8859-1
-misc-freemono-medium-r-normal--0-0-0-0-m-0-iso8859-10
-misc-freemono-medium-r-normal--0-0-0-0-m-0-iso8859-15
-misc-freemono-medium-r-normal--0-0-0-0-m-0-iso8859-2
-misc-freemono-medium-r-normal--0-0-0-0-m-0-iso8859-3
-misc-freemono-medium-r-normal--0-0-0-0-m-0-iso8859-4
-misc-freemono-medium-r-normal--0-0-0-0-m-0-iso8859-5
-misc-freemono-medium-r-normal--0-0-0-0-m-0-iso8859-6
-misc-freemono-medium-r-normal--0-0-0-0-m-0-iso8859-8
-misc-freemono-medium-r-normal--0-0-0-0-m-0-iso8859-9
-misc-freemono-medium-r-normal--0-0-0-0-m-0-koi8-e
-misc-freemono-medium-r-normal--0-0-0-0-m-0-koi8-r
-misc-freemono-medium-r-normal--0-0-0-0-m-0-koi8-ru
-misc-freemono-medium-r-normal--0-0-0-0-m-0-koi8-u
-misc-freemono-medium-r-normal--0-0-0-0-m-0-koi8-uni
At this point, the fonts are available in the local X11 environment. If you need to serve these fonts, you must restart the font server. See Section 8 for font server details.
SUPPORT

If you require more assistance, use the following step-by-step instructions to contact IBM to open a case for software with an active and valid support contract.  

1. Document (or collect screen captures of) all symptoms, errors, and messages related to your issue.

2. Capture any logs or data relevant to the situation.

3. Contact IBM to open a case:

   -For electronic support, see the IBM Support Community:
     https://www.ibm.com/mysupport
   -If you require telephone support, see the web page:
      https://www.ibm.com/planetwide/

4. Provide a clear, concise description of the issue.

 - For guidance, see: Working with IBM AIX Support: Describing the problem.

5. If the system is accessible, collect a system snap, and upload all of the details and data for your case.

 - For guidance, see: Working with IBM AIX Support: Collecting snap data

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG10","label":"AIX"},"ARM Category":[{"code":"a8m0z000000cw2mAAA","label":"Desktop-\u003EX11 Clients"},{"code":"a8m0z000000cw2uAAA","label":"Desktop-\u003EXserver"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Version(s)","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

Modified date:
22 September 2023

UID

isg3T1024476