mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 17:30:05 +00:00
Render hover text in monospace
- TODO: Configure separate font size for monospace
This commit is contained in:
parent
48d71cc14d
commit
8be32a8998
9 changed files with 58 additions and 8 deletions
|
|
@ -26,9 +26,11 @@ static void LoadTextures();
|
|||
|
||||
static const std::unordered_map<types::Font, std::string> fontNames_ {
|
||||
{types::Font::din1451alt, ":/res/fonts/din1451alt.ttf"},
|
||||
{types::Font::din1451alt_g, ":/res/fonts/din1451alt_g.ttf"}};
|
||||
{types::Font::din1451alt_g, ":/res/fonts/din1451alt_g.ttf"},
|
||||
{types::Font::Inconsolata_Regular, ":/res/fonts/Inconsolata-Regular.ttf"}};
|
||||
|
||||
static std::unordered_map<types::Font, int> fontIds_ {};
|
||||
static std::unordered_map<types::Font, int> fontIds_ {};
|
||||
static std::unordered_map<types::Font, std::shared_ptr<util::Font>> fonts_ {};
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
|
|
@ -50,6 +52,16 @@ int FontId(types::Font font)
|
|||
return -1;
|
||||
}
|
||||
|
||||
std::shared_ptr<util::Font> Font(types::Font font)
|
||||
{
|
||||
auto it = fonts_.find(font);
|
||||
if (it != fonts_.cend())
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void LoadFonts()
|
||||
{
|
||||
for (auto& fontName : fontNames_)
|
||||
|
|
@ -58,7 +70,8 @@ static void LoadFonts()
|
|||
QString::fromStdString(fontName.second));
|
||||
fontIds_.emplace(fontName.first, fontId);
|
||||
|
||||
util::Font::Create(fontName.second);
|
||||
auto font = util::Font::Create(fontName.second);
|
||||
fonts_.emplace(fontName.first, font);
|
||||
}
|
||||
|
||||
ImFontAtlas* fontAtlas = model::ImGuiContextModel::Instance().font_atlas();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <scwx/qt/types/font_types.hpp>
|
||||
#include <scwx/qt/util/font.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
|
|
@ -14,7 +15,8 @@ namespace ResourceManager
|
|||
void Initialize();
|
||||
void Shutdown();
|
||||
|
||||
int FontId(types::Font font);
|
||||
int FontId(types::Font font);
|
||||
std::shared_ptr<util::Font> Font(types::Font font);
|
||||
|
||||
} // namespace ResourceManager
|
||||
} // namespace manager
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue