11 #include <nap/resource.h>
12 #include <rtti/factory.h>
14 #include <utility/errorstate.h>
30 inline constexpr
float dpi = 96.0f;
100 std::unique_ptr<FontInstance> mInstance =
nullptr;
162 const std::string& getFont()
const;
167 bool isValid()
const;
224 void getBoundingBox(
const std::string& text,
float scale,
math::Rect& outRect);
238 void* getFace()
const;
246 bool loadGlyph(
uint index);
252 void* getGlyphHandle();
271 void* mFace =
nullptr;
272 void* mFreetypeLib =
nullptr;
277 using GlyphCacheSet = std::vector<std::unique_ptr<GlyphCache>>;
278 using GlyphCacheMap = std::unordered_map<int, GlyphCacheSet>;
279 mutable GlyphCacheMap mGlyphs;
314 T* findRepresentation();
327 mGlyph(std::move(parent)) { }
333 void addRepresentation(std::unique_ptr<IGlyphRepresentation> representation);
336 std::unique_ptr<Glyph> mGlyph =
nullptr;
337 using GlyphRepresentationMap = std::unordered_map<rtti::TypeInfo, std::unique_ptr<IGlyphRepresentation>>;
338 GlyphRepresentationMap mRepresentations;
349 IGlyphRepresentation* representation = this->getOrCreateGlyphRepresentation(index, scale, RTTI_OF(T), errorCode);
350 return rtti_cast<T>(representation);
358 return rtti_cast<T>(presentation);