Render hover text in monospace

- TODO: Configure separate font size for monospace
This commit is contained in:
Dan Paulat 2023-07-21 22:34:19 -05:00
parent 48d71cc14d
commit 8be32a8998
9 changed files with 58 additions and 8 deletions

View file

@ -299,6 +299,16 @@ void FontImpl::CreateImGuiFont(QFile& fontFile,
}
}
ImFont* Font::ImGuiFont(std::size_t fontPixelSize)
{
auto it = p->imGuiFonts_.find(fontPixelSize);
if (it != p->imGuiFonts_.cend())
{
return it->second;
}
return nullptr;
}
std::shared_ptr<Font> Font::Create(const std::string& resource)
{
logger_->debug("Loading font file: {}", resource);

View file

@ -6,7 +6,9 @@
#include <memory>
#include <string>
#include <boost/gil.hpp>
#include <boost/gil/typedefs.hpp>
struct ImFont;
namespace scwx
{
@ -23,10 +25,10 @@ public:
explicit Font(const std::string& resource);
~Font();
Font(const Font&) = delete;
Font(const Font&) = delete;
Font& operator=(const Font&) = delete;
Font(Font&&) = delete;
Font(Font&&) = delete;
Font& operator=(Font&&) = delete;
float BufferText(std::shared_ptr<FontBuffer> buffer,
@ -38,6 +40,8 @@ public:
float Kerning(char c1, char c2) const;
float TextLength(const std::string& text, float pointSize) const;
ImFont* ImGuiFont(std::size_t fontPixelSize);
GLuint GenerateTexture(gl::OpenGLFunctions& gl);
static std::shared_ptr<Font> Create(const std::string& resource);