python-mapnik icon indicating copy to clipboard operation
python-mapnik copied to clipboard

Cannot set face_name on TextSymbolizer

Open larsga opened this issue 5 years ago • 1 comments

I tried:

    ts = mapnik.TextSymbolizer()
    ts.face_name = 'Arial.ttf'

but that failed with:

Traceback (most recent call last):
  File "europe-now-map.py", line 5, in <module>
    themap = config.make_europe_all_map()
  File "/Users/larsga/cvs-co/farmhouse/config.py", line 21, in make_europe_all_map
    east = -5, west = 55, south = 50, north = 65
  File "/Users/larsga/cvs-co/fhdb/reports/mapniklib.py", line 60, in make_simple_map
    ts.face_name = 'Arial.ttf'
  File "/usr/local/lib/python2.7/site-packages/mapnik/__init__.py", line 800, in face_name
    self.format.face_name = face_name
AttributeError: 'TextSymbolizer' object has no attribute 'format'

larsga avatar Dec 26 '19 21:12 larsga

I can't set it with ShieldSymbolizer, either.

Does this mean it's not possible to render text with Python mapnik? I really need this for maps that are to appear in a book, and my deadline is approaching. Some tips would be much appreciated.

larsga avatar Dec 26 '19 21:12 larsga