PROBLEM

PDF reports have missing or incorrect characters when the Chinese, Japanese, or Arabic language pack is installed

Last Published: April 25, 2020

Description

For ArcGIS 10.1 with the Chinese, Japanese, Russian, or Arabic language pack installed and the Display Language is set, the optional PDF report files created when running Ordinary Least Squares Regression, Grouping Analysis, and Incremental Spatial Autocorrelation may have missing or incorrect characters.

Cause

Esri uses open source Matplotlib software to create the PDF report files. The default Matplotlib font files used by that software are not correct for Chinese, Japanese, Russian, and Arabic languages.

Solution or Workaround

To resolve this issue with Japanese, Chinese, or other left-to-right languages, the font setting in the Python script used must be changed to generate the report.

  1. Browse to the script called SSReport.py located at:

    <ArcGIS Install Directory>\ArcToolbox\Scripts

  2. Create a backup of the script SSReport.py that can be reverted to if needed.
  3. Open SSReport.py using a Python or text editor and locate the following section of code.

    #################### Chinese/Japanese #######################

    #### Windows 7 / Windows Vista (Microsoft YaHei) ####
    #### Uncomment the Following Two Lines ####
    #fontFilePathName = r'C:\Windows\Fonts\msyh.ttf'
    #fontFileBoldName = r'C:\Windows\Fonts\msyhbd.ttf'

    #### Linux (UMING) ####
    #### Uncomment the Following Two Lines ####
    #fontFilePathName = '/usr/share/fonts/chinese/TrueType/uming.ttf'
    #fontFileBoldName = '/usr/share/fonts/chinese/TrueType/uming.ttf'

    ######################## Russian ###########################

    #### Windows 7 / Windows Vista (Arial) ####
    #### Uncomment the Following Two Lines ####
    #fontFilePathName = r'C:\Windows\Fonts\arial.ttf'
    #fontFileBoldName = r'C:\Windows\Fonts\arial.ttf'

    #### Linux (DejaVu Sans) ####
    #### Uncomment the Following Two Lines ####
    #fontFilePathName = '/usr/share/fonts/dejavu-lgc/DejaVuLGCSans.ttf'
    #fontFileBoldName = '/usr/share/fonts/dejavu-lgc/DejaVuLGCSans.ttf'

    ####################################################

  4. Within the code, find the fontFilePathName and fontFileBoldName variables for the operating system used and language. Check to make sure that the font file specified in the corresponding path exists on the system.

    Note:
    If the font file cannot be found at the specified location, or if ArcGIS is running on a different operating system (Windows XP, for example), see if the font file exists at another location on the computer. If the recommended font file still can’t be located, a font vendor or distributor must be found who can provide this file (such as the Microsoft Download Center).

    The font files specified in SSReport.py have been tested with ArcGIS 10.1 for the Ordinary Least Squares, Grouping Analysis, and Incremental Spatial Autocorrelation tools. Other fonts might create correctly formatted PDF reports as well.

  5. Remove the '#' character (using the Backspace or Delete key) to uncomment the Python code that sets the path to the font for the language setting. For example, if running ArcGIS with the Chinese language pack on a Windows 7 machine, modify the above code block as follows (notice the # character has been removed).

    #################### Chinese/Japanese #######################

    #### Windows 7 / Windows Vista (Microsoft YaHei) ####
    #### Uncomment the Following Two Lines ####
    fontFilePathName = r'C:\Windows\Fonts\msyh.ttf'
    fontFileBoldName = r'C:\Windows\Fonts\msyhbd.ttf'

    #### Linux (UMING) ####
    #### Uncomment the Following Two Lines ####
    #fontFilePathName = '/usr/share/fonts/chinese/TrueType/uming.ttf'
    #fontFileBoldName = '/usr/share/fonts/chinese/TrueType/uming.ttf'

    ###########################################################



  6. If using the Japanese language pack, the font size needs to be smaller than other fonts. If using ArcGIS 10.1 with no service pack, locate the following section of code and reduce the font size values by 2 (size = 10 would be changed to size = 8, for example).

    #### Create Spatial Stats PDF Fonts ####
    ssFont = createFont(fontFilePathName = fontFilePathName,
    size = 10)
    ssBoldFont = createFont(fontFilePathName = fontFileBoldName,
    weight = 'semibold', size = 10)
    ssBigFont = createFont(fontFilePathName = fontFilePathName,
    size = 12)
    ssSmallFont = createFont(fontFilePathName = fontFilePathName,
    size = 8)
    ssLabFont = createFont(fontFilePathName = fontFileBoldName,
    weight = 'semibold', size = 12)
    ssTitleFont = createFont(fontFilePathName = fontFileBoldName,
    weight = 'semibold', size = 14)
    ##########################################################



    Note:
    Beginning with Service Pack 1 for ArcGIS 10.1, the following code was added to SSReport.py. To use these font settings, uncomment each line by removing the first '#' symbol as shown below:

    #### * Special Font Decrease for Japanese * ####
    ssFont = createFont(fontFilePathName = fontFilePathName,
    size = 8)
    ssBoldFont = createFont(fontFilePathName = fontFileBoldName,
    weight = 'semibold', size = 8)
    ssBigFont = createFont(fontFilePathName = fontFilePathName,
    size = 10)
    ssSmallFont = createFont(fontFilePathName = fontFilePathName,
    size = 6)
    ssLabFont = createFont(fontFilePathName = fontFileBoldName,
    weight = 'semibold', size = 10)
    ssTitleFont = createFont(fontFilePathName = fontFileBoldName,
    weight = 'semibold', size = 12)

    ##########################################################

  7. Save the changes and close the Python or text editor.

    Note:
    For Arabic and other right-to-left languages, there currently are no good workarounds. The alternatives are:
    1) Elect not to create the optional PDF report; the information in the report is written to the Results Window.
    2) Use the default English language pack while creating the PDF report files to obtain English language reports.

Article ID:000011486

Software:
  • ArcMap

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic