Skip to content

Custom fonts for labels in GeoServer

Geoserver has capability of loading fonts externally whenever required. It supports True Type Fonts and this blog, we'll discover how to add them.

We recently worked on the project where client had data in Hindi langauge and even though the data was visible in layer preview, it was not in style.

Image title

Download font (.TTF )

We first need to find out correct font that can load our text, you can simply Google ( or DuckDuck ) hindi ttf fonts and download the font.

Put font in data_dir

We need to put font in geoserver in order to use it. the path to follow is


Reload geoserver

Once you put .ttf file in correct location , go to geoserver and Clear Resource cache and Reload configuration and catelog

Image title

Confirm font name

To confirm if the font is added successfully, run following Geoserver REST API.

curl --location 'http://IP:8080/geoserver/rest/fonts.json' \
--header 'Authorization: Basic YWRtaW46eW91cmdlb3NlclcnBhc3N3b3Jk'

in the response check for the font you have added

Image title

Use font in the style

You can then start using the same font name as shown by REST API in geoserver style.

    <CssParameter name="font-family">Akshar Unicode</CssParameter>
    <CssParameter name="font-style">Normal</CssParameter>
    <CssParameter name="font-weight">bold</CssParameter>
    <CssParameter name="font-size">12</CssParameter>
Image title