Skip to content

Loading…

Ability to register fonts within XML #168

Closed
artemp opened this Issue · 7 comments

1 participant

@artemp
Mapnik member

Registering fonts, or whole directories of fonts, should be possible via the xml mapfile.

The attached patch enables registration of a specific font file within load_map(), but perhaps there are better ways of doing this.

Also, any thoughts on a better attribute name, whether registration should happen in another element (maybe ), and how to get a list of registered fonts to serialize in save_map() ?

@artemp
Mapnik member

[springmeyer] Given this patch usage would be something like:

{{{
<?xml version="1.0" encoding="utf-8"?>

<br> <Rule><br> <TextSymbolizer name="STATE_ABBR" face_name="Times New Roman Regular" size="12" fill="#000000"></TextSymbolizer><br> </Rule><br>

}}}

@artemp
Mapnik member

[springmeyer] I took a crack at writing up some functions to try to load all fonts within a given directory. It seems to work somewhat, but I've managed to get both bus errors and segmentation faults :)

Perhaps its generally a bad idea to allow wholesale registration of multiple fonts within a directory in c++, but it seems to work fine via glob in python, so hopefully someone can improve and fix my faulty code.

Attached patch add methods to register all .ttf and .otf fonts in a given directory and includes testing print statements.

@artemp
Mapnik member

[springmeyer] this not critical, pushing off till next release...

@artemp
Mapnik member

[springmeyer] r1195 uses similar approach to above patches

@artemp
Mapnik member

[springmeyer] I plan to take a look at this after we can get the 0.7.1 release tested and out in the wild.

@artemp
Mapnik member

[springmeyer] font directory registration functions added in r2025.
ability to trigger these functions via xml added in r2271

@artemp
Mapnik member

[springmeyer] r2273 finishes this up by storing the 'font_directory' in a mapnik::parameter on the map object so that this can be properly serialized with save_map and not lost in translation.

@artemp artemp closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.