Thank you, it solved that problem, but now there is another problem with texts in Bgrabitmap,
as you can see in screenshots (First is what i want, second is the result of my code in Bgrabitmap as a .Png file) i am trying to display a paragraph of Persian sentences, and when i write it in the code it displays correct (except the point should stay in the end of my sentence because the language is right to left but it stays in begin of it which means end of string!) but the result in the Bgrabitmap is Messed up(it seems that it started the sentences from end!) in Microsoft office word application, it is all about alignment to be set as "justified" and direction to be set as "Right-To-Left" and the Persian sentences will be Stacking in the correct way, and by the way, in BgraBitmap with LCL (Gui) there is not such problem!
here is my code:
program project1;
uses
Classes,
BGRABitmap,
BGRABitmapTypes,
LazFreeTypeFontCollection,
SysUtils,
MiniBidi,
BGRAGraphics;
function BidiStringUTF8(AText: string): string;
var
wText: WideString;
begin
wText := UTF8Decode(AText);
BidiString(wText);
Result := UTF8Encode(wText);
end;
type
Test1NoGuiClass = class
protected
public
procedure DrawPic;
end;
procedure Test1NoGuiClass.DrawPic;
var
bmp: TBGRABitmap;
FFontCollection: TFreeTypeFontCollection;
s: string;
begin
FFontCollection := TFreeTypeFontCollection.Create;
FFontCollection.AddFile('Fonts/segoeui.ttf');
SetDefaultFreeTypeFontCollection(FFontCollection);
bmp := TBGRABitmap.Create(600, 400, BGRA(255, 255, 255));
bmp.FontName := 'Segoe UI';
bmp.FontHeight := bmp.Height div 30;
s:= 'شما با داشتن این نرم افزار دیگر نیازی ندارید که به سایت های ترجمه ی آنلاین مراجعه کنید زیرا به طور مستقیم از کامپیوتر خود می توانید متون مورد نظر خود را ترجمه کنید. همچنین این نرم افزار قادر است تا صفحات وب سایت هایی را که در فایل ذخیره شده اند را اجرا کند و سپس ترجمه ی کلمات و متنهای موجود در آن را در اختیارتان قرار دهد. ';
bmp.TextRect(rect(0, 0, 600, 400), BidiStringUTF8(s), taRightJustify,
tlTop, BGRA(0, 0, 0));
bmp.SaveToFile('Pics/1.png');
bmp.Free;
end;
var
App: Test1NoGuiClass;
begin
App.DrawPic;
end.
any help appreciated prior