Knowledge Base - Technical Articles


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

Article ID: 39941
Bug Id: N/A
Software:  ArcGIS for Desktop Advanced 10.1 ArcGIS for Desktop Standard 10.1 ArcGIS for Desktop Basic 10.1
Platforms:  Windows XP, Server 2003, Vista, Server 2008, Windows 7

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, 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. -show me-

    ############### Examples of Setting Local Fonts #################

    #### English, French, German, Italian, Spanish ####
    #### Set Default to None, Base Font Should Work ####
    fontFilePathName = None
    fontFileBoldName = None

    #################### 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'

    ######################## Arabic #############################

    #### Windows 7 / Windows Vista (Arabic Typesetting Regular) ####
    #### Uncomment the Following Two Lines ####
    #fontFilePathName = r'C:\Windows\Fonts\arabtype.ttf'
    #fontFileBoldName = r'C:\Windows\Fonts\arabtype.ttf'

    #### Linux (PakTypeNaqsh) ####
    #### Uncomment the Following Two Lines ####
    #fontFilePathName = '/usr/share/fonts/arabic/PakTypeNaqsh.ttf'
    #fontFileBoldName = '/usr/share/fonts/arabic/PakTypeNaqsh.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.

     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 Arabic language pack on a Windows 7 machine, modify the above code block as follows (notice the # character has been removed). -show me-

    ######################## Arabic #############################

    #### Windows 7 / Windows Vista (Arabic Typesetting Regular) ####
    #### Uncomment the Following Two Lines ####
    fontFilePathName = r'C:\Windows\Fonts\arabtype.ttf'
    fontFileBoldName = r'C:\Windows\Fonts\arabtype.ttf'

    #### Linux (PakTypeNaqsh) ####
    #### Uncomment the Following Two Lines ####
    #fontFilePathName = '/usr/share/fonts/arabic/PakTypeNaqsh.ttf'
    #fontFileBoldName = '/usr/share/fonts/arabic/PakTypeNaqsh.ttf'

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



  6. If using the Japanese language pack, the font size needs to be smaller than other fonts. If you are 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).-show me-

    #### 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)
    ##########################################################



     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:

    -show me-

    #### * 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.

Created: 2/24/2012
Last Modified: 8/29/2012

If you would like to post a comment, please login