[Lazarus] Font ligatures support

classic Classic list List threaded Threaded
38 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Font ligatures support

Free Pascal - Lazarus mailing list
Hi,

It seems Lazarus’ source editor still doesn’t support font ligatures. I’d love to use them in Lazarus to increase the code readability as I’ve used them in many other code editors (using other languages too). 

Some popular fonts for that are Fira Code and JetBrains Mono. I’ve tried both of them with Lazarus editor but the ligatures don’t work.

Is there any plan to support font ligatures in the near future? Or is there any special setting to enable it?

Thank you.

Best regards,

~Bee


--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Font ligatures support

Free Pascal - Lazarus mailing list
On 02/10/2020 05:54, Mr Bee via lazarus wrote:

> Hi,
>
> It seems Lazarus’ source editor still doesn’t support font ligatures.
> I’d love to use them in Lazarus to increase the code readability as
> I’ve used them in many other code editors (using other languages too).
>
> Some popular fonts for that are Fira Code and JetBrains Mono. I’ve
> tried both of them with Lazarus editor but the ligatures don’t work.
>
> Is there any plan to support font ligatures in the near future? Or is
> there any special setting to enable it?
>

Are they strictly monospaced?

Are the chars IimXW and @ all the same width? (@ often is wider)

If any of those chars returns a different width, the SynEdit enforces
the width, by calling ExTextOut with an "ETO" array.
And that leads to each char painted on its own.

You can find the function "NeedETO" and set it to hardcoded False. That
will prevent the enforcements (except in right to left scripts).
But it will have side effects. SynEdit will place the caret, as if every
char was exactly n pixel wide.
And if text color changes, the text is continued according to the
calculated width. So if you select/deselect text, it will start moving a
few pixel.

To get all this really working, SynEdit would need to use an entirely
different Text API. It would need to know the width of each char, as it
is drawn in context. (That is measuring a char of its own is no help,
because the char may change width depending on the chars next to it.)

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Font ligatures support

Free Pascal - Lazarus mailing list
Pada Jumat, 2 Oktober 2020 20.20.09 WIB, Martin Frb via lazarus <[hidden email]> menulis:

> Are they strictly monospaced?

AFAIK they are as long as you use monospaced font such as Fira Code or JetBrains Mono.

> You can find the function "NeedETO" and set it to hardcoded False. That
> will prevent the enforcements (except in right to left scripts).

Where can I find that function? Is it within Lazarus IDE code or in SynEdit code?
Pascal code is always written left to right, isn’t it?

> But it will have side effects. SynEdit will place the caret, as if every
> char was exactly n pixel wide.

It shouldn’t be a problem with monospaced font, I suppose. I will try it and see what happen.

Thank you.

Best regards,

~Bee


--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Font ligatures support

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
Am 02.10.2020 um 15:19 schrieb Martin Frb via lazarus:

> On 02/10/2020 05:54, Mr Bee via lazarus wrote:
>> Hi,
>>
>> It seems Lazarus’ source editor still doesn’t support font ligatures.
>> I’d love to use them in Lazarus to increase the code readability as
>> I’ve used them in many other code editors (using other languages too).
>>
>> Some popular fonts for that are Fira Code and JetBrains Mono. I’ve
>> tried both of them with Lazarus editor but the ligatures don’t work.
>>
>> Is there any plan to support font ligatures in the near future? Or is
>> there any special setting to enable it?
>>
>
> Are they strictly monospaced?

Is there something that needs to be enabled to get ligatures working on
Windows? I'm using Microsoft's Cascadia Code for example in VS 2019
where ligatures work correctly, but in Lazarus nothing happens. The
ligatures have the same widths as the equal N characters (so the
ligature for <> has the same width as both characters together).

Regards,
Sven
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Font ligatures support

Free Pascal - Lazarus mailing list
On 02.10.2020 23:48, Sven Barth via lazarus wrote:
> Is there something that needs to be enabled to get ligatures working
> on Windows?

You need to use one of APIs which support it (afair, DrawTextW?) and
output whole ligature, not char-by-char.

