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

WIP: Fonts #3473

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

WIP: Fonts #3473

wants to merge 2 commits into from

Conversation

gustaphe
Copy link
Collaborator

@gustaphe gustaphe commented May 4, 2021

I started fiddling with a redefinition of the fonts system (as discussed in #3463)

It's currently in a state where it compiles and plots, but I've only done just enough adjustment in the gr backend to get it in "working" order. But I think it illustrates the idea.

Maybe the gains aren't that big, and there's probably quite a bit of work left, but the shortening of the attribute list feels pretty good.

plot(randn(10); font=(:green, 45.0))

image

@isentropic
Copy link
Member

Perhaps I'm a little late to this discussion, but what are the clear advantages of separating font attrs into a new named tuple therefore breaking a lot of existing recipes (perhaps most of them)? This is a massive breaking change, but what are the clear advantages here?

Additionally, this has to be implemented for all backends or else other backends would just stop working

@gustaphe
Copy link
Collaborator Author

gustaphe commented May 6, 2021

Not at all, it's an infant idea, but I wanted to see what it would look like.

Advantages I see:

  • Shortening attribute list -- each text object currently has 6 attributes by a specific pattern (unless control of any of them is missing): *family, *pointsize, *rotation, *color, *halign and *valign. All of these attributes are already encapsulated in the Font type
  • Guaranteed uniformity -- those text objects that currently are missing certain controls won't, and any text objects added through a scheme like this won't either
  • Clarifying and simplifying font dependencies -- instead of specifying where xguidefontfamily, xguidefontsize... are inherited from separately, one simply specifies that guidefont is font, but with a specific pointsize, etc.

That said, it is a breaking change, and quite a bit of details to implement. It might be possible to implement it in a non-breaking fashion, where font=(45.0, "Computer Modern") is a convenience for fontrotation=45.0, fontfamily="Computer Modern", or vice versa.

@BeastyBlacksmith
Copy link
Member

You may also look at #2854 where I wrote a macro to traverse into any Plot specific types (including Font) and creating the attributes automatically (incl. aliases).
I think it could also work non-breaking if we can make sure, that aliases work for all kinds of recipes.

@BeastyBlacksmith BeastyBlacksmith marked this pull request as draft May 18, 2021 19:23
@t-bltg t-bltg added the WIP Work in progress, do not merge! label Jul 6, 2021
@BeastyBlacksmith BeastyBlacksmith added this to the v2.0 milestone Jul 7, 2021
@t-bltg t-bltg added the 2.0 label Sep 15, 2021
@t-bltg t-bltg added the fonts label Nov 27, 2022
@t-bltg t-bltg mentioned this pull request Nov 28, 2022
19 tasks
@isentropic isentropic mentioned this pull request Jan 12, 2024
37 tasks
@BeastyBlacksmith BeastyBlacksmith mentioned this pull request Mar 12, 2024
30 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.0 fonts WIP Work in progress, do not merge!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants