loading only a subset of characters from fonts

This commit is contained in:
devZoGok
2021-11-01 19:51:47 +02:00
parent c8d0fd11f0
commit 2adbb4b5e4
2 changed files with 6 additions and 6 deletions
+4 -4
View File
@@ -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;