#include "FontManager.hpp" RcPtr FontManager::sans{ new Font() }; RcPtr FontManager::serif{ new Font() }; RcPtr FontManager::monospace{ new Font() }; const RcPtr& FontManager::GetDefaultFont() { return sans; } const Font* FontManager::ResolveFallback(const Font* font) { if (font == nullptr) { return FontManager::sans.Get(); } else { return font; } } const RcPtr& FontManager::ResolveFallback(const RcPtr& font) { if (font == nullptr) { return FontManager::sans; } else { return font; } } void FontManager::Init() { Font::LoadingCandidate sansFiles[] = { { .ttfPath = "fonts/NotoSans-Regular.ttf", .glyphRange = Font::GetGlyphRangesDefault(), .type = FontType::Regular, }, { .ttfPath = "fonts/NotoSans-Italic.ttf", .glyphRange = Font::GetGlyphRangesDefault(), .type = FontType::Italic, }, { .ttfPath = "fonts/NotoSans-Bold.ttf", .glyphRange = Font::GetGlyphRangesDefault(), .type = FontType::Bold, }, { .ttfPath = "fonts/NotoSans-BoldItalic.ttf", .glyphRange = Font::GetGlyphRangesDefault(), .type = FontType::BoldItalic, }, { .ttfPath = "fonts/NotoSansSC-Regular.otf", .glyphRange = Font::GetGlyphRangesChineseSimplifiedCommon(), .type = FontType::Regular, }, }; sans->Init(sansFiles, 18.0f); Font::LoadingCandidate serifFiles[] = { { .ttfPath = "fonts/NotoSerif-Regular.ttf", .glyphRange = Font::GetGlyphRangesDefault(), .type = FontType::Regular, }, { .ttfPath = "fonts/NotoSerif-Italic.ttf", .glyphRange = Font::GetGlyphRangesDefault(), .type = FontType::Italic, }, { .ttfPath = "fonts/NotoSerif-Bold.ttf", .glyphRange = Font::GetGlyphRangesDefault(), .type = FontType::Bold, }, { .ttfPath = "fonts/NotoSerif-BoldItalic.ttf", .glyphRange = Font::GetGlyphRangesDefault(), .type = FontType::BoldItalic, }, }; serif->Init(sansFiles, 18.0f); Font::LoadingCandidate monospacedFiles[] = { { .ttfPath = "fonts/NotoMono-Regular.ttf", .glyphRange = Font::GetGlyphRangesDefault(), .type = FontType::Regular, }, }; monospace->Init(monospacedFiles, 18.0f); } void FontManager::Shutdown() { }