Home > other >  Geoserver SLD with custom font not loading the characters from the custom font
Geoserver SLD with custom font not loading the characters from the custom font

Time:08-19

I migrated my SLD styles from a Geoserver 2.21.0 running on Jetty to a Geoserver 2.21.0 running on Tomcat 9, both are running Ubuntu Linux 22.04.

We created two custom fonts that work fine on Jetty, but on Tomcat9 the characters are not displayed correctly.

The fonts have .ttf extension and are located inside a the truetype system folder: /usr/share/fonts/truetype/folder_name

To manage the system fonts I installed: sudo apt-get install fontconfig

Everytime a font gets added I run: sudo fc-cache -fv And I restart the Tomcat service: sudo systemctl restart tomcat9

Both Geoservers list the fonts as installed, but only on Jetty I get the correct character rendered, as shown in the the following images:

Wrong character rendered

Correct character rendered

I tried placing the fonts in the JDK lib folder, and creating a fonts folder, and restaring the tomcat9 service but it didn' work: /usr/lib/jvm/java-1.11.0-openjdk-amd64/lib/fonts

CodePudding user response:

For some reason unknown to me the .ttf font files got modified, the index number of the character moved to the next integer, 1. Example: 59653 became 59654.

To solve this problem, I had to download the fonts from a fresh copy stored in a different computer, where the fonts where created originally.

And then: sudo fc-cache -fv and restart tomcat sudo systemctl restart tomcat9

  • Related