increase buffer size in std::streambuf for faster i/o

This commit is contained in:
artemp 2014-06-23 16:26:50 +01:00
parent 4c4ce5a04c
commit ebde5351af

View file

@ -131,19 +131,21 @@ bool freetype_engine::register_font(std::string const& file_name)
bool freetype_engine::register_font_impl(std::string const& file_name, FT_LibraryRec_ * library) bool freetype_engine::register_font_impl(std::string const& file_name, FT_LibraryRec_ * library)
{ {
char buffer[512];
#ifdef _WINDOWS #ifdef _WINDOWS
std::ifstream file(mapnik::utf8_to_utf16(file_name), std::ios::binary); std::ifstream file(mapnik::utf8_to_utf16(file_name), std::ios::binary);
#else #else
std::ifstream file(file_name.c_str(), std::ios::binary); std::ifstream file(file_name.c_str(), std::ios::binary);
#endif #endif
if (!file.good()) { if (!file.good()) return false;
return false; file.rdbuf()->pubsetbuf(buffer, 512);
}
FT_Face face = 0; FT_Face face = 0;
FT_Open_Args args; FT_Open_Args args;
FT_StreamRec streamRec; FT_StreamRec streamRec;
memset(&args, 0, sizeof(args)); memset(&args, 0, sizeof(args));
memset(&streamRec, 0, sizeof(streamRec)); memset(&streamRec, 0, sizeof(streamRec));
std::streampos beg = file.tellg(); std::streampos beg = file.tellg();
file.seekg (0, std::ios::end); file.seekg (0, std::ios::end);
std::streampos end = file.tellg(); std::streampos end = file.tellg();