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

Function DebugPrintLayout

engine/font/src/test/test_font.cpp:102–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102static void DebugPrintLayout(HTextLayout layout)
103{
104 printf("Layout:\n");
105 printf(" %u lines, max width: %.3f\n", layout->m_Lines.Size(), layout->m_Width);
106
107 uint32_t num_lines = layout->m_Lines.Size();
108 for (uint32_t i = 0; i < num_lines; ++i)
109 {
110 TextLine& line = layout->m_Lines[i];
111 printf(" %u: off: %3u len: %3u width: %.3f |", i, line.m_Index, line.m_Length, line.m_Width);
112
113 uint32_t end = line.m_Index + line.m_Length;
114 for (uint32_t j = line.m_Index; j < end; ++j)
115 {
116 TextGlyph* glyph = &layout->m_Glyphs[j];
117 uint32_t c = glyph->m_Codepoint;
118 printf("%c", (char)c);
119 }
120
121 printf("| idx: |");
122
123 for (uint32_t j = line.m_Index; j < end; ++j)
124 {
125 TextGlyph* glyph = &layout->m_Glyphs[j];
126 uint32_t gi = glyph->m_GlyphIndex;
127 printf("%4u ", gi);
128 }
129 printf("|\n");
130 }
131}
132
133TEST_F(FontTest, LayoutSingleLine)
134{

Callers 1

TEST_FFunction · 0.85

Calls 1

SizeMethod · 0.45

Tested by

no test coverage detected