| 124 | } |
| 125 | |
| 126 | static std::shared_ptr<hb_font_t> CreateHBFont(std::shared_ptr<tgfx::Typeface> typeface) { |
| 127 | if (typeface == nullptr) { |
| 128 | return nullptr; |
| 129 | } |
| 130 | auto cache = GetHBFontCache(); |
| 131 | auto hbFont = cache.find(typeface->uniqueID()); |
| 132 | if (hbFont == nullptr) { |
| 133 | auto hbFace = CreateHBFace(typeface); |
| 134 | if (hbFace == nullptr) { |
| 135 | return nullptr; |
| 136 | } |
| 137 | hbFont = cache.insert(typeface->uniqueID(), std::shared_ptr<hb_font_t>( |
| 138 | hb_font_create(hbFace.get()), hb_font_destroy)); |
| 139 | } |
| 140 | return hbFont; |
| 141 | } |
| 142 | |
| 143 | static std::vector<std::tuple<uint32_t, uint32_t, uint32_t>> Shape( |
| 144 | const std::string& text, std::shared_ptr<tgfx::Typeface> typeface) { |
no test coverage detected