Hi Dane,

thank you very much! For now, I will make do with adding the fonts one by one (its only three files, anyway).

Best regards,
Julius



Dane Springmeyer wrote:
Hi Julius,

The problem is that the mapnik::freetupe_engine::register_font() function needs 
the full path to a font file.

So, to help with this I recently added to Mapnik trunk, and the 0.7.x 
development branch, the ability to recursively register all viable fonts within 
a directory tree.

So, you can either recompile Mapnik 0.7.2 or take a peek at how this function 
works:

https://trac.mapnik.org/changeset/2026/branches/0.7.2-dev

To grab the 0.7.2 code do:

svn co http://svn.mapnik.org/branches/0.7.2-dev/ mapnik-0.7.2

Dane

On Feb 1, 2011, at 10:00 AM, Julius Ziegler wrote:

Hi,

I cannot get anything rendered that contains lettering, but only when using the 
C++-api. An exception get thrown, stating that a font face cannot be found.

In trying to track down the problem, I put together this minimal example 
(compilable):

// [ snip -------

#include <iostream>
#include <mapnik/font_engine_freetype.hpp>

using namespace std;

int main ( int argc , char** argv)
{
 mapnik::freetype_engine::register_font("/usr/share/fonts");

 vector<string> face_names = mapnik::freetype_engine::face_names();
 for( vector<string>::iterator it = face_names.begin(); it != face_names.end(); 
it++ )
   {
     cout << "I know of font face " << *it << "\n";
   }
}

// ------- snip ]

...which outputs nothing.

On the other hand, the equivalent python code

# [ snip -----

import mapnik
for face in mapnik.FontEngine.face_names(): print face

# ----- snip ]

...outputs a lot of font faces, and I can render maps with lettering alright.

Oh, and mapnik.fontscollectionpath is "/usr/share/fonts", exactly as I tried in 
the C++-version.

What is the right way to register a "fontscollectionpath" using the C++-API?

Thanks!

Julius
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to