--
Regards,
Alexey

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Font ligatures support

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On 02/10/2020 22:48, Sven Barth via lazarus wrote:
>
>> Are they strictly monospaced?
>
> Is there something that needs to be enabled to get ligatures working
> on Windows? I'm using Microsoft's Cascadia Code for example in VS 2019
> where ligatures work correctly, but in Lazarus nothing happens. The
> ligatures have the same widths as the equal N characters (so the
> ligature for <> has the same width as both characters together).
If you use the following to output on a plain canvas

procedure TForm1.FormPaint(Sender: TObject);
var
   r: TRect;
   s: String;
begin
   r.Top := 0;
   r.Left := 0;
   r.Bottom := 50;
   r.Right := 50;
   s := 'abcdef';
   LCLIntf.ExtUTF8Out(Canvas.Handle, 10, 10, ETO_OPAQUE+ETO_CLIPPED, @r,
@s[1], 5, nil)

end;

Do you get the ligature?
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Font ligatures support

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On 03/10/2020 12:03, Alexey Tor. via lazarus wrote:
> On 02.10.2020 23:48, Sven Barth via lazarus wrote:
>> Is there something that needs to be enabled to get ligatures working
>> on Windows?
>
> You need to use one of APIs which support it (afair, DrawTextW?) and
> output whole ligature, not char-by-char.
>

SynEdit currently uses ExtTextOutW
I don't know if that is good enough. Nor how different it is compared to
DrawTextW.

If replaced, the new function must be supported by all widgetsets.

Also, what ever function is used must currently support an "ETO" array.
That is for each char outputted, a width in Pixel can be given.
That is for example needed
- to enforce same width for Arabic text chars
- unicode chars of ambiguous width
- for fonts that are not strictly monospaced




--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Font ligatures support

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
It's not very simple. see file
https://github.com/Alexey-T/ATSynEdit/blob/master/atsynedit/atsynedit_canvasproc.pas
and search for "ligatures" in all places. Unit has special code for win32.
>
> Do you get the ligature?
> --


--
Regards,
Alexey

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Font ligatures support

Free Pascal - Lazarus mailing list
On 03/10/2020 16:34, Alexey Tor. via lazarus wrote:
It's not very simple. see file
https://github.com/Alexey-T/ATSynEdit/blob/master/atsynedit/atsynedit_canvasproc.pas
and search for "ligatures" in all places. Unit has special code for win32.

Actually might be easier than thought....

if GetCharacterPlacementW(DC, PWChar(Str), Length(Str), 0, @CharPlaceInfo, GCP_LIGATE)<> 0 then
Result:= Windows.ExtTextOutW(DC, X, Y, ETO_CLIPPED or ETO_OPAQUE or ETO_GLYPH_INDEX, Rect, Pointer(Glyphs), Length(Glyphs), Dx)
else
Result:= Windows.ExtTextOutW(DC, X, Y, ETO_CLIPPED or ETO_OPAQUE, Rect, PWChar(Str), Length(Str), Dx);

- If indeed the DX array is still applicable with the glyphs....
- And if that is supported on all widgetsets...
- And as long as the font does still behave monospaced ...


--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Font ligatures support

Free Pascal - Lazarus mailing list
If it does work, would you please submit it as a patch for the next release? At least, add a note that the font ligatures feature only supports monospaced fonts and only works on Windows. It's better than nothing.

Thank you.

–Mr Bee



Pada Sabtu, 3 Oktober 2020 22.37.58 WIB, Martin Frb via lazarus <[hidden email]> menulis:


On 03/10/2020 16:34, Alexey Tor. via lazarus wrote:
It's not very simple. see file
https://github.com/Alexey-T/ATSynEdit/blob/master/atsynedit/atsynedit_canvasproc.pas
and search for "ligatures" in all places. Unit has special code for win32.

Actually might be easier than thought....

if GetCharacterPlacementW(DC, PWChar(Str), Length(Str), 0, @CharPlaceInfo, GCP_LIGATE)<> 0 then
Result:= Windows.ExtTextOutW(DC, X, Y, ETO_CLIPPED or ETO_OPAQUE or ETO_GLYPH_INDEX, Rect, Pointer(Glyphs), Length(Glyphs), Dx)
else
Result:= Windows.ExtTextOutW(DC, X, Y, ETO_CLIPPED or ETO_OPAQUE, Rect, PWChar(Str), Length(Str), Dx);

- If indeed the DX array is still applicable with the glyphs....
- And if that is supported on all widgetsets...
- And as long as the font does still behave monospaced ...


--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

[Lazarus] -dWINDOWS_LIGATURE [[Re: Font ligatures support]]

Free Pascal - Lazarus mailing list
On 04/10/2020 10:14, Mr Bee wrote:
If it does work, would you please submit it as a patch for the next release? At least, add a note that the font ligatures feature only supports monospaced fonts and only works on Windows. It's better than nothing.

revision 63951

Windows only, compile with -dWINDOWS_LIGATURE
Tested with Cascadia.

If someone wants to add an option "show ligatures" ($IFDEF WINDOWS} to the IDE options (Editor > Display / like the anti aliasing option), then the feature can depend on that, and no longer needs the define.


On 02/10/2020 22:48, Sven Barth via lazarus wrote:
 I'm using Microsoft's Cascadia Code

According to my tests (libre office) Cascadia Mono does not do ligatures, but normal Cascadia works.

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] -dWINDOWS_LIGATURE [[Re: Font ligatures support]]

Free Pascal - Lazarus mailing list
04.10.2020 19:05, Martin Frb via lazarus пишет:

> On 04/10/2020 10:14, Mr Bee wrote:
>> If it does work, would you please submit it as a patch for the next
>> release? At least, add a note that the font ligatures feature only
>> supports monospaced fonts and only works on Windows. It's better than
>> nothing.
>>
> revision 63951
>
> Windows only, compile with -dWINDOWS_LIGATURE
> Tested with Cascadia.

Lazarus hangs on start for me on Windows 7 when compiled with this define.

Lazarus 2.1.0 r63957 FPC 3.2.0 i386-win32-win32/win64. I use JetBrains
Mono font.

--
Best regards,
  Maxim Ganetsky                  mailto:[hidden email]
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] -dWINDOWS_LIGATURE [[Re: Font ligatures support]]

Free Pascal - Lazarus mailing list
On 05/10/2020 00:27, Maxim Ganetsky via lazarus wrote:

> 04.10.2020 19:05, Martin Frb via lazarus пишет:
>> On 04/10/2020 10:14, Mr Bee wrote:
>>> If it does work, would you please submit it as a patch for the next
>>> release? At least, add a note that the font ligatures feature only
>>> supports monospaced fonts and only works on Windows. It's better
>>> than nothing.
>>>
>> revision 63951
>>
>> Windows only, compile with -dWINDOWS_LIGATURE
>> Tested with Cascadia.
>
> Lazarus hangs on start for me on Windows 7 when compiled with this
> define.
>
> Lazarus 2.1.0 r63957 FPC 3.2.0 i386-win32-win32/win64. I use JetBrains
> Mono font.
>
Could you start with an empty project? To make sure its not content related?

Though the code changes do not have any loop.

You could run in gdb

gdb lazarus.exe

r

ctrl-c when it hangs

bt

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] -dWINDOWS_LIGATURE [[Re: Font ligatures support]]

Free Pascal - Lazarus mailing list
05.10.2020 1:48, Martin Frb via lazarus пишет:

> On 05/10/2020 00:27, Maxim Ganetsky via lazarus wrote:
>> 04.10.2020 19:05, Martin Frb via lazarus пишет:
>>> On 04/10/2020 10:14, Mr Bee wrote:
>>>> If it does work, would you please submit it as a patch for the next
>>>> release? At least, add a note that the font ligatures feature only
>>>> supports monospaced fonts and only works on Windows. It's better
>>>> than nothing.
>>>>
>>> revision 63951
>>>
>>> Windows only, compile with -dWINDOWS_LIGATURE
>>> Tested with Cascadia.
>>
>> Lazarus hangs on start for me on Windows 7 when compiled with this
>> define.
>>
>> Lazarus 2.1.0 r63957 FPC 3.2.0 i386-win32-win32/win64. I use JetBrains
>> Mono font.
>>
> Could you start with an empty project? To make sure its not content
> related?
>
> Though the code changes do not have any loop.
>
> You could run in gdb
>
> gdb lazarus.exe
>
> r
>
> ctrl-c when it hangs
>
> bt

