diff --git a/src/gpufont/font.hpp b/src/gpufont/font.hpp index 00ad13f..f3758ae 100644 --- a/src/gpufont/font.hpp +++ b/src/gpufont/font.hpp @@ -337,7 +337,6 @@ class Font { continue; } if(glyphs.count(charcode) != 0){ - //cout << "but count is not 0?" << endl; continue; } @@ -426,7 +425,7 @@ class Font { glTexImage2D(GL_TEXTURE_2D, 0, GL_RG32F, - bufferCurvesSize * 2, + bufferCurvesSize * sizeof(glm::highp_f32), 1, 0, GL_RG, @@ -918,23 +917,24 @@ class Font { float dilation = 0; }; -static std::unique_ptr loadFont(FT_Library & library, const std::string & filename, float worldSize = 1.0f, bool hinting = false){ +static std::shared_ptr loadFont(FT_Library & library, const std::string & filename, float worldSize = 1.0f, bool hinting = false){ std::string error; FT_Face face = Font::loadFace(library, filename, error); if(error != ""){ std::cerr << "[font] failed to load " << filename << ": " << error << std::endl; - return std::unique_ptr {}; + return std::shared_ptr {}; } - return std::make_unique (face, worldSize, hinting); + return std::make_shared (face, worldSize, hinting); } static void tryUpdateMainFont(FT_Library & library, const std::string & filename, const string & mainText, - unique_ptr & mainFont, + shared_ptr & mainFont, Font::BoundingBox & bb){ { + cout << "tryUpdateMainFont" << endl; auto font = loadFont(library, filename, 0.05f); if(!font){ return; @@ -946,6 +946,9 @@ static void tryUpdateMainFont(FT_Library & library, mainFont = std::move(font); bb = mainFont->measure(0, 0, mainText); + cout << "tryUpdateMainFont loaded font" << endl; + cout << "mainText: " << mainText << endl; + cout << bb.minX << "-" << bb.maxX << endl; } } }