skip font files and face names with leading '.' - interpret as hidden

This commit is contained in:
Dane Springmeyer 2012-04-20 15:31:06 -07:00
parent 904c294e8f
commit 622ce7e590

View file

@ -102,10 +102,14 @@ bool freetype_engine::register_font(std::string const& file_name)
// http://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#FT_FaceRec
if (face->family_name && face->style_name)
{
success = true;
std::string name = std::string(face->family_name) + " " + std::string(face->style_name);
// skip fonts with leading . in name
if (!boost::algorithm::starts_with(name,"."))
{
success = true;
name2file_.insert(std::make_pair(name, std::make_pair(i,file_name)));
}
}
else
{
std::ostringstream s;
@ -150,11 +154,21 @@ bool freetype_engine::register_fonts(std::string const& dir, bool recurse)
{
success = register_fonts(file_name, true);
}
else if (boost::filesystem::is_regular_file(file_name) && is_font_file(file_name))
else
{
#if (BOOST_FILESYSTEM_VERSION == 3)
std::string const& base_name = itr->path().filename().string();
#else // v2
std::string const& base_name = itr->filename().string();
#endif
if (!boost::algorithm::starts_with(base_name,".") &&
boost::filesystem::is_regular_file(file_name) &&
is_font_file(file_name))
{
success = mapnik::freetype_engine::register_font(file_name);
}
}
}
return success;
}