Skip to content

Fixed VariationAxis.hidden being initialized with garbage data - #216

Open
SamusAranX wants to merge 1 commit into
harfbuzz:mainfrom
SamusAranX:fvar-axis-hidden
Open

Fixed VariationAxis.hidden being initialized with garbage data#216
SamusAranX wants to merge 1 commit into
harfbuzz:mainfrom
SamusAranX:fvar-axis-hidden

Conversation

@SamusAranX

Copy link
Copy Markdown

In fvar.rs, the hidden flag is currently read like this:

hidden: (flags >> 3) & 1 == 1,

According to the docs linked in that file, the bitshift here is wrong, and a simple flags & 1 == 1 would do.
If you have access to a Mac, you can verify this by checking the hidden GRAD axis in /System/Library/Fonts/SFNS.ttf.
(I'd point to another, more freely accessible font, but I'm afraid I'm not aware of any with hidden axes, sorry)

@asibahi

asibahi commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Thanks for this. I fixed this in my Zig port, but I do wonder where the >> 3 comes from. It seems that it used to be auto-generated somehow.

I wonder if other font parser exhibit the same behaviour.

@SamusAranX

Copy link
Copy Markdown
Author

Autogenerated how, though? The original commit is from October 2021, which is well before coding agents etc were mainstream.

@asibahi

asibahi commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Python scripts. They’re all the rage in Unicode libraries

@SamusAranX

Copy link
Copy Markdown
Author

Point taken. Wish I knew where the bitshift came from though.

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 this pull request may close these issues.

2 participants