Bug#799473: No fonts in python-mapnik 3
Sebastiaan Couwenberg
sebastic at xs4all.nl
Wed Oct 14 21:59:54 UTC 2015
On 14-10-15 23:00, Ruben Undheim wrote:
> If I run this in Jessie:
>
> #!/usr/bin/env python
>
> from mapnik import *
> for face in FontEngine.face_names():
> print face
>
> I get a long list of fonts (100 or so).
>
> In sid, I get no output.
The new python-mapnik in sid is still a work in progress, hence the git
snapshots instead of proper releases.
The default font path doesn't have any fonts, so you need to set
MAPNIK_FONT_DIRECTORY in the environment. For example:
$ MAPNIK_FONT_DIRECTORY=/usr/share/fonts/truetype/liberation python
/tmp/mapnik-fonts.py
Liberation Mono Bold
Liberation Mono Bold Italic
Liberation Mono Italic
Liberation Mono Regular
Liberation Sans Bold
Liberation Sans Bold Italic
Liberation Sans Italic
Liberation Sans Narrow Bold
Liberation Sans Narrow Bold Italic
Liberation Sans Narrow Italic
Liberation Sans Narrow Regular
Liberation Sans Regular
Liberation Serif Bold
Liberation Serif Bold Italic
Liberation Serif Italic
Liberation Serif Regular
The old python-mapnik on jessie used the following default paths:
mapniklibpath = '/usr/lib/mapnik/2.2'
mapniklibpath = normpath(join(dirname(__file__),mapniklibpath))
inputpluginspath = join(mapniklibpath,'input')
fontscollectionpath = normpath('/usr/share/fonts')
The new python-mapnik on sid expects them all under mapniklibpath:
mapniklibpath = '/usr/lib/mapnik'
mapniklibpath = os.path.normpath(mapniklibpath)
inputpluginspath = os.path.join(mapniklibpath,'input')
fontscollectionpath = os.path.join(mapniklibpath,'fonts')
We can probably fix this by setting SYSTEM_FONTS=/usr/share/fonts in the
environment for the python-mapnik build to have it use that for the
fontscollectionpath instead of /usr/lib/mapnik/fonts as it does now.
When SYSTEM_FONTS is set in the environment build.py generates
mapnik/paths.py using the system fonts, but it seems setup.py creates
mapnik/paths.py before build.py is called, and setup.py unconditionally
sets fontscollectionpath to os.path.join(mapniklibpath,'fonts'). Because
mapnik/paths.py already exists, build.py doesn't generate it again.
So we'll need to patch python-mapnik to also support the SYSTEM_FONTS
option in setup.py.
Kind Regards,
Bas
--
GPG Key ID: 4096R/6750F10AE88D4AF1
Fingerprint: 8182 DE41 7056 408D 6146 50D1 6750 F10A E88D 4AF1
More information about the Pkg-grass-devel
mailing list