I can't change the code editor font in Linux... Anyone?... lazarus / 9-Editor ---------------------------------------------------------------------- Hoch · 2020-01-26 11:54 Hi, When I change the code editor font, the font picker displays the font correctly but Lazarus uses always the same one, no matter which font I choose. The only thing that changes is the size and spacing. Check the appended screenshots. You can see that the font I choose is not displayed correctly in the preview of the prefs dialog and in the code editor. And the font spacing is weird. It's very uncomfortable to work with this font spacing. Things I've done: . Tried all the monospace fonts . Uninstalled Lazarus and installed again, renaming the /home/user_name/.lazarus folder to force a clean one. . Downgraded linux kernel from 5.4 to 5.3 . Checked font permissions in /usr/share/fonts/ . Upgraded Lazarus 2.0.6 to the last one offered by pacman (25/12/2019) Nothing works. The font picker detects the fonts right. And other apps see and use the fonts correctly. Clearly there is an issue with Lazarus. System was Manjaro with 5.4 kernel, downgraded to 5.3. Lazarus version is 2.0.6. (25/12/2019) Any clues of where to look to fix this?... Thank you in advance! ---------------------------------------------------------------------- nomorelogic · 2021-04-09 09:44 this topik is old but I've same problem fonts are weird and there's no way to view a font like in other application I'm on voidlinux, xfce4 any help is appreciated thanks Edit: tried all monospaced fonts but none of them looks normal ---------------------------------------------------------------------- nomorelogic · 2021-04-12 06:54 just to show what "weird" means, I attach a screenshot This malfunction appeared recently, not with a fresh Lazarus install. ---------------------------------------------------------------------- Ñuño_Martínez · 2021-04-12 09:48 Seems to be a problem with the font itself.  Maybe the font file isn't fully compatible or it is old or something. ---------------------------------------------------------------------- nomorelogic · 2021-04-12 10:02 when installed Lazarus 1st time, display editor was really perfect after some days, changing font in display option, this probelm appear ---------------------------------------------------------------------- nomorelogic · 2021-04-12 10:52 I tried removing Lazarus and reinstalling it: nothing changhes ---------------------------------------------------------------------- lucamar · 2021-04-12 14:45 Does it happens only with this font or with any monospaced font you select? I'd tend to agree with Ñuño that it looks like a problem with the font itself: either it's not correctly formed or it isn't marked as "monospace". SynEdit wants a monospaced font and when you apply a non-monospaced one the result resembles your image: the space after the shorter characters (i, l, ...) is excesive while the wider ones (m, w, ...) might even be cut-out, all as your image seems to indicate. ---------------------------------------------------------------------- Martin_fr · 2021-04-12 15:16 The "weird look" is a 2ndary issue. Forget the spacing for a moment. You say the font does not change, no matter what you select. That means, if you change between fonts, that draw a line in the "0" (zero), or do just an oval (like the letter O) for a zero, you would always get the same "0". Same you do a serif vs a none serif. The form, thickness, details of each char on it own do never change? Now, if that is true, then there is an issue with font selection. And apparently you end up with a none monospaced font. And that gets the spacing weirdness. None monospaced fonts The Editor displays all text according to mono spaced rules. That is like in a grid. An "i" and a "W" must have the same widths. If not the editor adjusts the widths, by padding or squeezing. => Weird look. ---------------------------------------------------------------------- nomorelogic · 2021-04-12 17:31 just to be more precise I can attach 3 monospace fonts I included a line of "O" letter and 0 (zero) ---------------------------------------------------------------------- winni · 2021-04-12 18:16 Hi! Looking at the 3 Font examples: * Theses Fonts are not monospaced fonts * In all 3 screenshots it is always the same font To check this confusion let's take first step: look in your lazarus directory in the editoroptions.xml In the 4th line there should be something  like Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Do you find a correct fontname in this line? Winni ---------------------------------------------------------------------- Martin_fr · 2021-04-12 18:47 Just noted, the OP Hoch, has not posted/replied further to the topic. Maybe they solved it. ---------------------------------------------------------------------- nomorelogic · 2021-04-13 06:37 this is the 4th line of $HOME/.lazarus/editoroptions.xml 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   Using fpcupdeluxe I installed on the same system another lazarus (laz stable / fpc stable). Using the new install, fonts are perfect (see attachment). In this case the 4th line of .../lazstable/config_lazarus/editoroptions.xml is the same of previous "weird" installation: 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   Thus I have 2 lazarus (same version) on my system, so it's not a font issue. Edit: @winni it seems that it doesn’t matter the font I select, at the end the editor is used almost always the same in editoroptions.xml is reported the one I selected ---------------------------------------------------------------------- C#R# · 2021-04-26 15:12 Hi, I have the same problem, the characters overlaps the own space. But, I have the problem only on qt5 interface When the ide is compiled on gtk2, the problem disappear ---------------------------------------------------------------------- Martin_fr · 2021-04-27 12:51 Quote from: C#R# on April 26, 2021, 05:12:51 pmI have the same problem, the characters overlaps the own space. But, I have the problem only on qt5 interface When the ide is compiled on gtk2, the problem disappear Same origin, but different effect. If you look closely for the OT every char is squashed to the next. In your image chars are cut off at certain intervals (whenever the highlight color changes). If you select chars in a line, and extend the selection char by char, you will see the other chars moving. The problem is still the font. It does not stick to the width it should. Though in your case SynEdit believes that it is monospaced. Therefore SynEdit outputs the text without correcting the width. It prints the text in the current highlight. When the hl changes SynEdit calculates where the previous text should have ended, and continues there. But in your case the previous text did not end at the correct location. I have no idea why the fort info on gtk/qt on your platforms goes wrong. I suggest to report this as bug. (against the LCL widgetset for qt/gtk) ---------------------------------------------------------------------- winni · 2021-04-27 14:41 Hi! AFAIK synedit only acceps monospaced fonts. The bug is, that the IDE allows also proportional fonts. Winni PS.: Wikipedia has a (small) list of monospaced  fonts. Liberation mono and many others missing https://en.wikipedia.org/wiki/List_of_monospaced_typefaces ---------------------------------------------------------------------- Martin_fr · 2021-04-27 15:28 Quote from: winni on April 27, 2021, 04:41:37 pmAFAIK 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 · 2021-04-27 16:26 Quote from: Martin_fr on April 27, 2021, 05:28:13 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 · 2021-04-27 17:17 Quote from: winni on April 27, 2021, 06:26:44 pmLooking at proportional fonts with a monospaced distance is unreadable, makes headache and should be prohibited by the IDE QuoteThe 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# · 2021-04-27 19:34 Hi Martin, I think isn't a font problem, look this images, one is gtk2 and other is qt5(with fail). Thanks ! ---------------------------------------------------------------------- Martin_fr · 2021-04-27 20:45 Quote from: C#R# on February 18, 1975, 12:33:29 pmI 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) ---------------------------------------------------------------------- Lutz Mändle · 2021-04-27 23:57 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.cg i/trunk/lcl/interfaces/qt5/qtobjects.pas?root=lazarus&r1=62604&r2=6260 3&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. ---------------------------------------------------------------------- C#R# · 2021-09-21 19:45 https://gitlab.com/freepascal.org/lazarus/lazarus/- /commit/d2aee554cb335ebabc21387bd6c1bb8bbe3004b0