From ebde5351aff78e406b737629ded5bc52c2361da8 Mon Sep 17 00:00:00 2001 From: artemp Date: Mon, 23 Jun 2014 16:26:50 +0100 Subject: [PATCH] increase buffer size in std::streambuf for faster i/o --- src/font_engine_freetype.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/font_engine_freetype.cpp b/src/font_engine_freetype.cpp index 3d60fa25c..baa06a373 100644 --- a/src/font_engine_freetype.cpp +++ b/src/font_engine_freetype.cpp @@ -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) { + char buffer[512]; #ifdef _WINDOWS std::ifstream file(mapnik::utf8_to_utf16(file_name), std::ios::binary); #else std::ifstream file(file_name.c_str(), std::ios::binary); #endif - if (!file.good()) { - return false; - } + if (!file.good()) return false; + file.rdbuf()->pubsetbuf(buffer, 512); + FT_Face face = 0; FT_Open_Args args; FT_StreamRec streamRec; memset(&args, 0, sizeof(args)); memset(&streamRec, 0, sizeof(streamRec)); + std::streampos beg = file.tellg(); file.seekg (0, std::ios::end); std::streampos end = file.tellg();