Method GetTextSize
- Namespace
- OpenCvSharp
- Assembly
- OpenCvSharp.dll
GetTextSize(string, HersheyFonts, double, int, out int)
returns bounding box of the text string
public static Size GetTextSize(string text, HersheyFonts fontFace, double fontScale, int thickness, out int baseLine)
Parameters
textstringInput text string.
fontFaceHersheyFontsFont to use, see #HersheyFonts.
fontScaledoubleFont scale factor that is multiplied by the font-specific base size.
thicknessintThickness of lines used to render the text. See #putText for details.
baseLineintbaseLine y-coordinate of the baseline relative to the bottom-most text
Returns
- Size
The size of a box that contains the specified text.
GetTextSize(Size, string, Point, FontFace, int, int, PutTextFlags, Range?)
Calculates the bounding rect for the text rendered with the specified TrueType font (OpenCV 5).
public static Rect GetTextSize(Size imgsize, string text, Point org, FontFace fontFace, int size, int weight = 0, PutTextFlags flags = PutTextFlags.AlignLeft, Range? wrap = null)
Parameters
imgsizeSizeSize of the target image; can be empty.
textstringText string to be measured (UTF-8 / Unicode is supported).
orgPointBottom-left corner of the first character (see PutTextFlags).
fontFaceFontFaceThe font to use for the text.
sizeintFont size in pixels (by default) or pts.
weightintFont weight, 100..1000. 0 uses the default/instance weight.
flagsPutTextFlagsVarious flags, see PutTextFlags.
wrapRange?Optional text wrapping range. Null uses the default behavior.
Returns
- Rect
The bounding rectangle of the text.