Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot change symbol or message fonts #2069

Open
tempest766 opened this issue Jan 28, 2019 · 18 comments
Open

cannot change symbol or message fonts #2069

tempest766 opened this issue Jan 28, 2019 · 18 comments

Comments

@tempest766
Copy link

Edit/Preferences/Interface/Fonts dialog:

Editor font is the only one that is honored. Even though smaller fonts are selected for symbol List and Message Window, they still display 18pt fonts, instead of 14pt. Editor font is only one that works as expected.

Fedora 28
Geany 1.34.1

@tempest766
Copy link
Author

geany

@tempest766
Copy link
Author

geany

@elextr
Copy link
Member

elextr commented Jan 28, 2019

WFM, always post the GTK version Geany is using (top few lines of tools->debug messages)

@elextr elextr added the can't reproduce A developer couldn't reproduce the issue label Jan 28, 2019
@tempest766
Copy link
Author

GTK 3.22.30, GLib 2.56.4

@b4n
Copy link
Member

b4n commented Jan 28, 2019

Hum, that's odd, WFM with GTK 3.22.11 on Debian stable. I'll try to check with 3.24 on Unstable tomorrow.

@tempest766
Copy link
Author

Verified that the fonts are correct in geany.conf and that changing the VTE font works.. So, edit and VTE fonts work, but not status/scribble nor symbols side panel.

@elextr
Copy link
Member

elextr commented Jan 28, 2019

Well, side panel, and status scribble are straight GTK widgets, maybe that specific version of GTK is broken with those fonts.

monospace and sans are aliases for some actual font, so what is the actual font being used?

@b4n
Copy link
Member

b4n commented Jan 29, 2019

@tempest766 Could you try also changing GTK theme? Might this be the new Adwaita one? In any case, maybe a theme that would define a font very specifically for notebook tabs or so might go in the way.

@elextr
Copy link
Member

elextr commented Jan 29, 2019

@b4n even if a theme defines a default font for a text item, surely even the Gnomists are not arrogant enough to make it prevent the application changing its own font? Or are they .... hmmmm

@b4n
Copy link
Member

b4n commented Jan 29, 2019

Tested with 3.24.4 under Debian Unstable and it works fine as well.

@elextr yeah well, I guess it depends on how we do it, and which API GTK broke…

@tempest766
Copy link
Author

tempest766 commented Jan 29, 2019

I run multiple displays with differing DPIs so I had to find a common denominator that would pass on both monitors. I have a ~/.config/gtk-3.0/gtk.css in a config directory that looks like:

* { font-size: 16px; font-family: DejaVu-Sans; }

but in this case the precedence is wrong. I'd expect that fonts selected in an application should override the default. Removed the css file and geany uses the correct fonts again. I don't do anything specifically with themes, and try to avoid generally try to avoid gtk whne possible. So, if it is setting a theme implicitly then I'm not even sure how to change it.

@b4n
Copy link
Member

b4n commented Jan 29, 2019

OK so that's the reason, the way we apply the font must be incompatible with this. I'll check if there's something easy we can do for this not to be a problem (probably having something of the same style on our side would do, but it might be tiresome to build dynamically).

@elextr elextr added bug gtk-theme and removed can't reproduce A developer couldn't reproduce the issue labels Apr 6, 2019
@lpaulsen93
Copy link
Contributor

I have read the documentation of gtk_widget_modify_font() which is used in ui_widget_modify_font_from_string(). The function is deprecated and the gtk documentation suggest to use gtk_widget_override_font(). But that also has a deprecation remark:

gtk_widget_override_font has been deprecated since version 3.16 and should not be used in newly-written code.

This function is not useful in the context of CSS-based rendering. If you wish to change the font a widget uses to render its text you should use a custom CSS style, through an application-specific GtkStyleProvider and a CSS style class.

So I assume as soon as there is a CSS file we would need to apply a CSS style generated from the preferences settings to let the changes have any effect in this case (not tested - unconfirmed).

@elextr
Copy link
Member

elextr commented Jul 22, 2019

@LarsGit223 deprecation shouldn't mean it doesn't work, unless GTK have forgotten their promise to not break stuff until the NEXT release.

@lpaulsen93
Copy link
Contributor

@elextr: I agree, but the sentence "This function is not useful in the context of CSS-based rendering." sounds critical to me. If I find the time I will do some tests with applying a CSS style instaed of calling gtk_widget_modify_font().

@b4n
Copy link
Member

b4n commented Jul 22, 2019

@LarsGit223 The thing is that ~/.config/gtk-3.0/gtk.css has the highest priority possible -- user priority. It's actually pretty much the right thing to do to let this win.
In our specific case where it's a user setting, it could be arguable that we should give it user priority, and then it might work, although I'm not confident our dynamic style would overwrite anything in ~/.config/gtk-3.0/gtk.css, unless we give it higher priority, which we probably shouldn't as it wouldn't be semantic.

All in all, I'm not even sure the behavior described in this report is wrong. After all, the user selected a specific font in a place meant to override everything, so why would we fight it? If the user really wants something else, it's totally possible to have the right piece of CSS in ~/.config/gtk-3.0/gtk.css to do so, likely something like this:

#GeanyMainWindow paned>paned:first-child>notebook:first-child scrolledwindow:first-child>treeview { font: sans 12; }
#GeanyMainWindow paned>notebook:last-child scrolledwindow>treeview { font: monospace 14; }

We could possibly make this easier by giving a CSS ID to the symbols pane's treeview if really needed, but again the only case it matters is when this gets overridden manually.

In the end, yes, providing a custom GtkCssProvider might work, but the priority might have to be > to GTK_STYLE_PRIORITY_USER, which doesn't necessarily seem like a good idea. And I'm not sure it's worth the trouble going through all this just for a corner case that already has a workaround.

@elextr
Copy link
Member

elextr commented Jul 22, 2019

@b4n I suppose that if the user has the css file then yeah, its reasonable to assume they intended it and know how to put Geany specific overrides in that.

But its confusing if the GUI selection works if there is no user GTK override and not in other cases.

Perhaps the GUI selection should be removed from Geany, after all we shouldn't actually make it easy for users to override the all powerful Gnome theme using a GUI, but should tell them to go create an arcane CSS like text file in their ~/.config.

@codebrainz
Copy link
Member

unless we give it higher priority, which we probably shouldn't as it wouldn't be semantic.

Depends how you look at it, it's not like it's just Geany trying to force application default styles on a user, rather it's providing the USER a GUI to OVERRIDE the theme font, so priority higher than 800 might make some sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants