Providing geoscience data globally oneGeology logo Navigation
Main content
Bottom links

OneGeology

Home > How to serve a OneGeology WMS > Setting up a MapServer WMS > Configuring your MapServer WMS > Alt character set

4.3.2 Adding alternate character set support

If you are serving a non-English language service, you may need or want to change the font and character sets.

To specify a font set you need to use the FONTSET keyword which references a file that contains the mappings from the font name aliases, which you will use in your map file, to the actual font file names on your computer.

MAP
    NAME BGS_EN_Bedrock_and_Superficial_Geology
    # Root layer name
    STATUS ON
    SIZE 600 600
    EXTENT -8.6476 49.8639 1.76943 60.8622
    UNITS dd 
    SHAPEPATH “data”
    IMAGECOLOR 255 255 255
    FONTSET “fontset.txt”

The path to the fontset.txt file is relative to the location of the map file. In this example (above) then, the fontset.txt file is located in the same folder as the map file.

A fontset.txt file may look like:

arial C:\WINDOWS\Fonts\ARIAL.TTF
msgothic C:\WINDOWS\Fonts\MSGOTHIC.TTC
msmincho C:\WINDOWS\Fonts\MSMINCHO.TTC

You only need one font specified in your map file but you may list as many as you like in your font set file. To get the font specified in the font file to be used by the map service you now need to modify the LABEL section of the LEGEND, as in the below example, which would allow you to display Chinese characters.

LEGEND
    OUTLINECOLOR 200 200 200
    KEYSPACING 10 10
    LABEL
        TYPE truetype
        FONT msgothic
        SIZE 8
        ENCODING UTF-8
    END
END

The important parts to note in the above example are:

  • TYPE truetype (the default is TYPE bitmap)
  • FONT msgothic (the font alias we set up in our fontset.txt file)
  • SIZE 8 (size should be specified in points, you can’t use words like “small” or “medium” which you do with bitmap fonts.)
  • ENCODING UTF-8 (You must also save your map file in this character set encoding).

Section last modified: 31 August 2011.

Back | Next

OneGeology © 2014. This site is hosted by the British Geological Survey but responsibility for the content of the site lies with OneGeology not with the British Geological Survey. Questions, suggestions or comments regarding the contents of this site should be directed to the OneGeology administration.