Successfully!

Error!

Install fonts on the server

  • Last update:  2022-01-14
  • I. Overview

    1. Problem description

    1) When the user prints and exports, there will be inconsistencies with the preview result. like:

    • In the Linux environment, it is found that the client preview is normal, but garbled characters appear when exporting or printing, or some special symbols such as the renminbi symbol are found to be changed into the dollar sign $ when exporting or printing.

    • On the client side of the Linux system, the previewed or exported pictures are garbled.

    • The print preview under Linux has ghosting.

    • The Linux server export text overlaps.

    • The Chinese in the chart becomes a frame when exporting pdf.

    • Originally, the font set was Microsoft Yahei, but the exported PDF is Times New Roman.

    • Insert slashes garbled, slashes are boxes.

    2) The font previewed under the local designer project is normal and saved on the server. When previewing through the server, the effect is inconsistent with the designer project preview.

    3) Report slash is missing in  Linux system .

    4) In the Linux system, insert a subreport into the main report. If the subreport has Chinese characters, Chinese garbled characters will appear when displayed in the main report, but the Chinese characters will not be garbled when other parts of the main report or subreports are accessed separately. 


    2. Cause analysis

    • When exporting or printing from the client, the fonts used are the system fonts of the server and the fonts under the JRE that the server relies on. If the server does not have the fonts selected by the designer during the design, garbled characters or fonts may be replaced.

    • When the designer is designing the report, it uses the font of the local system of the device where the designer is located . After it is saved on the server, if the server does not have the font selected by the designer during the design, the preview will be inconsistent.

    • For the Linux system,  Java may not have the corresponding font when drawingString, and the slash will be lost at this time.

    • When inserting a subreport, in fact, the picture is drawn in advance on the server side. When the client requests to access the main report, it will call the drawn picture. When the inserted subreport contains Chinese, the language pack in the operating system will be called. If the Chinese language pack is not installed in Linux, it will cause garbled characters.


    3. Solutions

    The server installs the missing font package.

    Note 1: After the server is installed, if the font effect is to be displayed in the client browser preview, the client system must also install the font.

    Note 2: In a cluster environment, the missing fonts need to be installed on all nodes.

    II. How to install Linux system

    1. Check the Chinese language pack

    Check if there is a font package in the system zh_cn.UTF-8 To check whether the system default language is zh_cn.UTF-8 ,As shown below:

    locale -a | grep zh_CN                                              

    1.png

    If not, please refer to the method of installing Chinese language pack and setting system default language: Installing Chinese language pack on Linux system


    2. Confirm missing fonts

    Check the part of the font in question to identify the font that may be missing. For example, missing bold, as shown in the following figure:

    2.png


    10.0.16 and later versions support the detection of fonts used when creating templates or previewing templates. If the corresponding fonts are not included, the designer or user will be prompted, and the designer or user does not need to find the missing fonts by themselves. For details, please refer to: font missing detection


    3. Install missing fonts

    1) Use fc-list Check the font library, as shown in the figure below:

    Note: If prompted:-bash: fc-list: command not found,use yum -y install fontconfigAfter the statement, check the font library again.

    3.png

    2) in /usr/share/fontsCreate a new directory under the directory chinese, Put the local Windows system C:\Windows\FontsFonts in, upload to /usr/share/fonts/chineseUnder contents. For example, upload the Heibo Regular font, as shown in the figure below:

    5.png

    3) ModifychineseFolder permissions, as shown in the figure below:

    chmod -R 755 /usr/share/fonts/chinese

    6.png

    4) Execute the following command:

    cd /usr/share/fonts/chinese
    mkfontscale #Font extension
    mkfontdir #New font catalog
    fc-cache -fv #Refresh the cache, or execute
    fc-cache /usr/share/fonts/chinese/fc-list #View system fonts

    If executed mkfontscale,hint mkfontscale: command not found, Need to install:yum install mkfontscale.

    Excuting an order:fc-list | grep simhei.ttf To check whether the installation is successful, as shown in the following figure:

    7.png


    4. Restart the project

    After the font is installed, restart the project. The corresponding font will be displayed when previewing, exporting, and printing.

    III. How to install on Windows

    1. Confirm missing fonts

    Check the part of the font in question to identify the font that may be missing. For example, missing Arial, as shown in the following figure:

    8.png

    10.0.16 and later versions support the detection of fonts used when creating templates or previewing templates. If the corresponding fonts are not included, the designer or user will be prompted, and the designer or user does not need to find the missing fonts by themselves. 


    2. Install missing fonts

    Confirm server C:\Windows\Fonts When there is no corresponding font in the folder, import the downloaded font to C:\Windows\Fonts Folder, or directly install in the system's font settings. If there is no black body in the system, directly inC:\Windows\Fonts Import fonts in the folder. As shown below:

    9.png


    3. Restart the project

    After the font is installed, restart the project. The corresponding font will be displayed when previewing, exporting, and printing.

    Note: After the font is installed, if you encounter the situation that the font cannot be read, you can copy the font to the server JDK_HOME/jre/lib/fonts directory and restart the container where the project is located.

    Attachment List


    Theme: Deployment and Integration
    Already the First
    Already the Last
    • Helpful
    • Not helpful
    • Only read

    Doc Feedback