Method GetTextExtent
GetTextExtent(ReadOnlySpan<char>, Font)
Gets the dimensions of the string using the specified font.
public abstract SizeD GetTextExtent(ReadOnlySpan<char> text, Font font)
Parameters
textReadOnlySpan<char>The text string to measure.
fontFontThe Font used to get text dimensions.
Returns
Remarks
This function only works with single-line strings. It works faster than MeasureText methods.