14

I want to use a custom font I have downloaded from the web with Geoserver for my labels. How do I specify the location of my font so that the font-family css parameter can read it?

Geoserver 2.1.4

3 Answers 3

16

You put your custom TTF-fonts in the catalog styles which are located in your data directory.

Then you need to Clear Resource Cache under Server Status so that the font will be loaded by the server!

This is a new functionality from 2.1.x.

3
  • I did the above steps no luck so far, do I just specify in my sld as <sld:Font><sld:CssParameter name="font-family">"fontName".ttf</sld:CssParameter></sld:Font>? Or is there a special way of specifying?
    – Ando
    Commented Jul 25, 2012 at 0:21
  • Apolologies for the above comment, I had got the font name wrong. Also you do not require the .ttf extension.
    – Ando
    Commented Jul 25, 2012 at 0:35
  • Two additions on this: 1. Workspaces also contain a directory named "styles" but you need to place the font files next to the global styles (data directory/styles). 2. Using the filename will not work, it has to be the font's name. You can check installed names by using the REST-API, see docs.geoserver.org/stable/en/user/rest/fonts.html. Commented Jul 14, 2023 at 11:48
3

Puting my font files (*.ttf) to (...)/geoserver/data/styles still works in version 2.6? I put files there, cleared resources cache and in full list of available fonts they don't exist.

2
  • Did you get this resolved?
    – Alex Leith
    Commented Oct 7, 2015 at 0:59
  • and for linux users: in addition to the /styles folder in the gdal-data directory you'll have to place fonts somewhere like /usr/java/jdk1.8.0_144/jre/lib/fonts then restart Geoserver before they're visible in the Geoserver GUI "Fonts available to JVM"
    – cm1
    Commented Aug 28, 2018 at 16:38
1

Moving the ttf's into the data_dir of GeoServer didn't work out for me, too. So, I simply put them into C:/Windows/Fonts, cleared the ressource cache and voilà! Now they are available on GeoServer.

My environment: Windows Server 2008 R2 with GeoServer 2.10.1.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.