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

need to read 'disabled' property of Glyphs custom parameters #312

Closed
anthrotype opened this issue May 31, 2023 · 1 comment
Closed

need to read 'disabled' property of Glyphs custom parameters #312

anthrotype opened this issue May 31, 2023 · 1 comment
Labels
good first issue Good for newcomers

Comments

@anthrotype
Copy link
Member

A Glyph.app's custom parameter may be disabled, the UI provides a checkbox that one can un-tick, and the serialized plist will contain an additional disabled = 1 attribute.
glyphsLib currently doesn't seem to care whether a custom parameter is disabled or not, and that's a bug:
googlefonts/glyphsLib#905

we should have our rust glyphs-reader do the right thing and only consider parameters to be active if not disabled.

@anthrotype
Copy link
Member Author

I believe this should be fixed nowadays. I see code like this where we parse CustomParameters struct from plist:

// these params can have an optional 'disabled' flag set; if present
// we just pretend they aren't there.
let mut disabled = false;
let mut name = None;
let mut value = None;
for _ in 0..3 {
let key: String = tokenizer.parse()?;
tokenizer.eat(b'=')?;
match key.as_str() {
"disabled" => {
let flag = tokenizer.parse::<i64>()?;
disabled = flag != 0;
tokenizer.eat(b';')?;
}

if let Some((name, value)) = name.zip(value).filter(|_| !disabled) {
params.push((name, value));
}

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

No branches or pull requests

2 participants