MCPcopy Create free account
hub / github.com/Tencent/tgfx / CreateHBFont

Function CreateHBFont

test/src/utils/TextShaper.cpp:151–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151static std::shared_ptr<hb_font_t> CreateHBFont(const std::shared_ptr<Typeface>& typeface) {
152 auto cache = GetHBFontCache();
153 auto hbFont = cache.find(typeface->uniqueID());
154 if (hbFont == nullptr) {
155 auto hbFace = CreateHBFace(typeface);
156 if (hbFace == nullptr) {
157 return nullptr;
158 }
159 hbFont = cache.insert(typeface->uniqueID(), std::shared_ptr<hb_font_t>(
160 hb_font_create(hbFace.get()), hb_font_destroy));
161 }
162 return hbFont;
163}
164
165static std::vector<std::tuple<uint32_t, uint32_t, uint32_t>> ShapeText(
166 const std::string& text, const std::shared_ptr<Typeface>& typeface) {

Callers 1

ShapeTextFunction · 0.85

Calls 6

GetHBFontCacheFunction · 0.85
CreateHBFaceFunction · 0.85
findMethod · 0.45
uniqueIDMethod · 0.45
insertMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected