This is how it looks on Win 11 and Ubuntu 22.04:
Are there any solutions to make the same behavior for Linux?
The code:
unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
FMX.Controls.Presentation, FMX.StdCtrls, FMX.TextLayout, System.Generics.Collections, System.Character, FMX.Objects;
type
TMyLabel = class(TLabel)
end;
type
TTextAccess = class(TText);
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
FLabel: TMyLabel;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
procedure TForm1.FormCreate(Sender: TObject);
procedure AddAttr(ALayout: TTextLayout; const AStart, ALength: Integer; const AColor: TAlphaColor; const AFontStyle: TFontStyles = []);
var
TR: TTextRange;
TA: TTextAttribute;
begin
TR := TTextRange.Create(AStart, ALength);
ALayout.Font.Style := AFontStyle;
TA := TTextAttribute.Create(ALayout.Font, AColor);
ALayout.AddAttribute(TR, TA);
end;
var
Layout: TTextLayout;
begin
FLabel := TMyLabel.Create(Self);
FLabel.Parent := Self;
FLabel.Text := 'Red Green Blue';
Layout := TTextAccess(FLabel.TextObject).Layout;
AddAttr(Layout, 0, 3, TAlphaColors.Red);
AddAttr(Layout, 4, 5, TAlphaColors.Green);
AddAttr(Layout, 10, 4, TAlphaColors.Blue);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
FLabel.Free;
end;
end.