[studio] Change Studio font

This commit is contained in:
2025-04-19 00:23:36 -05:00
parent 535d8876d3
commit 95f7c33419
7 changed files with 32 additions and 4 deletions
@@ -5,6 +5,7 @@ add_library(
clawviewer.cpp
deleteconfirmation.cpp
filedialogmanager.cpp
font.cpp
makecopypopup.cpp
newdir.cpp
newmenu.cpp
Binary file not shown.
+1 -1
View File
@@ -5,7 +5,7 @@
namespace studio::files {
static const ox::Array<uint8_t, 162588> RobotoMedium_ttfData {
static constexpr ox::Array<uint8_t, 162588> RobotoMedium_ttfData {
0x00, 0x01, 0x00, 0x00, 0x00, 0x11, 0x01, 0x00, 0x00, 0x04,
0x00, 0x10, 0x47, 0x50, 0x4f, 0x53, 0x7d, 0xaa, 0x71, 0x8c,
0x00, 0x02, 0x08, 0xa8, 0x00, 0x00, 0x59, 0x0c, 0x47, 0x53,
+11
View File
@@ -0,0 +1,11 @@
{
"cpp": "font.cpp",
"hpp": "font.hpp",
"namespace": "studio::files",
"files": [
{
"path": "Roboto-Medium.ttf",
"cpp_name": "RobotoMedium_ttf"
}
]
}
@@ -14,6 +14,7 @@
#include <studio/configio.hpp>
#include "clawviewer.hpp"
#include "filedialogmanager.hpp"
#include "font.hpp"
#include "studioui.hpp"
namespace studio {
@@ -57,6 +58,19 @@ StudioUI::StudioUI(turbine::Context &ctx, ox::StringParam projectDataDir) noexce
m_projectExplorer{keelCtx(m_tctx)},
m_newProject{m_projectDataDir},
m_aboutPopup{m_tctx} {
{
ImFontConfig fontCfg;
fontCfg.FontDataOwnedByAtlas = false;
auto const &io = ImGui::GetIO();
auto const font = files::RobotoMedium_ttf();
// const_cast is needed because this data is definitely const,
// but AddFontFromMemoryTTF requires a mutable buffer.
// However, setting fontCfg.FontDataOwnedByAtlas ensures
// that it will still be treated as const.
// ImGui documentation recognize that this is a bad design,
// and hopefully it will change at some point.
io.Fonts->AddFontFromMemoryTTF(const_cast<uint8_t*>(font.data()), static_cast<int>(font.size()), 13, &fontCfg);
}
turbine::setApplicationData(m_tctx, &m_sctx);
m_projectExplorer.fileChosen.connect(this, &StudioUI::openFile);
m_projectExplorer.addDir.connect(this, &StudioUI::addDir);