Class Freetype2
Draw UTF-8 strings with freetype/harfbuzz.
public class Freetype2 : SharedPtrObject, IDisposable, IAlgorithm
- Inheritance
-
Freetype2
- Implements
- Inherited Members
- Extension Methods
Constructors
Freetype2()
Create instance to draw UTF-8 strings.
public Freetype2()
Properties
AlgorithmPtr
Native algorithm pointer
public nint AlgorithmPtr { get; }
Property Value
Methods
DisposeObject()
Release all the unmanaged memory associate with this object
protected override void DisposeObject()
GetTextSize(string, int, int, ref int)
Calculates the width and height of a text string.
public Size GetTextSize(string text, int fontHeight, int thickness, ref int baseLine)
Parameters
text
stringInput text string.
fontHeight
intDrawing font size by pixel unit.
thickness
intThickness of lines used to render the text.
baseLine
inty-coordinate of the baseline relative to the bottom-most text point.
Returns
- Size
The approximate size of a box that contains the specified text
LoadFontData(string, int)
Load font data.
public void LoadFontData(string fontFileName, int id)
Parameters
PutText(IInputOutputArray, string, Point, int, MCvScalar, int, LineType, bool)
Renders the specified text string in the image. Symbols that cannot be rendered using the specified font are replaced by "Tofu" or non-drawn.
public void PutText(IInputOutputArray img, string text, Point org, int fontHeight, MCvScalar color, int thickness, LineType lineType, bool bottomLeftOrigin)
Parameters
img
IInputOutputArrayImage.
text
stringText string to be drawn.
org
PointBottom-left/Top-left corner of the text string in the image.
fontHeight
intDrawing font size by pixel unit.
color
MCvScalarText color.
thickness
intThickness of the lines used to draw a text when negative, the glyph is filled. Otherwise, the glyph is drawn with this thickness.
lineType
LineTypeLine type
bottomLeftOrigin
boolWhen true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner.
SetSplitNumber(int)
Set the number of split points from bezier-curve to line. If you want to draw large glyph, large is better. If you want to draw small glyph, small is better.
public void SetSplitNumber(int num)
Parameters
num
intNumber of split points from bezier-curve to line