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

Some glyphs fails to render in COLRv1 variable font which renders fine in Chrome #276

Closed
yarmola opened this issue Sep 18, 2022 · 9 comments

Comments

@yarmola
Copy link

yarmola commented Sep 18, 2022

A sample VF built with FontLab using latest varLib and Nabla sources fails to render certain glyphs in the latest FG.
Same font renders fine in Chrome.

Font is attached ("A" is modified as a marker).

It is possible that font has its own issues (we continue testing it), but I think it may actually be an issue in FG rendering, as COLRv1 is relatively new tech.

Nabla-VF.ttf.zip

FG (with the original Nabla and modified/problematic version):

Screenshot 2022-09-18 at 18 22 32

Same modified font in Chrome:

Screenshot 2022-09-18 at 18 21 56

@justvanrossum
Copy link
Owner

Thanks for reporting! It's a good old ZeroDivisionError :)

https://github.com/BlackFoundryCom/black-renderer/blob/main/Lib/blackrenderer/font.py#L459-L469

I'lve opened an issue in blackrenderer: BlackFoundryCom/black-renderer#113

@justvanrossum
Copy link
Owner

(Most likely because the points of a linear gradient are simply overlapping.)

@justvanrossum
Copy link
Owner

justvanrossum commented Sep 18, 2022

Btw. the fonttools subsetter stumbles over the the CPAL table, which is format 1. Not sure if the font is faulty or fonttools buggy.

@yarmola
Copy link
Author

yarmola commented Sep 18, 2022

the fonttools subsetter stumbles over the the CPAL table

Will check that, thanks! That happens with the original or modified font?

@justvanrossum
Copy link
Owner

Will check that, thanks! That happens with the original or modified font?

The modified font, the original has a format 0 CPAL table.

@yarmola
Copy link
Author

yarmola commented Sep 18, 2022

Some investigation:

I checked how B (gid 13) is built and found that the original font has one of the gradients made like this:

Screenshot 2022-09-18 at 21 01 15

If I read COLRv1 spec correctly, that makes zero-length gradient line, which is technically wrong:

If either point p₁ or p₂ is the same as point p₀, the gradient is ill-formed and must not be rendered.

I think that we have 1) problem in the source Nabla font 2) same problem but packed differently in the converted font 3) issue in the renderer which should be more tolerant to such cases.

@justvanrossum
Copy link
Owner

I've fixed the ZeroDivisionError in the meantime (BlackFoundryCom/black-renderer#114), but I need to investigate the zero-length gradient (justvanrossum/nabla#41).

@yarmola
Copy link
Author

yarmola commented Sep 18, 2022

That's the first gradient "shape" in B, easy to spot.

@justvanrossum
Copy link
Owner

This should be fixed in FontGoggle 1.7.0: https://github.com/justvanrossum/fontgoggles/releases

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