8000 Set OpenType features for default plot font · Issue #22 · matplotlib/mplcairo · GitHub
[go: up one dir, main page]

Skip to content

Set OpenType features for default plot font #22

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 8000 .

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

Closed
dnadlinger opened this issue Feb 27, 2020 · 3 comments
Closed

Set OpenType features for default plot font #22

dnadlinger opened this issue Feb 27, 2020 · 3 comments

Comments

@dnadlinger
Copy link
Contributor

I've just tried out the new OpenType feature support, appears to work nicely on

{'python': '3.7.6 (default, Dec 30 2019, 19:38:28) \n[Clang 11.0.0 (clang-1100.0.33.16)]', 'mplcairo': '0.2.post33+g4b14de1.d20200227', 'matplotlib': '3.1.1', 'cairo': '1.16.0', 'freetype': '2.10.1', 'pybind11': '2.3.0', 'raqm': '0.7.0'}

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?

@dnadlinger
Copy link
Contributor Author

(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
Copy link
Collaborator
anntzer commented 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
Copy link
Collaborator
anntzer commented 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).

@anntzer anntzer closed this as completed May 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0