However, since the syntax isn't integrated with font_manager (which of course would need matplotlib support), it seems like it would be extremely tedious to set properties for default fonts (axes/…) this way – is there a good solution for this?
Font selection in mpl is quite a mess (to be fair it's a complicated topic and what's already present is already a lot of work); see e.g. matplotlib/matplotlib#10249 for some issues and matplotlib/matplotlib#16203 for some work on it; I'm sure we could use more hands working on it :)
In other words: no, but contributions are welcome, and I think it should go to mpl rather than here (effectively the syntax here is just exploiting the fact that raw paths are completely bypassing the font selection system).
For a concrete proposal: in #10249 I propose to switch from fontconfig fontspec strings to CSS fontspec strings (after all FontProperties are already modeled based on CSS fonts). CSS also supports https://developer.mozilla.org/en-US/docs/Web/CSS/font-feature-settings so it may be possible to add them to FontProperties and then to fontspec strings.
I think there isn't anything to be done on mplcairo's side (well, at least until FontProperties get font-feature-settings support) and the work to be done can be tracked in matplotlib/matplotlib#16566 (comment).
Activity
dnadlinger commented on Feb 27, 2020
(I've just patched _util.cpp for now to set the features I want by default, as they are silently ignored for fonts that don't have them anyway.)
anntzer commented on Feb 27, 2020
Font selection in mpl is quite a mess (to be fair it's a complicated topic and what's already present is already a lot of work); see e.g. matplotlib/matplotlib#10249 for some issues and matplotlib/matplotlib#16203 for some work on it; I'm sure we could use more hands working on it :)
In other words: no, but contributions are welcome, and I think it should go to mpl rather than here (effectively the syntax here is just exploiting the fact that raw paths are completely bypassing the font selection system).
For a concrete proposal: in #10249 I propose to switch from fontconfig fontspec strings to CSS fontspec strings (after all FontProperties are already modeled based on CSS fonts). CSS also supports https://developer.mozilla.org/en-US/docs/Web/CSS/font-feature-settings so it may be possible to add them to FontProperties and then to fontspec strings.
anntzer commented on May 3, 2020
I think there isn't anything to be done on mplcairo's side (well, at least until FontProperties get font-feature-settings support) and the work to be done can be tracked in matplotlib/matplotlib#16566 (comment).