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

Function CreateHBFont

src/rendering/utils/shaper/TextShaperHarfbuzz.cpp:126–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126static 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
143static std::vector<std::tuple<uint32_t, uint32_t, uint32_t>> Shape(
144 const std::string& text, std::shared_ptr<tgfx::Typeface> typeface) {

Callers 1

ShapeFunction · 0.85

Calls 6

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

Tested by

no test coverage detected