Tried with an empty project, nothing changed. Actually it does not hang,
it segfaults. GDB output:

i:\FPC\lazarus>i:\FPC\lazarus_gdb_w32\bin\gdb.exe lazarus.old.exe
GNU gdb (GDB) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from lazarus.old.exe...done.
(gdb) r
Starting program: i:\FPC\lazarus\lazarus.old.exe
[New Thread 6324.0x994]
[New Thread 6324.0x1834]
[Thread 6324.0x1834 exited with code 0]
[New Thread 6324.0x1c78]

Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
(gdb) bt
#0  0x00000000 in ?? ()
#1  0x00000024 in ?? ()
#2  0x00ab95f6 in DRAWHILIGHTMARKUPTOKEN (ATOKENINFO=...,
parentfp=0x13abf6e8)
     at lazsyntextarea.pp:1741
#3  0x00ab8a8e in PAINTLINES (parentfp=0x13abf6e8) at lazsyntextarea.pp:1798
#4  0x00ab86f3 in TLAZSYNTEXTAREA__PAINTTEXTLINES (ACLIP=..., FIRSTLINE=0,
     LASTLINE=27, FIRSTCOL=1, LASTCOL=154, this=<error reading variable>)
     at lazsyntextarea.pp:1870
#5  0x00ab831c in TLAZSYNTEXTAREA__DOPAINT (ACANVAS=0x1a798798, ACLIP=...,
     this=<error reading variable>) at lazsyntextarea.pp:1489
#6  0x00ab00d0 in TLAZSYNSURFACE__PAINT (ACANVAS=0x1a798798, ACLIP=...,
     this=<error reading variable>) at syneditmiscclasses.pp:1308
#7  0x00ab6f82 in TLAZSYNSURFACEMANAGER__DOPAINT (ACANVAS=0x1a798798,
     ACLIP=..., this=<error reading variable>) at lazsyntextarea.pp:1134
#8  0x00ab00d0 in TLAZSYNSURFACE__PAINT (ACANVAS=0x1a798798, ACLIP=...,
     this=<error reading variable>) at syneditmiscclasses.pp:1308
#9  0x00c1c402 in TSOURCELAZSYNSURFACEMANAGER__DOPAINT (ACANVAS=0x1a798798,
     ACLIP=..., this=<error reading variable>) at sourcesyneditor.pas:1353
#10 0x00ab00d0 in TLAZSYNSURFACE__PAINT (ACANVAS=0x1a798798, ACLIP=...,
     this=<error reading variable>) at syneditmiscclasses.pp:1308
#11 0x0070603f in TCUSTOMSYNEDIT__PAINT (this=<error reading variable>)
     at synedit.pp:4221
#12 0x0057270d in TCUSTOMCONTROL__PAINTWINDOW (DC=469832019,
     this=<error reading variable>) at ./include/customcontrol.inc:123
---Type <return> to continue, or q <return> to quit---
#13 0x0055ffa7 in TWINCONTROL__PAINTHANDLER (THEMESSAGE=...,
     this=<error reading variable>) at ./include/wincontrol.inc:4857
#14 0x00563427 in TWINCONTROL__WMPAINT (MSG=...,
     this=<error reading variable>) at ./include/wincontrol.inc:6850
#15 0x00572630 in TCUSTOMCONTROL__WMPAINT (MESSAGE=...,
     this=<error reading variable>) at ./include/customcontrol.inc:103
#16 0x00410221 in SYSTEM$_$TOBJECT_$__$$_DISPATCH$formal ()
#17 0x00000001 in ?? ()
#18 0x0120f754 in VMT_$CONTROLS_$$_TCUSTOMCONTROL ()
#19 0x0120f2b8 in VMT_$CONTROLS_$$_TGRAPHICCONTROL$indirect ()
#20 0x005725f0 in TCUSTOMCONTROL__WSREGISTERCLASS (pvmt=0x13abfbf4)
     at ./include/customcontrol.inc:90
#21 0x0056100b in TWINCONTROL__WNDPROC (MESSAGE=...,
     this=<error reading variable>) at ./include/wincontrol.inc:5429
#22 0x0070d54f in TCUSTOMSYNEDIT__WNDPROC (MSG=...,
     this=<error reading variable>) at synedit.pp:6399
#23 0x0061ff2a in DELIVERMESSAGE (TARGET=0x1bdaf3a0,
     AMESSAGE=<error reading variable: Attempt to dereference a generic
pointer.>
) at lclmessageglue.pas:112
#24 0x0054410f in TWINDOWPROCHELPER__SENDPAINTMESSAGE (CONTROLDC=0,
this=...)
     at ./win32/win32callback.inc:746
#25 0x00547922 in TWINDOWPROCHELPER__DOWINDOWPROC (this=...)
     at ./win32/win32callback.inc:2357
#26 0x005487a1 in WINDOWPROC (WINDOW=1312066, MSG=15, WPARAM=0, LPARAM=0)
---Type <return> to continue, or q <return> to quit---
     at ./win32/win32callback.inc:2774
#27 0x76f1630a in gapfnScSendMessage () from C:\Windows\syswow64\user32.dll
#28 0x00140542 in ?? ()
#29 0x76f17326 in USER32!GetDC () from C:\Windows\syswow64\user32.dll
#30 0x00548750 in TWINDOWPROCHELPER__DOWINDOWPROC (
     this=<error reading variable: Cannot access memory at address 0x0>)
     at ./win32/win32callback.inc:2745
#31 0x76f16df8 in USER32!GetThreadDesktop ()
    from C:\Windows\syswow64\user32.dll
#32 0x00000000 in ?? ()
(gdb)

--
Best regards,
  Maxim Ganetsky                  mailto:[hidden email]
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] -dWINDOWS_LIGATURE [[Re: Font ligatures support]]

Free Pascal - Lazarus mailing list
On 05/10/2020 01:02, Maxim Ganetsky via lazarus wrote:

> 05.10.2020 1:48, Martin Frb via lazarus пишет:
>> On 05/10/2020 00:27, Maxim Ganetsky via lazarus wrote:
>>>
>>> Lazarus hangs on start for me on Windows 7 when compiled with this
>>> define.
>>>
>>> Lazarus 2.1.0 r63957 FPC 3.2.0 i386-win32-win32/win64. I use
>>> JetBrains Mono font.
>>>
>> Could you start with an empty project? To make sure its not content
>> related?
>>
>> Though the code changes do not have any loop.
>>
>> You could run in gdb
>>
>> gdb lazarus.exe
>>
>> r
>>
>> ctrl-c when it hangs
>>
>> bt
>
> Tried with an empty project, nothing changed. Actually it does not
> hang, it segfaults. GDB output:
>

Ok, that is in the new code (inside the OS call...).
So some param that it does not like..

Could you try in file syntextdrawer.pp
line 792
function TheFontStock.GetNeedETO: Boolean;
To ALWAYS return false.

Maybe it does not like to have a DX/ETO param.

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] -dWINDOWS_LIGATURE [[Re: Font ligatures support]]

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
Martin Frb via lazarus <[hidden email]> schrieb am So., 4. Okt. 2020, 18:05:
On 04/10/2020 10:14, Mr Bee wrote:
If it does work, would you please submit it as a patch for the next release? At least, add a note that the font ligatures feature only supports monospaced fonts and only works on Windows. It's better than nothing.

revision 63951

Windows only, compile with -dWINDOWS_LIGATURE
Tested with Cascadia.

If someone wants to add an option "show ligatures" ($IFDEF WINDOWS} to the IDE options (Editor > Display / like the anti aliasing option), then the feature can depend on that, and no longer needs the define.

Thank you! Will test when I find the time. :) 



On 02/10/2020 22:48, Sven Barth via lazarus wrote:
 I'm using Microsoft's Cascadia Code

According to my tests (libre office) Cascadia Mono does not do ligatures, but normal Cascadia works.

Yes, Cascadia Mono is without ligatures, Cascadia Code is with them. 

Regards, 
Sven 

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Win 7 issue / Re: -dWINDOWS_LIGATURE [[Re: Font ligatures support]]

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On 05/10/2020 00:27, Maxim Ganetsky via lazarus wrote:
> Lazarus hangs on start for me on Windows 7 when compiled with this
> define.
>
> Lazarus 2.1.0 r63957 FPC 3.2.0 i386-win32-win32/win64. I use JetBrains
> Mono font.
>
I installed the font myself. And it works on windows 10 and that works.

