Recent

Author Topic: I can't change the code editor font in Linux... Anyone?...  (Read 3970 times)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7410
  • Debugger - SynEdit - and more
    • wiki
Re: I can't change the code editor font in Linux... Anyone?...
« Reply #15 on: April 27, 2021, 05:28:13 pm »
AFAIK synedit only acceps monospaced fonts.
Well yes... and a yet, not.

See the unit SynTextDrawer. And {$IFDEF SYNFONTDEBUG} sections.

SynEdit measures the font that it is given. It measure certain individual chars MWXi':m@ and some sequences.
If they do not return monospaced sizes (can also happen for sub-pixel sizes), the SynEdit will place each char into a forced pos. That is what happens to the OT.

So in that sense, SynEdit will "work" with none monospaced fonts, but the result is usually real bad.

-------
In the QT example, SynEdit got good measurements, but the real output is actually wider. No idea why.

winni

  • Hero Member
  • *****
  • Posts: 2668
Re: I can't change the code editor font in Linux... Anyone?...
« Reply #16 on: April 27, 2021, 06:26:44 pm »


So in that sense, SynEdit will "work" with none monospaced fonts, but the result is usually real bad.

-------
In the QT example, SynEdit got good measurements, but the real output is actually wider. No idea why.


Hi!

Looking at proportional fonts with a monospaced distance is unreadable, makes headache and should be prohibited by the IDE

The wider output might come from the option "extra character spacing".

Winni

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7410
  • Debugger - SynEdit - and more
    • wiki
Re: I can't change the code editor font in Linux... Anyone?...
« Reply #17 on: April 27, 2021, 07:17:46 pm »
Looking at proportional fonts with a monospaced distance is unreadable, makes headache and should be prohibited by the IDE

Quote
The bug is, that the IDE allows also proportional fonts.

Both valid points. Except the latter should be "A bug is".
It is not (or not necessarily) the bug causing the issues described here.

My understanding is that the original bug is, that the selected font is not used. And that includes, if the selected font is monospaced. So there is a bug that even affects monospaced fonts.

As for the 2nd issue, that may be caused by a none monospaced font.
But SynEdit should have measured it. So the measuring must be broken in QT.

C#R#

  • New Member
  • *
  • Posts: 45
Re: I can't change the code editor font in Linux... Anyone?...
« Reply #18 on: April 27, 2021, 09:34:59 pm »
Hi Martin,

I think isn't a font problem, look this images, one is gtk2 and other is qt5(with fail).

Thanks !

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7410
  • Debugger - SynEdit - and more
    • wiki
Re: I can't change the code editor font in Linux... Anyone?...
« Reply #19 on: April 27, 2021, 10:45:20 pm »
I think isn't a font problem, look this images, one is gtk2 and other is qt5(with fail).
Well, what I can see is that while you chosen the same font (font of the same name) under gtk2 and qt, the font that is used is different.
Look at line 16 of the preview, the lowercase "i" in "inc" is very different.

What I can also see is that on QT the "n" in the same "inc" is partly below the "X" in the line above. But that "X" should line up with the "i".
So it is not a monospaced font.

But SynEdit should have noted that using GetTextExtentPoint. And then using LCLIntf.ExtUTF8Out to specify the draw-width of each char.
So I can think of several scenarios.
Either GetTextExtentPoint or LCLIntf.ExtUTF8Out do not work.
Or the code gets a different font for measuring than it gets for actual drawing.


LCLIntf.ExtUTF8Out  can be tested by setting "Extra char spacing" to 1 (or any value other than 0)
« Last Edit: April 27, 2021, 10:48:00 pm by Martin_fr »

Lutz Mändle

  • Jr. Member
  • **
  • Posts: 60
Re: I can't change the code editor font in Linux... Anyone?...
« Reply #20 on: April 28, 2021, 01:57:38 am »
This problem belongs to this bug https://bugs.freepascal.org/view.php?id=36483.
In the bugreport a patch (https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/lcl/interfaces/qt5/qtobjects.pas?root=lazarus&r1=62604&r2=62603&pathrev=62604) is mentioned, which fixes the problem.

The problem can circumvented by unsetting the following environment variables:
KDE_FULL_SESSION
DESKTOP_SESSION
XDG_CURRENT_DESKTOP

My desktop link for starting Lazarus contains the following command line:
unset KDE_FULL_SESSION DESKTOP_SESSION XDG_CURRENT_DESKTOP;/usr/bin/startlazarus

This has the side effect, that theme settings for menu shortcuts, system dialogs, colours etc. are not applied.


 

TinyPortal © 2005-2018