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

Function CreateGlyphBank

engine/render/src/test/test_render_script.cpp:64–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64static dmRenderDDF::GlyphBank* CreateGlyphBank(uint32_t max_ascent, uint32_t max_descent, uint32_t glyph_count)
65{
66 dmRenderDDF::GlyphBank* bank = new dmRenderDDF::GlyphBank;
67 memset(bank, 0, sizeof(*bank));
68
69 bank->m_Glyphs.m_Count = glyph_count;
70 bank->m_Glyphs.m_Data = new dmRenderDDF::GlyphBank::Glyph[glyph_count];
71
72 memset(bank->m_Glyphs.m_Data, 0, sizeof(dmRenderDDF::GlyphBank::Glyph) * glyph_count);
73 for (uint32_t i = 0; i < glyph_count; ++i)
74 {
75 bank->m_Glyphs[i].m_Character = i;
76 bank->m_Glyphs[i].m_Width = 1;
77 bank->m_Glyphs[i].m_LeftBearing = 1;
78 bank->m_Glyphs[i].m_Advance = 2;
79 bank->m_Glyphs[i].m_Ascent = 2;
80 bank->m_Glyphs[i].m_Descent = 1;
81 }
82
83 bank->m_MaxAscent = max_ascent;
84 bank->m_MaxDescent = max_descent;
85
86 return bank;
87}
88
89static void DestroyGlyphBank(dmRenderDDF::GlyphBank* bank)
90{

Callers 1

SetUpMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected