ExtTextOut doesn't render fonts with ligatures on Windows lazarus / 67-Windows ---------------------------------------------------------------------- vhanla · 2017-04-15 21:19 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: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i 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 := '    ';  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? ---------------------------------------------------------------------- ASerge · 2017-04-21 18:15 Quote from: vhanla on April 15, 2017, 11:19:01 pmI'm having some difficulties trying to render text with ligatures (FiraCode font e.g.) on Windows using ExtTextOut and here are some details: I have tested ExtTextOut with Delphi Tokyo and Lazarus, with Delphi it renders FiraCode ligatures correctly, but with Lazarus it doesn't. I test Delphi 10.2 Tokyo and Delphi 7.0 - it's draw the same as Lazarus. But this code may help you: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.FormPaint(Sender: TObject);var  R: TRect;  Msg: AnsiString;  CharPlaceInfo: TGCPResults;  Glyphs: array of WideChar;begin  R.Left := 12;  R.Top := 12;  R.Width := 400;  R.Bottom := 100;  Msg := '   ';  ZeroMemory(@CharPlaceInfo, SizeOf(CharPlaceInfo));  CharPlaceInfo.lStructSize := SizeOf(CharPlaceInfo);  SetLength(Glyphs, Length(Msg));  CharPlaceInfo.lpGlyphs := @Glyphs[0];  CharPlaceInfo.nGlyphs := Length(Glyphs);  if GetCharacterPlacement(Canvas.Handle, PChar(Msg), Length(Msg), 0, @CharPlaceInfo, GCP_LIGATE) <> 0 then  begin    ExtTextOut(Canvas.Handle, R.Left, R.Top, ETO_CLIPPED or ETO_OPAQUE or ETO_GLYPH_INDEX, @R, Pointer(Glyphs), Length(Glyphs), nil);  end;  R.Top := 42;  DrawText(Canvas.Handle, PChar(Msg), Length(Msg), R, DT_NOCLIP);end; ---------------------------------------------------------------------- vhanla · 2017-04-21 19:53 Awesome,  Thank you, now it shows ligatures.