Xfce Forum

Sub domains
 

You are not logged in.

#1 2023-12-27 00:05:39

advice1010
Member
Registered: 2023-02-19
Posts: 65

Font sizes within gtk2 & qt programs

Okay, this one could get a little confusing, I probably should split into separate posts but they are all related, so I will just split into different replies instead.
I am trying to understand how changing font sizes can be achieved with specific applications within XFCE in a Debian based distro.  I have been able to get many things to work, but the results have been rather confusing.

In XFCE if you go into Appearance - Fonts you can set a global font size which applies to every font within XFCE.  Generally speaking, this applies to ALL applications as well: Debian packages, standalone (portable), Appimages, Flatpaks, etc.  Also does not seem to matter if gtk2, gtk3, qt all applications for the most part get fonts sizes changed with this setting.  So, that means that it is possible for one setting to effect ALL applications.

This global XFCE font setting is too broad for what I am looking for.  In a past post I asked about being able to change only specific font sizes, for specific programs and ToZ shared with me some incredible information (which I am still very thankful for) about how to achieve this.  This information was regarding editing the following file
$HOME/.config/gtk-3.0/gtk.css
Here is the link to that post if anyone is interested
https://forum.xfce.org/viewtopic.php?pid=73206#p73206

Here is where things get confusing because there are so many different application types, toolkits, versions, settings, etc. and combinations of all of them, hard for me to really generate all the different questions I am looking for answers for.

Offline

#2 2023-12-27 00:07:53

advice1010
Member
Registered: 2023-02-19
Posts: 65

Re: Font sizes within gtk2 & qt programs

Let's also narrow this down to increasing the font size of the “menu bar” in each program.

TESTING PROGRAMS
I will try to narrow this down with some program examples that I have used for my tests....
Thunar - Debian package (gtk based file manager)
Leafpad - Appimage (gtk based text editor)
Featherpad - Debian package (qt based texted editor)
Double Commander - Debian package (gtk2 based file manager)
Double Commander - Portable version (gtk2 based file manager)
Double Commander - Appimage (gtk2 based file manager)

TOOLKITS
The gtk.css file worked with Thunar, as far as I know this file does not support....
-gtk2 based applications
-qt based applications

APPLICATION FORMATS (gtk2, gtk3, qt)
also don't think this gtk.css file supports these applications types either
-Appimages
-Flatpak
-Portable versions

Last edited by advice1010 (2023-12-27 00:15:15)

Offline

#3 2023-12-27 00:10:47

advice1010
Member
Registered: 2023-02-19
Posts: 65

Re: Font sizes within gtk2 & qt programs

GTK2
It has also been mentioned that the gtk.css file is for gtk3 and for gtk2 based applications you have to CREATE the following text file in your “home” directory.

 $HOME/.gtkrc-2.0

Took me a while but I found the following code that when added to this above file, sets the global font size of gtk2 based applications.  Corbel is the font name / 24 is font size (I made huge so can see if working)

style "font"
{
font_name = "Corbel 24"
}
widget_class "*" style "font"
gtk-font-name = "Corbel 24"

When I saved this file, this oddly changed the fonts in only specific programs
All three Double Commander applications fonts changed, which makes sense gtk2 based.
However, Leafpad (gtk AI) and Featherpad (qt Deb) also had their fonts change, Featherpad was surprising because qt based.  Also tried QDPDFView which also qt based and its fonts were increased as well.
So this gtk2 file must be compatible with qt based applications?
As where the gtk3 gtk.css file is not.
Another thing that surprised me was that font sizes also changed in context menus within certain programs.

Great item to use for testing is Double Commander, because it is gtk2 based and offers Appimage & Portable versions.
Here is link to the Double Commander downloads if anyone is interested
https://sourceforge.net/p/doublecmd/wiki/Download/

Last edited by advice1010 (2023-12-27 00:16:54)

Offline

#4 2023-12-27 00:12:22

advice1010
Member
Registered: 2023-02-19
Posts: 65

Re: Font sizes within gtk2 & qt programs

QUESTIONS
1.)  Is there a way to change fonts sizes in specific programs for specific font items, using the gtk.css file,
for gtk2, qt versions of Debian packages, Appimages, Flatpaks, portable versions of applications?
Again for example just the “menu bar”.

2.) Same question as the first one, but with the .gtkrc-2.0 file instead?

3.)  Applied to question 1 & 2 above, is there a global setting for specific items fonts for all applications.
For example make all programs “menu bar” font a specific size.

4.) If cannot get this specific to being able to increase specific items fonts, is it possible to just be able to set the global font size within a specific application?  For gtk2 and qt based applications in the various application formats?

5.) My system has .config/gtk-2.0/gtkfilechooser.ini file as well, would editing this achieve anything I am looking for?

6.) Would anyone be willing to see if they can get only the “menu bar” font size to change in Double Commander Appimage & Portable versions?

Thank you to anyone who actually reads all of this and for any information offered

Last edited by advice1010 (2023-12-27 00:36:54)

Offline

#5 2023-12-27 02:13:49

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,056

Re: Font sizes within gtk2 & qt programs


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#6 2023-12-27 16:59:20

advice1010
Member
Registered: 2023-02-19
Posts: 65

Re: Font sizes within gtk2 & qt programs

@ToZ
Thank you for your response.
Ahh not really, this seems to be only for Flatpak, unless I am incorrect?
This post was mainly looking for solutions for gtk2 applications / Debian package / Appimages / portable versions.
(I know I mentioned Flatpak, will eventually be part of this, but not as important at the moment)

If anyone else has any ideas please let me know

Offline

#7 2023-12-27 19:23:26

eriefisher
Member
From: ON, Canada
Registered: 2008-10-25
Posts: 415

Re: Font sizes within gtk2 & qt programs

Wasting time and energy on gtk2 applications is futile. Gtk2 is no longer developed as far as I know and will soon be forgotten to time. Applications based on GTK2 won't be far behind if they don't upgrade to a minimum of Gtk3. Gtk4 is what is now being used for modern coding.


Siduction
Debian Sid
Xfce 4.18

Offline

#8 2024-01-11 21:22:43

advice1010
Member
Registered: 2023-02-19
Posts: 65

Re: Font sizes within gtk2 & qt programs

Thank you guys for the responses.
I understand that using gtk2 programs is probably not a good idea, just that sometimes great projects don't decide to make this update.
Linux seems to have many things that challenge the continued use of applications (dependencies, tool kits, etc.).
If most projects are being developed by small groups of volunteers who already complain about not having time / resources, seems strange to have something like a toolkit / how things look, be something that could completely stop a program from working.

Forgot, but someone mentioned that GIMP was still gtk2, which is a bigger project than most.  I think I read that the 2.99 version is gtk3? but not sure, but it is said that the newer version GIMP 3.0 will be when it eventually comes out.  I mentioned that this might be why gtk2 is still supported for now, even though it has already reached EOL.

GTK2
Okay someone elsewhere gave me enough to figure out how to achieve this, can be done by using "environmental variables" and modifying the programs command to link to file containing them.  If I have time I will try to post some more info about this because don't see it online really, although maybe no one is interested any longer.
The gtk2 program I am using, luckily in this case also has a qt5 version.
I like the gtk2 version better because it loads faster in XFCE (gtk) but agree that might not have a choice at some point so now starting to get ready to change over to it.  I am finally able to achieve this font size changing in gtk the exact way I want, only to be back where I started in a different toolkit.

QT5
Okay, does anyone know how to change specific items font sizes in specific programs?
Meaning how to change just the menu bar or tab font size in a specific qt based program?
gtk has the ability to do this in gtk2 & gtk3 (& would imagine also in gtk4)
it does not appear that QT5 has this?
All I have seen are people mentioning "SCALING" & "DPI" settings?
Does anyone know if qt5 has anything like mentioned above in gtk2 & 3?
Are there environmental variables that can be used in qt? or other methods to achieve this?
If so where would these even be added to?

Am I missing something, why would doing something as seemingly simple as changing font sizes have no information on how to achieve this?
GTK2 was difficult to find anything about which is somewhat understandable I guess, but even qt5 which is still supported I can't seem to find anything about this / or don't understand what I am looking at when searching.
The SCALING / DPI items sound as if apply to all fonts in a program.
I really like how this can be achieved in gtk2/gtk3 with specific items by just typing in font size number desired.

Don't want to make this any more complicated but still cannot seem to find anything about how to achieve this in container based formats such as Appimages for gtk or qt based applications if anyone knows anything about this either?

Thank You for any information offered

Last edited by advice1010 (2024-01-11 21:39:10)

Offline

#9 2024-01-11 21:48:10

eriefisher
Member
From: ON, Canada
Registered: 2008-10-25
Posts: 415

Re: Font sizes within gtk2 & qt programs

There are packages to help with themes in mixed environments GTK2/GTK3 and QT mix in Debian they are called:

qt5-gtk-platformtheme
qt5-gtk2-platformtheme

Not sure of the naming scheme for other distros but should be available either way. Check the man pages for them as well as they need some variables set up for them to work.


Siduction
Debian Sid
Xfce 4.18

Offline

#10 2024-01-14 21:29:32

advice1010
Member
Registered: 2023-02-19
Posts: 65

Re: Font sizes within gtk2 & qt programs

Still confused so going to just post some random things below

Thank you for your response.
I have actually come across these two packages before, when I was looking into how to achieve this.
I already had them installed by default.
I will admit I don't know much about them.

When I came across the "qt5-gtk2-platformtheme" packages description, I was assuming that is the one that was causing qt applications fonts to change when I was editing the .gtkrc2.0 file.

Speaking of this
Another thing I have mentioned that really is confusing me is how some of these global font size items have the ablility to change the font sizes in all toolkits and all application formats.
Like XFCE appearance - fonts
If this has the ability to change all fonts, then why isn't there a way to change specific items fonts for all toolkits / application formats all in one tool, using the same method for each?
Same thing happens with the .gtkrc2.0 file as mentioned above, this has the ability to change globally one font size for all fonts in all gtk2 & qt based applications.
Yet if you try to use the .gtkrc2.0 file to change specific items fonts in a qt application, it does not work.
I know they are not designed to do so, but then why is it possible with global all font settings.

I have come across qt5ct, I have not used yet but this also only provides a single global font setting that applies to all fonts in all programs.

Is there a way to get qt applications in XFCE to be able to change fonts for specific items within specific programs?  I have not found a similar approach such as widgets / environment variables to achieve this yet?  I have seen that it does have widgets, but have not seen how to change fonts, and even if I find the widgets I am not sure where I put them?  Is there a specific text file to put them in like how gtk has gtk.css and gtkrc2.0 files.

CONTAINER APPLICATION FORMATS
Something I recently discovered is that editing the .gtkrc2.0 adding widgets environment variables is that gtk2 based Appimages work with this, the font sizes change in them.  Have not tried any Flatpaks, although GIMP might be a one gtk2 based Flatpak available to try.
Still do not see a way to achieve this in Gtk3 gtk.css for Appimages.
And as mentioned have not been able to achieve in any qt applications no matter what program format.

If anyone has any info to share, let me know.

Thank You

Last edited by advice1010 (2024-01-14 21:44:09)

Offline

Board footer

Powered by FluxBB