Hello
I'm having some difficulties trying to render text with ligatures (FiraCode font e.g.) on Windows
using ExtTextOut and here are some details:
OSes: Windows 10 x64 Ent. Creator Update / Ubuntu 16.04 x64
Lazarus Version: 1.6.4 / FPC: 3.0.2
Units: LCLType, LCLIntf
-----------------------------------------------------------------------
On Windows:
I have tested ExtTextOut with Delphi Tokyo and Lazarus, with Delphi it renders FiraCode ligatures correctly, but with Lazarus it doesn't.
However, DrawText render text with ligatures just as expected, both on Delphi / Lazarus.
Snaphost (with first line rendered with ExtTextOut and the second one with DrawText) using the code sample below:
(https://i.imgur.com/fDORkHz.png) (attached img below)
On Linux:
No problems here, ExtTextOut renders with ligatures, as expected.
Code Sample:
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, LCLType, LCLIntf;
type
{ TForm1 }
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormPaint(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
Font.Name := 'Fira Code';
Font.Size := 12;
end;
procedure TForm1.FormPaint(Sender: TObject);
var
R : TRect;
msg: AnsiString;
begin
R.Left := 12;
R.Top := 12;
R.Width := 400;
R.Height := 100;
msg := ' <!-- tag html -->';
ExtTextOut(Canvas.Handle,12,12,ETO_CLIPPED or ETO_OPAQUE,@R,pchar(msg),length(msg),nil);
R.Top := 42;
DrawText(Canvas.Handle, PChar(msg), Length(msg), R, DT_NOCLIP);
end;
end.
Any suggestions apart from switching to DrawText?