mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-12 22:39:09 -05:00
Modularizing font specification
This commit is contained in:
@@ -31,9 +31,10 @@ namespace openspace {
|
||||
namespace constants {
|
||||
|
||||
namespace fonts {
|
||||
const std::string keyFonts = "Fonts";
|
||||
const std::string keySGCT = "SGCTFont";
|
||||
const std::string keyMono = "UbuntuMono";
|
||||
const std::string keyLight = "UbuntuLight";
|
||||
const std::string keyMono = "Mono";
|
||||
const std::string keyLight = "Light";
|
||||
} // namespace fonts
|
||||
|
||||
namespace configurationmanager {
|
||||
|
||||
@@ -16,6 +16,10 @@ return {
|
||||
LeapSecond = "${OPENSPACE_DATA}/spice/pck00010.tpc",
|
||||
NewHorizons = "${OPENSPACE_DATA}/spice/nhmeta.tm"
|
||||
},
|
||||
Fonts = {
|
||||
Mono = "${FONTS}/Droid_Sans_Mono/DroidSansMono.ttf",
|
||||
Light = "${FONTS}/Roboto/Roboto-Regular.ttf"
|
||||
},
|
||||
SGCTConfig = "${SGCT}/single.xml",
|
||||
--SGCTConfig = "${SGCT}/two_nodes.xml",
|
||||
--SGCTConfig = "${SGCT}/single_sbs_stereo.xml",
|
||||
|
||||
@@ -211,8 +211,23 @@ void OpenSpaceEngine::runStartupScripts() {
|
||||
|
||||
void OpenSpaceEngine::loadFonts() {
|
||||
sgct_text::FontManager::FontPath local = sgct_text::FontManager::FontPath::FontPath_Local;
|
||||
sgct_text::FontManager::instance()->addFont(constants::fonts::keyMono, absPath("${FONTS}/Droid_Sans_Mono/DroidSansMono.ttf"), local);
|
||||
sgct_text::FontManager::instance()->addFont(constants::fonts::keyLight, absPath("${FONTS}/Roboto/Roboto-Regular.ttf"), local);
|
||||
|
||||
ghoul::Dictionary fonts;
|
||||
bool success = configurationManager().getValue(constants::fonts::keyFonts, fonts);
|
||||
if (!success) {
|
||||
LERROR("Could not find key '" << constants::fonts::keyFonts <<
|
||||
"' in configuration file for font declaration");
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto key : fonts.keys()) {
|
||||
std::string font;
|
||||
fonts.getValue(key, font);
|
||||
font = absPath(font);
|
||||
|
||||
LINFO("Registering font '" << font << "' with key '" << key << "'");
|
||||
sgct_text::FontManager::instance()->addFont(key, font, local);
|
||||
}
|
||||
}
|
||||
|
||||
bool OpenSpaceEngine::create(int argc, char** argv,
|
||||
|
||||
Reference in New Issue
Block a user