Attention profile owners! #4490
Replies: 4 comments 4 replies
-
Or (c) sometimes we just use them as utility functions! fontbakery/Lib/fontbakery/profiles/googlefonts.py Lines 1074 to 1077 in 0b9860f Like I said, it's a mess. |
Beta Was this translation helpful? Give feedback.
-
What would a file with checks and conditions look like? Or do you have to work that out still? |
Beta Was this translation helpful? Give feedback.
-
That would look pretty much the same. The only (cosmetic) difference is that instead of from fontbakery.callable import check, condition
from fontbakery.status import FAIL, PASS, WARN
from fontbakery.message import Message you now do from fontbakery.prelude import check, condition, FAIL, PASS, WARN, Message |
Beta Was this translation helpful? Give feedback.
-
In my model of Font Bakery, a check is conceptually a function not a method. That differentiation matters here, as a (pure) function when called with the same arguments produces the same result each time, but a method changes result based on the state of its instance. As a check override changes the function result, when called with the same arguments, it is in fact a different function. |
Beta Was this translation helpful? Give feedback.
-
Hello @guidoferreyra @miguelsousa @josh-hadley @ollimeier and probably others I have not thought of...
I am currently working through a set of refactors to make the core of fontbakery simpler and more maintainable. (The number of people who understand and want to touch
checkrunner.py
orprofile.py
is vanishingly small.) As part of that, I am proposing/planning/working on a major refactor to the way that profiles are structured. Currently we have:It all works, but it's a bit clunky and in some cases cargo-cult - we end up copying and pasting bits from other people's profiles to make it all work.
What I'm proposing is:
After the refactoring, the
fontwerk.py
profile now looks like this:(With fontwerk-specific check definitions moved into
fontbakery/checks/fontwerk.py
.) Overriden results will look like this:I know this is a substantial change but I hope it will make it easier for you to maintain your profiles as well.
I am also planning a later change to the way that "conditions" operate. These are currently a mix of two things: (a) a way to determine whether or not to skip a check, and (b) a function run on the font being tested with its result cached and injected into the check function as an argument. I am hoping to get rid of the second usage, because it's extremely non-obvious ("Whoa, how did that variable come from and why does it have the same name as a function?") and complicates the implementation. I haven't quite worked out what the replacement will be, but this is another heads up that there will (hopefully) be a lot of code movement in the way that checks are defined.
I'd welcome any questions, comments, requests, etc.
Beta Was this translation helpful? Give feedback.
All reactions