Improve error messages.

This commit is contained in:
Hermann Kraus 2012-02-25 00:53:09 +01:00
parent 3839dd363f
commit 1906cddf04
2 changed files with 13 additions and 2 deletions

View file

@ -301,6 +301,10 @@ public:
if (face_ptr face = get_face(*name))
{
face_set->add(face);
} else {
#ifdef MAPNIK_DEBUG
std::cerr << "Failed to find face '" << *name << "' in font set '" << fset.get_name() << "'\n";
#endif
}
}
return face_set;

View file

@ -39,9 +39,16 @@ string_info &processed_text::get_string_info()
{
char_properties const &p = itr->p;
face_set_ptr faces = font_manager_.get_face_set(p.face_name, p.fontset);
if (faces->size() <= 0)
if (faces->size() == 0)
{
if (!p.fontset.get_name().empty())
{
throw config_error("Unable to find specified font set '" + p.face_name + "'");
} else if (!p.face_name.empty()) {
throw config_error("Unable to find specified font face '" + p.face_name + "'");
} else {
throw config_error("Both font set and face name are empty!");
}
}
faces->set_character_sizes(p.text_size * scale_factor_);
faces->get_string_info(info_, itr->str, &(itr->p));