-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
26 lines (22 loc) · 1.03 KB
/
main.cpp
File metadata and controls
26 lines (22 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <Geode/Geode.hpp>
#include <Geode/modify/CCLabelBMFont.hpp>
using namespace geode::prelude;
class $modify(MyFontHook, CCLabelBMFont) {
static CCLabelBMFont* create(const char* str, const char* fntFile) {
auto label = CCLabelBMFont::create(str, fntFile);
if (!label) return nullptr;
auto fontPath = Mod::get()->getSettingValue<std::filesystem::path>("font-path");
if (!fontPath.empty() && std::filesystem::exists(fontPath)) {
// We create a temporary TTF label to steal its look
// We use a font size of 24 as a baseline for GD
auto newLabel = CCLabelTTF::create(str, fontPath.string().c_str(), 24.0f);
if (newLabel) {
label->setTexture(newLabel->getTexture());
label->setTextureRect(newLabel->getTextureRect());
// This ensures the custom font isn't blurry on your A9's screen
label->getTexture()->setAliasTexParameters();
}
}
return label;
}
};