[Lazarus] Font ligatures support
lazarus at mfriebe.de
Fri Oct 2 15:19:56 CEST 2020
On 02/10/2020 05:54, Mr Bee via lazarus wrote:
> 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
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.)
More information about the lazarus