Emgu-CV-4.5.3 : Freetype2 class dont show correctly utf8 text

hi, i use this code for show utf8 text on image, [ Persian text, utf8 format ], but my text show inverted! - how i can fix this problem?

#region Create Image Output
Mat ImageOutput = new Mat(400, 600, DepthType.Cv8U, 3);
ImageOutput.SetTo(new MCvScalar(System.Drawing.Color.Wheat.B, System.Drawing.Color.Wheat.G, System.Drawing.Color.Wheat.R));

#region Variables
string text = "سلام";
var centerPoint = new System.Drawing.Point(ImageOutput.Cols / 2, ImageOutput.Rows / 2);
int fontHeight = 36;
MCvScalar color = new MCvScalar(0, 0, 255);
int thickness = 1;
LineType lineType = LineType.EightConnected;
bool bottomLeftOrigin = false;

#region Add text to image
// create an object from 'Freetype2' class
Emgu.CV.Freetype.Freetype2 freetype2 = new Emgu.CV.Freetype.Freetype2();

// set font
string windowsFontsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Fonts);
string fontPath = windowsFontsPath + @"\Tahoma.ttf";
freetype2.LoadFontData(fontPath, 0);

// PutText
freetype2.PutText(ImageOutput, text, centerPoint, fontHeight, color, thickness, lineType, bottomLeftOrigin);

#region Show Result
AddImage(ImageOutput.ToImage<Bgr,byte>(), "ImageOutput");

What my code shows in the output is wrong ( it is displayed in reverse ) :

My codes should show this text [ when i try publish my question, site tell me "Sorry, new users can only put one embedded media item in a post.
" then i upload second image on other website ]:

  • سلام = HI :wink:

can reproduce this.

probably a bug in how opencv uses the results from freetype.

you should open an issue on opencv’s github about this.

#!/usr/bin/env python3
import numpy as np
import cv2 as cv

ft = cv.freetype.createFreeType2()
#ft.loadFontData(R"C:\Windows\Fonts\Tahoma.ttf", 0)
ft.loadFontData(R"C:\Windows\Fonts\Calibri.ttf", 0)

canvas = np.empty((400, 600, 3), np.uint8)
canvas[:] = (179, 222, 245)

text = "سلام = HI"
text = "\u0633\u0644\u0627\u0645 = HI"

	org=(100, 200),
	color=(0, 0, 255),

cv.imshow("canvas", canvas)