3

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.

1

apt-get install unifont

Just worked for me

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

  • 2
    This answer could do with a little more explanation, such as maybe the fonts aren't included as core with that distro or whatever else would explain why they need to be installed separately from whatever else. The answer might solve the problem, but there's not much 'why' there. – Chris W Mar 27 '15 at 19:38
  • At least someone answered :) – Gabor Farkas Feb 20 '16 at 10:13
  • It's an answer. – Travis Webb Jun 3 '16 at 5:53
0

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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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