From 4ee7731023ca1f26712f997d4682a803e2481a31 Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Sat, 22 Jul 2023 01:29:25 -0500 Subject: [PATCH] Create accessor functions for placefile fonts --- wxdata/include/scwx/gr/placefile.hpp | 3 +++ wxdata/source/scwx/gr/placefile.cpp | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/wxdata/include/scwx/gr/placefile.hpp b/wxdata/include/scwx/gr/placefile.hpp index c4744b17..2f1c0833 100644 --- a/wxdata/include/scwx/gr/placefile.hpp +++ b/wxdata/include/scwx/gr/placefile.hpp @@ -84,6 +84,9 @@ public: */ std::vector> GetDrawItems(); + std::unordered_map> fonts(); + std::shared_ptr font(std::size_t i); + static std::shared_ptr Load(const std::string& filename); static std::shared_ptr Load(std::istream& is); diff --git a/wxdata/source/scwx/gr/placefile.cpp b/wxdata/source/scwx/gr/placefile.cpp index 765d59dc..d35c67d6 100644 --- a/wxdata/source/scwx/gr/placefile.cpp +++ b/wxdata/source/scwx/gr/placefile.cpp @@ -84,6 +84,22 @@ std::vector> Placefile::GetDrawItems() return p->drawItems_; } +std::unordered_map> +Placefile::fonts() +{ + return p->fonts_; +} + +std::shared_ptr Placefile::font(std::size_t i) +{ + auto it = p->fonts_.find(i); + if (it != p->fonts_.cend()) + { + return it->second; + } + return nullptr; +} + std::shared_ptr Placefile::Load(const std::string& filename) { logger_->debug("Loading placefile: {}", filename);