MCPcopy Create free account
hub / github.com/defold/defold / TextLayoutSkribidiCreate

Function TextLayoutSkribidiCreate

engine/font/src/text_layout_skribidi.cpp:214–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212}
213
214TextResult TextLayoutSkribidiCreate(HFontCollection collection,
215 uint32_t* codepoints, uint32_t num_codepoints,
216 TextLayoutSettings* settings, TextLayout** outlayout)
217{
218 TextLayout* layout = new TextLayout;
219 layout->m_Destroy = TextLayoutSkribidiFree;
220 layout->m_RefCount = 1;
221
222 layout->m_Glyphs.SetCapacity(num_codepoints);
223 layout->m_Glyphs.SetSize(0);
224 layout->m_Lines.SetSize(0);
225 layout->m_FontCollection = collection;
226 layout->m_Direction = TEXT_DIRECTION_LTR;
227 layout->m_NumValidGlyphs = 0;
228 layout->m_MaxGlyphWidth = 0.0f;
229 layout->m_MaxGlyphHeight = 0.0f;
230 layout->m_Width = 0.0f;
231 layout->m_Height = 0.0f;
232
233 if (num_codepoints == 0) // empty string
234 {
235 *outlayout = layout;
236 return TEXT_RESULT_OK;
237 }
238
239 LayoutContext ctx = {0};
240 AllocLayout(&ctx, collection);
241
242 bool result = LayoutText(&ctx,
243 codepoints, num_codepoints,
244 settings,
245 layout);
246
247 FreeLayout(&ctx);
248
249 if (!result)
250 {
251 TextLayoutSkribidiFree(layout);
252 layout = 0;
253 }
254
255 *outlayout = layout;
256 return result ? TEXT_RESULT_OK : TEXT_RESULT_ERROR;
257}
258
259#endif // FONT_USE_SKRIBIDI

Callers 1

TextLayoutCreateFunction · 0.85

Calls 6

AllocLayoutFunction · 0.85
LayoutTextFunction · 0.85
FreeLayoutFunction · 0.85
TextLayoutSkribidiFreeFunction · 0.85
SetCapacityMethod · 0.45
SetSizeMethod · 0.45

Tested by

no test coverage detected