TransWikia.com

font error when using mapnik generate_tiles.py

Geographic Information Systems Asked by nomadicME on October 27, 2020

generate_tiles.py has worked fine throughout the transition from mapnik 0.7 to mapnik 2.x in gentoo linux. Now I have switched to debian (wheezy) and I am getting the following error when I run generate_tiles.py:

RuntimeError: Failed to find font face 'unifont Medium' in FontSet 'book-fonts' in map '.../osm.xml'

If I comment out the book-fonts section in fontset-settings.xml.inc, I get:

RuntimeError: Failed to find font face 'unifont Medium' in FontSet 'bold-fonts' in map '.../osm.xml'

However, using tilelite creates the tiles just fine.

$ ls `python -c "import mapnik2;print mapnik2.fontscollectionpath"`
total 9048
drwxr-xr-x  2 root root   4096 2014-10-11 09:10 .
drwxr-xr-x 13 root root   4096 2014-10-11 20:48 ..
-rw-r--r--  1 root root 611212 2011-02-27 07:37 DejaVuSans-BoldOblique.ttf
-rw-r--r--  1 root root 672300 2011-02-27 07:37 DejaVuSans-Bold.ttf
-rw-r--r--  1 root root 580168 2011-02-27 07:37 DejaVuSansCondensed-BoldOblique.ttf
-rw-r--r--  1 root root 631992 2011-02-27 07:37 DejaVuSansCondensed-Bold.ttf
-rw-r--r--  1 root root 576004 2011-02-27 07:37 DejaVuSansCondensed-Oblique.ttf
-rw-r--r--  1 root root 643852 2011-02-27 07:37 DejaVuSansCondensed.ttf
-rw-r--r--  1 root root 345204 2011-02-27 07:37 DejaVuSans-ExtraLight.ttf
-rw-r--r--  1 root root 235848 2011-02-27 07:37 DejaVuSansMono-BoldOblique.ttf
-rw-r--r--  1 root root 313856 2011-02-27 07:37 DejaVuSansMono-Bold.ttf
-rw-r--r--  1 root root 241972 2011-02-27 07:37 DejaVuSansMono-Oblique.ttf
-rw-r--r--  1 root root 333636 2011-02-27 07:37 DejaVuSansMono.ttf
-rw-r--r--  1 root root 611556 2011-02-27 07:37 DejaVuSans-Oblique.ttf
-rw-r--r--  1 root root 720012 2011-02-27 07:37 DejaVuSans.ttf
-rw-r--r--  1 root root 332036 2011-02-27 07:37 DejaVuSerif-BoldItalic.ttf
-rw-r--r--  1 root root 341072 2011-02-27 07:37 DejaVuSerif-Bold.ttf
-rw-r--r--  1 root root 331128 2011-02-27 07:37 DejaVuSerifCondensed-BoldItalic.ttf
-rw-r--r--  1 root root 316440 2011-02-27 07:37 DejaVuSerifCondensed-Bold.ttf
-rw-r--r--  1 root root 338140 2011-02-27 07:37 DejaVuSerifCondensed-Italic.ttf
-rw-r--r--  1 root root 330012 2011-02-27 07:37 DejaVuSerifCondensed.ttf
-rw-r--r--  1 root root 338776 2011-02-27 07:37 DejaVuSerif-Italic.ttf
-rw-r--r--  1 root root 363200 2011-02-27 07:37 DejaVuSerif.ttf

No book font, but there are bold fonts.

These are all the dejavu fonts installed (with their version numbers):

ttf-dejavu                                          2.33-3   
ttf-dejavu-core                                     2.33-3    
ttf-dejavu-extra                                    2.33-3

I’ve seen a few people having this problem around the web, but no solutions offered.

3 Answers

unifont Medium (lowercase) is substituted by Unifont Medium (uppercase) with recent versions.

The reason for that error might be related to the severity argument currently hard-coded inside generate_tiles.py for mapnik.load_map:

mapnik.load_map(self.m, mapfile, True)

It might be either needed to remove/change the unifont Medium reference (lowercase) in the Mapnik style XML file or (better) edit generate_tiles.py and change mapnik.load_map(self.m, mapfile, True) to mapnik.load_map(self.m, mapfile, False):

mapnik.load_map(self.m, mapfile, False)

Answered by ircama on October 27, 2020

You can edit the font name from unifont Medium to Unifont Medium in inc/fontset-settings.xml.inc file.

Answered by Pradeep Asundi on October 27, 2020

apt-get install unifont and in inc/fontset-settings.xml.inc.template replace "unifont Medium" with "Unifont Medium".

Answered by user160311 on October 27, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP