To reproduce: 1. Open preferences. 2. Un-tick "Use system monospace font". 3. Click the font selector below. 4. Set the font size to something very big. 5. Close font selector. 6. Tick "Use system monospace font". Expected result: Mousepad should use the system monospace font and size. Actual result: Mousepad uses the custom font size instead. User cannot change it because the font selector is ghosted when the system monospace font is selected.
Surprisingly I can't reproduce this bug on Mousepad 0.4.0(Antergos).
I can confirm this is reproducible using the steps from Alistair and also the following steps on Mousepad 0.4.1: 1. Open "Edit" / "Preferences" 2. Uncheck "Use system monospace font" 3. Close 4. Open "View" / "Select font..." 5. Select a different font size (also possibly a different font family) 6. Open "Edit" / "Preferences" 7. Check "Use system monospace font" Expected and actual results are identical to Alistair's original report for Mousepad 0.4.0.
A quick look at the code (and a small test to confirm) shows that "use system monospace font" is actually a hardcoded font and not really the system's font. This is a really quick fix if we want to stay with a hardcoded font and size. But, is this the right behaviour?
Well, another check shows it uses the regular system font. Sorry for the mistake earlier. I compared it to the monospace font and not the regular one (because that what the text says in the preferences).
Created attachment 7896 Patch for mousepad default system font Please take a look at the patch. It sets the hardcoded font size to 11 (if for some reason the is a problem finding the system's font). But, it also uses the system's default monospace font correctly.
Created attachment 7897 And don't forget to free resources...
Looks good to me, it makes sense to read the property set by the Appearance dialog. @Matthew, this patch introduces the dependency on xfconf, what do you think? Make it opt-out?
Anna Arad referenced this bugreport in commit 30d3b6029995ce9ee1bb05d003ca2358471add6d Read system font from xfconf property (Bug #12485) https://git.xfce.org/apps/mousepad/commit?id=30d3b6029995ce9ee1bb05d003ca2358471add6d
I asked Matthew on #xfce-dev, at first he would like to avoid this new dependency, but agreed to push the patch, if this dependency causes any trouble, we can always make it optional. @Anna, I made you as the author of the commit and changed the default font size to 10, since this is the value to which MonospaceFontName defaults on reset. Thanks you!
Thanks @Anna and @Andre. If the dependency causes anybody issues, we could add compile-time checking for the dependency and guard out the affected code with #ifdefs.
I reported a bug over in Ubuntu regarding monospace fonts which is related to this: https://bugs.launchpad.net/ubuntu/+source/terminator/+bug/1769774 tl;dr most of Xfce actually doesn't follow the xfconf setting and there is no cross desktop way to specify a default monospace font. Nearly all software (including most Xfce apps) either looks directly at the GNOME gsettings key or doesn't support the concept of a system default at all.
At least it will work as promised/expected in Xfce, but I agree such option is awkward. Unless there is a fd.o standard for that, I don't think it's worth to worry about cross-desktop support.