However I found one possible issue.

Please go to
SynTextDrawer.pp
line 1269
and replace the current
     Windows.ExtTextOutW(FDC, X, Y, fuOptions or ETO_GLYPH_INDEX,
@ARect, Pointer(Glyphs), Length(Glyphs), EtoArray);
with the following new
     Windows.ExtTextOutW(FDC, X, Y, fuOptions or ETO_GLYPH_INDEX,
@ARect, Pointer(Glyphs), CharPlaceInfo.nGlyphs, EtoArray);

The other ...TextOut in the lines below that should be kept as they are.
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] -dWINDOWS_LIGATURE [[Re: Font ligatures support]]

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
Am 04.10.2020 um 18:05 schrieb Martin Frb via lazarus:
On 04/10/2020 10:14, Mr Bee wrote:
If it does work, would you please submit it as a patch for the next release? At least, add a note that the font ligatures feature only supports monospaced fonts and only works on Windows. It's better than nothing.

revision 63951

Windows only, compile with -dWINDOWS_LIGATURE
Tested with Cascadia.

If someone wants to add an option "show ligatures" ($IFDEF WINDOWS} to the IDE options (Editor > Display / like the anti aliasing option), then the feature can depend on that, and no longer needs the define.

I've tested it (with Cascadia Code) and while it shows the one or other ligature, Visual Studio shows more.

Take the following sequence:

-> => >= <= *** .. ... <> >< >> << >>> <<< == !=

Visual Studio shows all as ligatures except the first one and the symmetric difference (I think it doesn't have one)

Lazarus however only shows >=, <=, <>  and .. as ligatures and for the three points it displays them as ".. .", so the first two are presented by their ligature, but the third dot is done separately (unlike in Visual Studio).

Regards,
Sven

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] -dWINDOWS_LIGATURE [[Re: Font ligatures support]]

Free Pascal - Lazarus mailing list
On 05/10/2020 22:46, Sven Barth via lazarus wrote:
> I've tested it (with Cascadia Code) and while it shows the one or
> other ligature, Visual Studio shows more.
>
> Take the following sequence:
>
> -> => >= <= *** .. ... <> >< >> << >>> <<< == !=

I found that if I put them into a string or comment, then they do all
ligate....
Equally if I switch off the Highlighter

Maybe the HL's tokenizer.
Could be the HL sees a - as one token, and has that printed individually.

So those tokens either need to be kept together (But pascal dictates the
"-" as one token), or joined together again.
=> is one Pascal token
-> is not. The HL sees 2 tokens (never mind they make no sense in that
order)

Currently also ligatures do get broken, if you extend the selection, and
have half of it selected.
That requires a rewrite of some parts of the painting code (needs to get
into my TODO queue...)
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Win 7 issue / Re: -dWINDOWS_LIGATURE [[Re: Font ligatures support]]

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
05.10.2020 18:36, Martin Frb via lazarus пишет:

> On 05/10/2020 00:27, Maxim Ganetsky via lazarus wrote:
>> Lazarus hangs on start for me on Windows 7 when compiled with this
>> define.
>>
>> Lazarus 2.1.0 r63957 FPC 3.2.0 i386-win32-win32/win64. I use JetBrains
>> Mono font.
>>
> I installed the font myself. And it works on windows 10 and that works.
>
> However I found one possible issue.
>
> Please go to
> SynTextDrawer.pp
> line 1269
> and replace the current
>      Windows.ExtTextOutW(FDC, X, Y, fuOptions or ETO_GLYPH_INDEX,
> @ARect, Pointer(Glyphs), Length(Glyphs), EtoArray);
> with the following new
>      Windows.ExtTextOutW(FDC, X, Y, fuOptions or ETO_GLYPH_INDEX,
> @ARect, Pointer(Glyphs), CharPlaceInfo.nGlyphs, EtoArray);
>
> The other ...TextOut in the lines below that should be kept as they are.

This change does not help.

I also tried your suggestion to make function TheFontStock.GetNeedETO to
always return false.

This did not make any difference too.

--
Best regards,
  Maxim Ganetsky                  mailto:[hidden email]
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
12