MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / MeasureText

Method MeasureText

Source/Engine/Render2D/Font.cpp:311–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

309}
310
311Float2 Font::MeasureText(const StringView& text, const TextLayoutOptions& layout)
312{
313 // Check if there is no need to do anything
314 if (text.IsEmpty())
315 return Float2::Zero;
316
317 // Process text
318 Array<FontLineCache, InlinedAllocation<8>> lines;
319 ProcessText(text, lines, layout);
320
321 // Calculate bounds
322 Float2 max = Float2::Zero;
323 for (int32 i = 0; i < lines.Count(); i++)
324 {
325 const FontLineCache& line = lines[i];
326 max = Float2::Max(max, line.Location + line.Size);
327 }
328
329 return max;
330}
331
332int32 Font::HitTestText(const StringView& text, const Float2& location, const TextLayoutOptions& layout)
333{

Callers 15

GetTextSizeMethod · 0.80
ResizeAutoMethod · 0.80
UpdateTitleMethod · 0.80
UpdateRectanglesMethod · 0.80
UpdateTitleMethod · 0.80
UpdateDebugInfoMethod · 0.80
ResizeAutoMethod · 0.80
OnParseTextBlocksMethod · 0.80
OnLocationChangedMethod · 0.80
CreateDefaultEditorMethod · 0.80
DrawMethod · 0.80

Calls 4

ProcessTextFunction · 0.85
MaxFunction · 0.50
IsEmptyMethod · 0.45
CountMethod · 0.45

Tested by

no test coverage detected