From 0b41ae9f9744e46926aeb42eec566f23475f8d4c Mon Sep 17 00:00:00 2001 From: themancalledjakob Date: Mon, 29 May 2023 09:50:52 +0200 Subject: [PATCH] introduce buffer target type --- src/gpufont/font.hpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gpufont/font.hpp b/src/gpufont/font.hpp index 9ce70db..6522312 100644 --- a/src/gpufont/font.hpp +++ b/src/gpufont/font.hpp @@ -429,9 +429,10 @@ class Font { // If hinting is enabled, worldSize must be an integer and defines the font size in pixels used for hinting. // Otherwise, worldSize can be an arbitrary floating-point value. - Font(FT_Face face, float worldSize = 1.0f, bool hinting = false) : + Font(FT_Face face, float worldSize = 1.0f, bool hinting = false, GLint bufferTargetType = GL_TEXTURE_2D_ARRAY) : face(face), hinting(hinting), + BUFFER_TARGET_TYPE(bufferTargetType), worldSize(worldSize){ // TODO: modularize init, so we can initialize with settings and text @@ -1400,6 +1401,7 @@ class Font { // If hinting is enabled, we must let FreeType scale the outlines for the hinting to work properly. // The variables loadFlags and kerningMode are set in the constructor and control this scaling behavior. bool hinting; + GLint BUFFER_TARGET_TYPE; FT_Int32 loadFlags; FT_Kerning_Mode kerningMode; @@ -1443,6 +1445,7 @@ class Font { static std::shared_ptr loadFont(FT_Library & library, const std::string & filename, + GLint bufferTargetType, float worldSize = 1.0f, bool hinting = false){ std::string error; @@ -1454,15 +1457,16 @@ static std::shared_ptr loadFont(FT_Library & library, std::cout << "ofxGPUFont::font.hpp[" << __LINE__ << "] FT loaded " << filename << ": " << error << std::endl; } - return std::make_shared (face, worldSize, hinting); + return std::make_shared (face, worldSize, hinting, bufferTargetType); } static void initializeFont(FT_Library & library, const std::string & filename, - shared_ptr & mainFont){ + shared_ptr & mainFont, + GLint bufferTargetType = GL_TEXTURE_2D_ARRAY){ cout << "initializeFont" << endl; - auto font = loadFont(library, filename); + auto font = loadFont(library, filename, bufferTargetType); if(!font){ return; }