MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / getFont

Method getFont

radiantcore/rendersystem/OpenGLModule.cpp:43–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43IGLFont::Ptr OpenGLModule::getFont(IGLFont::Style style, std::size_t size)
44{
45 auto cacheKey = std::make_pair(style, static_cast<int>(size));
46 auto cachedFont = _fontCache.find(cacheKey);
47
48 // Try to look up and lock a shared_ptr in our cache
49 if (cachedFont != _fontCache.end())
50 {
51 auto locked = cachedFont->second.lock();
52
53 if (locked)
54 {
55 return locked;
56 }
57 }
58
59 // No cache hit, create new instance
60 auto font = std::make_shared<gl::GLFont>(style, static_cast<unsigned int>(size));
61
62 _fontCache[cacheKey] = font;
63
64 return font;
65}
66
67void OpenGLModule::drawString(const std::string& string) const
68{

Callers 5

ensureFontMethod · 0.80
ensureFontMethod · 0.80
drawPreviewMethod · 0.80
captureTextRendererMethod · 0.80
renderComponentsMethod · 0.80

Calls 2

findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected