I use arch with xfce4. After last update of geany-git (git >= 1b06889fe) I have blurry text inside editor. Only in editor, fonts in menu/settings are good. Check out font view from editor settings and inside editor. ![geany_screen1](https://github.com/geany/geany/assets/4203047/5e89778c-c364-4e8a-a674-f16be1...) Can I change hintstyle/antialias with custom font settings at the start? Is it geany or purely GTK issue? removing `.config/geany` didn't change anything.
Can you bisect the exact commit where you started getting the blurry text? (I don't see anything too bad myself.)
You need to find out what font is "Monospace Regular", that name is an alias for another font, not a font itself. Without knowing the actual font we have no way of replicating the problem as @techee said.
Here it looks as identical as my olde eyes can tell no matter how far I zoom.
![Screenshot from 2023-10-18 10-56-11](https://github.com/geany/geany/assets/811085/cb435c89-8293-4e3e-86d6-962179f...)
That looks like Gtk2 vs Gtk3 difference
Geany / Gtk2 ![geany-gtk2](https://github.com/geany/geany/assets/15620168/85ce8d60-5d55-40af-ba27-5fcde...)
Geany / Gtk3 ![geany-gtk3](https://github.com/geany/geany/assets/15620168/186a4a91-2228-4a85-8a23-12963...)
Comparing GTK2 and GTK3 was not your initial issue.
Possibilities:
1. GTK2 and GTK3 do not render the same, quite likely, they are different and likely have different versions of Pango and harfbuzz the two libraries that actually convert font info to pixels. 2. The fonts are not the same, or not the same version with the same hints 3. The Scintilla rendering has changed in the versions between Geany for GTK2 (limited to Scintilla 3.5) and current git GTK3 (Scintilla 5.3.7)
As we don't have access to your system you will have to do the research, 1. and 2. you will need to check dependency versions for the libraries mentioned and versions of the fonts.
To see if there have been any changes in Scintilla operation you can check its changelog on its website.
Quite frankly the GTK3 looks right, having aliasing only on one side of the verticals as the GTK2 shows is "unusual".
Thanks everyone for the detailed answers! I just tested geany 1.38 (2022-05-01) from the official arch repo. The font there looks "sharp" as I wanted. It uses GTK+ v3.24.38, the same one I used building latest commit version from source. I tested geany with gtk2 too, font is sharp. I have to do some research and find out on which commit it starts blurry. It will take some time then I will write the results here.
I didn't understand the issue completely yet but anyway maybe it's worth to try SciTE (https://archlinux.org/packages/extra/x86_64/scite/) to check whether it has the same problem. If so, it is very likely related to Scintilla. If not, it may or may not be related to Scintilla.
@poluyan when you are bisecting, maybe check with a commit *before* 19336d22946b77bbcb5131544ea0e6317cdcf6b5, this was the latest Scintilla update.
Try the merges that change Scintilla versions first.
Heh, overlapping comments
Great minds think alike :-)
Possibly https://sourceforge.net/p/scintilla/code/ci/c692633b18bff53ea43e0f0a81cf56b6... which was to fix https://sourceforge.net/p/scintilla/bugs/2310/.
Thanks Neil, that could explain the difference between GTK2 (Scintilla 3.5) Geany and GTK3 current git (Scintilla 5.3.7) Geany.
As I said above, the images posted by the OP show the current aliasing to be more correct than the GTK2 version which never seems to alias both sides of the verticals.
The OP has not identified the font used, I compared my system Monospace (DejaVu sans mono) and Hack and the aliasing does change between them, with Hack having less, maybe slightly different character positioning in the glyph space, differing hinting?
@poluyan Aliasing is always going to have the chance of looking fuzzy on some resolutions with some fonts, so not sure what we can say except try different fonts to find one that suits your eyes (like the one on Arch you found).
@eht16 Thank you, I have checked, this is exactly the place where font starts to be blurry. I tried SciTE with `scite "-font.base=font:Monospace Regular,size:12"` and compared Geany, SciTE, Gedit. ![geany22](https://github.com/geany/geany/assets/4203047/1619e246-41f9-4fbc-a403-5642f5...) Just for my eyes the `I` character in SciTE looks awful. @elextr, @nyamatongwe thank you for explanations! I have to play with some fonts, maybe found good one for Geany.
Thanks for the quick replies. This issue can be closed.
@poluyan just to remind you, "Monospace" is not a font, it is an alias for one. Use `fc-match monospace` to find out which one so you can avoid it.
Closed #3610 as completed.
[elextr](https://github.com/elextr) closed this as [completed](https://github.com/geany/geany/issues?q=is%3Aissue+is%3Aclosed+archived%3Afa...) [9 hours ago](https://github.com/geany/geany/issues/3610#event-10700778434)
Is it fixed though and is this a problem of the used font? I'm not really familiar with pango and what exact implications the commit Neil mentioned had in Scintilla but it appears it triggered this problem.
it triggered this problem
IIUC it "triggered" the problem by doing it (more) correctly :-)
In reality there will always be cases where the screen resolution being used and the way the font places characters and the way floating point calculations round to integer pixels and colours can result in text appearing "fuzzy" to a viewer.
That is actually its point of course, to "simulate" fractional pixels by shading adjacent ones and hope the viewers eyes will average it. But some viewers on some screens will see it differently. As it involves individual visual response its not an exact science, so it can never be "fixed" for everyone. So the best advice is to try a different font. Its not that one or the other font is "wrong" just that they generate differing visuals, and again, thats what fonts are for, if they were identical there would be no point in having more than one.
@elextr what you're describing is hinting ;) The trade-off between faithful glyph shape rendering versus blurry render because pixels are big.
And I agree that better hinting is better, but it's tricky. I admittedly got used to bad one because some upgrade lead to poorer hinting everywhere on my system and it's not bad enough that I spend a whole lot of time on it, but still, I'd rather have it sharp and slightly off-shape than perfectly shaped and blurry.
Yeah, hinting is the info in the font file that tells how to calculate the antialiasing.
New addition to Geany license, users may only use Geany if they sit far enough from their screen that they can't see the pixels :grin:
If anyone is sufficiently motivated to write a sensible patch, there could be an option to choose position rounding on/off. Probably added as a bit flag to [SCI_SETFONTQUALITY](https://www.scintilla.org/ScintillaDoc.html#SCI_SETFONTQUALITY).
@nyamatongwe can you please be more specific? I've tried to modify patch you mentioned above. I commented macros lines in `SetFractionalPositions` but it didn't give any affect.
There is actually more. I just now noticed that at my system Scintilla do antialiasing for same characters differently (for mono fonts). That's probably why I was annoyed with the font look. Here's comparison of geany (above) with gedit (below) with DejaVu Sans Mono and JetBrains Mono Regular. For `I` or `l` in case of Scintilla there are different "types" of antialiasing with different colors. With gedit (GtkSourceView) there is only one type of antialiasing for each character with same colors. ![gg3](https://github.com/geany/geany/assets/4203047/a8ac7301-27e0-46f9-b027-f62a38...) I expect the same characters to be displayed the same way.
Now I'm using terminus bold font and quite satisfied with it. However it is a bit "lazy" solution because there is no antialiasing involved at all. 😁
If removing the call or replacing it with ~~~ pango_context_set_round_glyph_positions(pcontext, TRUE); ~~~ doesn't change the appearance then this is a different issue. Your system may have different defaults.
Here's an image from my system with both choices. ![SetFractional](https://github.com/geany/geany/assets/225818/c9a34cf9-fba3-4bb2-9c67-de2f40e...)
The width of 'I' in DejaVu Sans Mono,size:12 changes from 9.632812 pixels to 10.0 pixels with `FALSE/TRUE` values for `pango_context_set_round_glyph_positions` on Ubuntu 23.10.
I expect the same characters to be displayed the same way.
Drawing is performed using a floating-point coordinate space over an visual with distinct (integral) pixels. Drawing 'I' at (0,0) will colour pixels differently then drawing 'I' at (9.632812, 0).
Oh, it have to be set to `TRUE`!! I did it and the issue was solved. Now if I'm zooming in/out using scroll all the characters is perfectly sharp at any scale as it was before Scintilla update. Thank you @nyamatongwe for providing the solution, explanation and for your time! geany community is the best! 😁
For those facing a problem in the future: in file scintilla/gtk/PlatGTK.cxx SetFractionalPositions I removed macros guard and change boolean calling argument. Just run the following commands below before building geany (e.g. for geany-git in arch I did it in prepare function in PKGBUILD).
``` awk '/void SetFractionalPositions/,/}/ {if ($0 !~ /#/) gsub("FALSE", "TRUE"); print; next; } 1' scintilla/gtk/PlatGTK.cxx > temp_file mv temp_file scintilla/gtk/PlatGTK.cxx ```
github-comments@lists.geany.org