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

Bug with Recursive font #3506

Closed
khaledhosny opened this issue Mar 24, 2022 · 5 comments · Fixed by #3510
Closed

Bug with Recursive font #3506

khaledhosny opened this issue Mar 24, 2022 · 5 comments · Fixed by #3510
Assignees

Comments

@khaledhosny
Copy link
Collaborator

HarfBuzz seems to have a problem applying variations to some glyphs of Recursive font downloaded from https://fonts.google.com/specimen/Recursive:

$ hb-shape Recursive-VariableFont_CASL,CRSV,MONO,slnt,wght.ttf -u c5 --variations="wght=300" --show-extents
[Aring=0+650<40,896,570,-896>]
$ hb-shape Recursive-VariableFont_CASL,CRSV,MONO,slnt,wght.ttf -u c5 --variations="wght=600" --show-extents
[Aring=0+650<0,0,0,0>]

hb-view also produces a blank image. FreeType font functions work fine:

$ hb-shape Recursive-VariableFont_CASL,CRSV,MONO,slnt,wght.ttf -u c5 --variations="wght=600" --font-funcs=ft --show-extents
[Aring=0+650<36,898,578,-898>]

Recursive.zip

@khaledhosny
Copy link
Collaborator Author

Interestingly, upstream files or even file downloaded directly from Google Fonts git repository do not show this problem:

$ hb-shape "Recursive[CASL,CRSV,MONO,slnt,wght].ttf" -u c5 --variations="wght=600" --show-extents
[Aring=0+650<36,898,578,-898>]

cc @rsheeter in case the download zip from the website is modified by some tool.

@behdad
Copy link
Member

behdad commented Mar 25, 2022

Reproduces for me.

@behdad
Copy link
Member

behdad commented Mar 25, 2022

There's a bug inside gvar's apply_deltas_to_points. glyf is bailing if that function returns false. That's wrong. But also if I make it not do that, the ring doesn't get variations applied whereas freetype does apply. Debugging further.

@behdad
Copy link
Member

behdad commented Mar 25, 2022

There's a bug inside gvar's apply_deltas_to_points

Looks to me like unpack_deltas is getting wrong bytes to unpack. This condition is being hit:

      if (j < run_count) 

@behdad
Copy link
Member

behdad commented Mar 25, 2022

I think we should apply this change regardless:

diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh
index 066e152da..b4ac68834 100644
--- a/src/hb-ot-glyf-table.hh
+++ b/src/hb-ot-glyf-table.hh
@@ -820,8 +820,7 @@ struct glyf
       }
 
 #ifndef HB_NO_VAR
-      if (unlikely (!glyf_accelerator.gvar->apply_deltas_to_points (gid, font, points.as_array ())))
-       return false;
+      glyf_accelerator.gvar->apply_deltas_to_points (gid, font, points.as_array ());
 #endif
 
       switch (type) {

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

Successfully merging a pull request may close this issue.

3 participants