How to Use a Custom TrueType Font With an Embedded UI

Updated Nov 6, 2023

Environment

Hardware

  • cRIO-9030

Software

  • LabVIEW Embedded Control and Monitoring Suite

By default, the font shown in the Linux RT Embedded UI is like the one below.
Embedded UI
There is a way to change the font type in the Linux RT embedded UI, like that shown in LabVIEW on the host PC.
LabVIEW Front Panel
To make sure the font types in the Linux RT Embedded UI follow that on the LabVIEW host PC, we could use the same TrueType font under the NI Linux RT Embedded UI and Windows host PC. 

In this article, we will demonstrate the steps to use a custom TrueType font with the NI Linux RT Embedded UI device.

To use the custom fonts in Embedded UI, you could refer to the steps below.
  1. Installing or transferring the fonts which you want to use to the NI Linux Real-Time device. You could find detailed information about the tools for transferring in the related links section. You could also copy and transfer the fonts from Windows Fonts file to NI Linux RT device.
    • We created a folder named TrueType under this path - /usr/share/fonts in this article, and the fonts are transferred to this folder.
  2. Accessing the Shell on NI Linux Real-Time Devices.
  3. Change the working path to the folder created previously.
  4. Using mkfontscale and mkfontdir to create an index of scalable font files and an index of X font files. Make sure that the files of font.dir and font.scale are created under the folder.
Putty.png
  1. Create a file named 10-fonts.conf with the content below. Where <the folder of fonts> is the folder created previously, /usr/share/fonts/TrueType will be used in this example.
Section "Files"
    FontPath   "<the folder of fonts>"
EndSection
  1. Transfer the file (10-fonts.conf) to the device under this path - /usr/share/X11/xorg.conf.d.
  2. Reboot the device.

After the device rebooted, run the vi again and the font will display correctly in Embedded UI.
CleanShot 2021-05-21 at 14.42.49@2x.png
 

Next Steps

Additional Information:

Not all font types in the Linux RT Embedded UI could show the same font type as those on the Windows host PC. Even though the font type is TrueType, this does not mean the Linux RT Embedded UI could read all the font types properly, especially those that involve Unicode, such as Chinese characters. This is because Linux RT Embedded UI falls under the Unix-like family. The Unix operating system provides a set of simple tools, each of which performs a limited, well-defined function.