docs:gis:mapserver:using_truetype_fonts

Using Truetype Fonts with MapServer

  • create a file called “fontset.txt”; the first item will be the font identifier for reference in your mapfiles, and the second item on each line will be the path to the truetype font file:
    arial	/path/to/font/files/arial.ttf
  • reference the fontset.txt file at the beginning of a .map file like this:
    MAP
    	SIZE 800 600
    	EXTENT -742509 3537635 708118 4538138
    	IMAGECOLOR 153 179 204
    	
    	FONTSET fontset.txt
    
    	IMAGETYPE PNG24 # - HUGE BUT LOOKS GOOD
    	
    	PROJECTION
    		"proj=merc"
    		"ellps=WGS84"
    		"lat_0=34.24"
    		"lon_0=-111.62"
    	END
    
    ...
  • modify your LABEL section like this (8 is a point size):
    LABEL
    	TYPE truetype
    	FONT "arial"
    	SIZE 8
    ...
  • :!: make sure the fontset.txt and referenced truetype font files are accessible by your web server
    • if this is not set up correctly, you may be able to make a map with shp2img, but cgi mapserv will fail in a web browser
  • docs/gis/mapserver/using_truetype_fonts.txt
  • Last modified: 2008/08/03 00:25
  • by 127.0.0.1