simin_sh, it works. I attached the minimum needed changes for TFontManager.
To test:
1-Copy the contents of Lazarus\fpc\3.0.0\source\packages\fcl-image\src folder to your project folder.
2-Replace freetype.pp file with the one in this post.
You'll need to modify minibidi file to include Persian characters (Arabic Letter Perian Yeh) as mentioned in
this post.
If you still have a problem, report back here.
1
st Edit:
I changed your example a bit:
program project1;
{$mode objfpc}{$H+}
{$codepage UTF8}
uses
minibidi,
Classes,
SysUtils,
FPimage,
FPImgCanv,
ftfont,
FPWritePNG,
FPCanvas,
lconvencoding,
LazUTF8;
var
vae: WideString;
s: string;
ImgCanvas: TFPImageCanvas;
Img: TFPMemoryImage;
AFont: TFreeTypeFont;
begin
s := 'السلام عليكم';
vae := s;
BidiString(vae, [bdoApplyShape], bdnArabic, bdpDefault, bdlNone);
s := vae;
ftfont.InitEngine;
FontMgr.SearchPath := ExtractFilePath(ParamStr(0));
AFont := TFreeTypeFont.Create;
Img := TFPMemoryImage.Create(200, 100);
Img.UsePalette := False;
ImgCanvas := TFPImageCanvas.Create(Img);
ImgCanvas.Brush.FPColor := colWhite;
ImgCanvas.Brush.Style := bsSolid;
ImgCanvas.Rectangle(0, 0, Img.Width, Img.Height);
ImgCanvas.Font := AFont;
//ImgCanvas.Font.Name := 'B Titr';
ImgCanvas.Font.Name := 'Arial';
ImgCanvas.Font.Size := 20;
ImgCanvas.TextOut(10, 30, s);
ImgCanvas.Image.SaveToFile('Pics.png');
AFont.Free;
ImgCanvas.Free;
Img.Free;
//writeln(vae);
//ReadLn;
end.
Check the attached image.
2
nd Edit:
Changed bdlNone in BidiString to bdlComplex. The result is Pic2.png
3
rd Edit:
Pic3.png the original text in your first post 'فارسی'.