-
Notifications
You must be signed in to change notification settings - Fork 105
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
Glyph outline checks #3088
Glyph outline checks #3088
Conversation
* Alignment against baseline/x-height/ascender/descender/etc. * Short segments * Colinear vectors * Jaggy segments (fixes #3064) * Semi-vertical / semi-horizontal lines
Lib/fontbakery/profiles/path.py
Outdated
warnings.append(glyphname) | ||
|
||
if warnings: | ||
formatted_list = "\t* " + pretty_print_list(list(set(warnings)), sep="\n\t* ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here you convert a list into a set and back into a list again. Is that meant to remove duplicates?
Also, it would be good to sort this list to avoid problems like the one described at #3038
I'd like to suggest renaming everything (profile, check-IDs, log messages, etc) to use the term "outlines" instead of "paths". Also, I am not so sure we need to put these into a separate profile. In general I prefer to avoid "profile proliferation". Whenever possible we should try to assign checks to the common profiles. Ideally this should go into the universal profile. But maybe it is useful to keep them into this |
Yes, I wasn't sure what to do with the profile. I agree it's best not to have a separate one but it was very helpful for testing/developing to be able to call the |
yeah, I think they should all be included in |
To select checks with a common part in the id can be done with the
|
This is great Simon! Do you have any information on the time impact for a routine universal profile run across a 'typical' font with this addition as a default? If this is significant, it may be worth either opting in/out with a command line flag or keeping this in a new outline check profile. |
If it is a WARN-level check, then it is OK to have fonts still not passing. I want to avoid adding too many new flags to the command line. The set of flags we have is already a bit too complex, in my opinion. I will try to run this on the entire collection and post a summary here later. |
Sorry I revised/clarified the question. I was attempting to ask about how much extra time it takes to run the profile with glyph level outline checks. |
Lib/fontbakery/profiles/outline.py
Outdated
for glyphname, outlines in outlines_dict.items(): | ||
for p in outlines: | ||
segments = p.asSegments() | ||
outline_area = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Travis noticed this variable is defined but not used. And the same thing for another var with the same name at line 147:
https://travis-ci.org/github/googlefonts/fontbakery/jobs/742453976
oh yeah, that might indeed be a bit of a concern. If it is way too heavy then it may be good to provide means to disable it. If it is just a bit of extra processing time, on the other hand, I think we can deal with it. I think we'd prefer better fonts even if it takes a bit longer to bake them. ;-) |
It is fairly slow, but not crazy slow - 4 seconds to process Source Sans Pro on my machine. One reason you may not want to run them by default is that there will almost always be lots of false positives, depending on your design. For example, with Source Sans, there are many legitimate "short segments" around the ink traps, apex of A etc, and some of these things - particularly collinear vectors and short segments - may be necessary for interpolation between masters. I don't want to train designers to ignore warnings as potentially nothing worth looking at... |
I think it may be reasonable to mention this high likelihood of false positives in the rationale text. And also suggest that users should consider looking at some of the results from time-to-time at least to double-check the correctness of their designs. |
Any idea why Travis is having a hard-time here?
https://travis-ci.org/github/googlefonts/fontbakery/jobs/742549872#L264 |
Simon's point is a good one. I think it boils down to volume. Tens of false positives per font is a nuisance. Hundreds per font breaks the tool. Users would need to filter out the check(s) or all WARN and lower logging in order to understand what is going on with all other issues that are checked in the universal profile. |
This is for a single font or a full |
Yes, I agree! Unfortunately, this makes me anxious because I believe we do already have too many verbosity control flags and I do not want to suggest yet another one in here :-P |
OK, so I've:
Because you have a set of requirements in
I've made it a bit faster (by making it give up testing after 100 warnings), so now it's 2s a font, 23 seconds for the whole Source Sans family. |
It's only one WARN, using pretty_print_list to cap the output at 10 lines. But the point is that if there are more than 100 glyphs with the problem, you get a PASS instead. |
That's perfect! Thanks :-) |
I'm happy with this PR and I will squash&merge as soon as we get a green on its last Travis (because I master-rebased it right now) |
Needs changelog. |
Indeed! Please add an entry. Thanks for remembering that! ;-) |
Lib/fontbakery/profiles/outline.py
Outdated
) | ||
|
||
if warnings: | ||
formatted_list = "\t* " + pretty_print_list(list(set(warnings)), sep="\n\t* ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please also perform sorting on this list due to issue #3038
Lib/fontbakery/profiles/outline.py
Outdated
warnings.append(f"{glyphname}: {s}") | ||
|
||
if warnings: | ||
formatted_list = "\t* " + pretty_print_list(list(set(warnings)), sep="\n\t* ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorting here as well (#3038)
I also noticed that we haven't yet included the |
alternatively, if you prefer, you can leave it to me by opening an issue and I will then address this ASAP after we finish work on this PR |
Rather than reporting a PASS when there are a large number of warnings, or itemizing them all at length, perhaps just note the number of warnings and the first ten or dozen glyphs that exemplify the problem? (Side note: a pet peeve of mine is a test that turns off itemizing altogether when there are a large number of issues. Even a few examples can be very helpful.) |
Nice checks ! We could probably join forces with the outline quality checklist we are working on with Vivi. It is intended for designers and their source files, although, it lists all kind of path issues that resist Fontmake.
|
I've done this in cases where the algorithm can be fairly sure that there really is a problem. But, for example, the short-segments finder fires a lot in certain kinds of design, but hardly at all in others. If it seems like the designer is deliberately using short segments, that's OK, and a test warning about them is just noise. If they're not deliberately using short segments, and we only find a few of them, it's worth flagging them up. |
Thanks, @simoncozens! I will now commit a set of minor tweaks to code-style here and then merge it |
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
@googlebot I consent. |
:-D |
Description
This pull request addresses the problems described at issue #3064 amongst others. Creates a new path profile with tests for:
As these are heuristic tests they create warnings rather than failures.
To Do
CHANGELOG.md
github/pages
, which is stuck)