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

Font validate is incomplete #607

Closed
danielronnkvist opened this issue Jul 24, 2023 · 4 comments · May be fixed by #648
Closed

Font validate is incomplete #607

danielronnkvist opened this issue Jul 24, 2023 · 4 comments · May be fixed by #648
Assignees
Labels

Comments

@danielronnkvist
Copy link

Expected Behavior

Font.validate should return a boolean or the list of warnings that have been generated.

Current Behavior

Font.validate doesn't do anything.

Possible Solution

After asserting return the warnings array.

Context

I'm referencing this method.

@Connum Connum added the bug label Jul 31, 2023
@Connum
Copy link
Contributor

Connum commented Jul 31, 2023

Good catch, would you lake to contribute a PR for this fix, along with some tests to catch this behaviour?

@danielronnkvist
Copy link
Author

@Connum are all the assertions a true test for a valid font? For example running the validate function on the Roboto-Black font in the test folder returns these warnings. I would guess that most are just warnings and shouldn't invalidate the font.

[
  'No English weightName specified.',
  'No English manufacturer specified.'
]

Running fontlint for the same font output this information:

Copyright (c) 2000-2023. See AUTHORS for Contributors.
 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
 with many parts BSD <http://fontforge.org/license.html>. Please read LICENSE.
 Version: 20230101
 Based on sources from 2023-01-01 05:27 UTC-D.
Internal Error: Attempt to unget two characters
CHECKING     test/fonts/Roboto-Black.ttf
The following table(s) in the font have been ignored by FontForge
  Ignoring 'hdmx' horizontal device metrics table
ERROR      2 Self-intersecting glyph
ERROR      5 Missing points at extrema
FAIL         test/fonts/Roboto-Black.ttf

@Connum
Copy link
Contributor

Connum commented Oct 19, 2023

Good question. I think a font should always at least have all its meta data provided in English, but of course it also works without it. Maybe we need to be able to provide the severieties that we want to get back from that function? But that would require that we categorize errors/warnings by severity in the first place.

I would like to get the rest of @opentypejs/owners on board for this.

@Connum
Copy link
Contributor

Connum commented Nov 23, 2023

I'm currently working on restructuring the error handling. See also #337 and #643. You can check out the work-in-progress branch here, where Font.validate() will return an array of validation messages:

https://github.com/Connum/opentype.js/tree/WIP/validation-error-handling

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants