Skip to content

Commit

Permalink
add mapnik.fontFiles api to expose where face_names were registered f…
Browse files Browse the repository at this point in the history
…rom (requires latest mapnik)
  • Loading branch information
Dane Springmeyer committed Jul 29, 2011
1 parent dd7e2bf commit 2fa66f6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -48,7 +48,7 @@

node (development headers) >= v0.2.3

mapnik 2.0 / (latest trunk >= r3023)
mapnik 2.0 / (latest trunk >= r3055)

node-pool for some examples (npm install -g generic-pool)

Expand Down
14 changes: 14 additions & 0 deletions src/mapnik_fonts.hpp
Expand Up @@ -77,6 +77,20 @@ static inline Handle<Value> available_font_faces(const Arguments& args)
return scope.Close(a);
}

static inline Handle<Value> available_font_files(const Arguments& args)
{
HandleScope scope;
std::map<std::string,std::string> const& mapping = mapnik::freetype_engine::get_mapping();
Local<Object> obj = Object::New();
std::map<std::string,std::string>::const_iterator itr;
for (itr = mapping.begin();itr!=mapping.end();++itr)
{
obj->Set(String::NewSymbol(itr->first.c_str()),String::New(itr->second.c_str()));
}
return scope.Close(obj);
}


}

#endif // __NODE_MAPNIK_FONTS_H__
1 change: 1 addition & 0 deletions src/node_mapnik.cpp
Expand Up @@ -73,6 +73,7 @@ extern "C" {
NODE_SET_METHOD(target, "datasources", node_mapnik::available_input_plugins);
NODE_SET_METHOD(target, "register_fonts", node_mapnik::register_fonts);
NODE_SET_METHOD(target, "fonts", node_mapnik::available_font_faces);
NODE_SET_METHOD(target, "fontFiles", node_mapnik::available_font_files);
NODE_SET_METHOD(target, "gc", gc);

// Classes
Expand Down
2 changes: 1 addition & 1 deletion wscript
Expand Up @@ -34,7 +34,7 @@ if os.environ.has_key('JOBS'):
def write_mapnik_settings(fonts='',input_plugins=''):
open(settings,'w').write(settings_template % (fonts,input_plugins))

def ensure_min_mapnik_revision(conf,revision=2397):
def ensure_min_mapnik_revision(conf,revision=3055):
# mapnik-config was basically written for node-mapnik
# so a variety of kinks mean that we need a very
# recent version for things to work properly
Expand Down

0 comments on commit 2fa66f6

Please sign in to comment.