diff --git a/text.cpp b/text.cpp index b888931..3f83363 100755 --- a/text.cpp +++ b/text.cpp @@ -15,8 +15,8 @@ using namespace std; namespace vb01{ - Text::Text(string fontPath, wstring entry){ - initFont(fontPath); + Text::Text(string fontPath, wstring entry, u16 firstChar, u16 lastChar){ + initFont(fontPath, firstChar, lastChar); setText(entry); } @@ -25,7 +25,7 @@ namespace vb01{ glDeleteBuffers(1, &VBO); } - void Text::initFont(string fontPath){ + void Text::initFont(string fontPath, u16 firstChar, u16 lastChar){ FT_Library ft; FT_Face face; if(FT_Init_FreeType(&ft)) @@ -37,7 +37,7 @@ namespace vb01{ glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - for(u16 i = 0; i < u16(0 - 1); i++){ + for(u16 i = firstChar; i < lastChar; i++){ if(FT_Load_Char(face, i, FT_LOAD_RENDER)){ cout << "Could not load glyph\n"; continue; diff --git a/text.h b/text.h index c9e4d23..1fdaa3d 100755 --- a/text.h +++ b/text.h @@ -21,7 +21,7 @@ namespace vb01{ Vector2 size, bearing; }; - Text(std::string, std::wstring); + Text(std::string, std::wstring, u16 = 0, u16 = 256); ~Text(); void update(); void setText(std::wstring); @@ -38,7 +38,7 @@ namespace vb01{ inline void setMaterial(Material *mat){this->material = mat;} Glyph* getGlyph(u16); private: - void initFont(std::string); + void initFont(std::string, u16, u16); void prepareGlyphs(Glyph, Vector2); void renderGlyphs(Glyph, float[], u32);