Adjusting TextOutPlugin font parameters

Hello,
I’m using the following code to display text at specific positions on my live view, but am unable to find a way to adjust the font parameters (size, font family, etc). The default font size is very large, so not particularly useful as it is.

The code:

void CreateText(int id, int color, Point position, string text) {
     Cvb.Image.CreatePixelList(2, out Cvb.SharedPixelList pixelList);
     Cvb.Image.AddPixel(pixelList, new double[] { position.X, position.Y });
           
     Cvb.Plugin.TStaticTextOutPlugInData txt = new Cvb.Plugin.TStaticTextOutPlugInData(text, false);
     Display.AddOverlayObjectNET2("StaticTextOut", text, false, false, color, color,
                false, IDPool.GrabID(), pixelList, txt.ToIntPtr().ToInt64());
 }

As always, any help would be much appreciated.

Best regards,
Lee

1 Like

Hi Lee,

You can use TTextOutPlugInData instead of TStaticTextOutPlugInData.
There you have much more options:

private struct Data
{
	public int FontSize;
	public TFontWeight FontWeight;
	public int Rotation;
	public bool Italic;
	public bool Underline;
	public string FontName;
	public string Text;
	public TStringType StringType;
	public int Flags;
}

Best regards
Thomas

1 Like

For the sake of completeness: This of course also means that you’d need to change the "StaticTextOut" in the call to AddOverlayObjectNET2 to a TextOut :slight_smile:

2 Likes

Excellent - works nicely :slight_smile:
Thank you @illusive and Thomas!

1 Like