Euphoria
fontcache.cc
Go to the documentation of this file.
1 #include "render/fontcache.h"
2 
3 #include "assert/assert.h"
4 #include "core/cache.h"
5 #include "io/vfs_path.h"
6 
7 #include "render/font.h"
8 
9 
10 namespace eu::render
11 {
13  : core::Cache<io::FilePath, DrawableFont, FontCache::FontCachePimpl>
14  {
16  : vfs(fs)
17  , cache(c)
18  {
19  ASSERT(fs);
20  }
21 
22  std::shared_ptr<DrawableFont>
23  create(const io::FilePath& file)
24  {
25  auto ret = std::make_shared<DrawableFont>(vfs, cache, file);
26  return ret;
27  }
28 
31  };
32 
34  {
35  pimp = std::make_unique<FontCache::FontCachePimpl>(fs, cache);
36  }
37 
38  FontCache::~FontCache() = default;
39 
40  std::shared_ptr<DrawableFont>
41  FontCache::get_font(const io::FilePath& path) const
42  {
43  return pimp->get(path);
44  }
45 }
#define ASSERT(x)
Definition: assert.h:29
std::shared_ptr< DrawableFont > create(const io::FilePath &file)
Definition: fontcache.cc:23
FontCachePimpl(io::FileSystem *fs, TextureCache *c)
Definition: fontcache.cc:15
FontCache(io::FileSystem *fs, TextureCache *cache)
Definition: fontcache.cc:33
std::shared_ptr< DrawableFont > get_font(const io::FilePath &path) const
Definition: fontcache.cc:41
std::unique_ptr< FontCachePimpl > pimp
Definition: fontcache.h:20