Skip to content

[glyphs] Fix logic bug in category construction#1714

Merged
cmyr merged 1 commit into
mainfrom
glyphs-category-for-funny-name
Oct 22, 2025
Merged

[glyphs] Fix logic bug in category construction#1714
cmyr merged 1 commit into
mainfrom
glyphs-category-for-funny-name

Conversation

@cmyr

@cmyr cmyr commented Oct 22, 2025

Copy link
Copy Markdown
Member

A misplaced 'filter_map' was causing us to skip the (null) attributes of the first glyph in a ligature sequence if that glyph had a name we could not recognize. This caused us to treat the second glyph as the first, and so miscategorize various glyphs as non-spacing marks, which was causing various little diffs.

This is worth at least a +4, and improves the diff on a number of other targets.

Comment thread glyphs-reader/src/glyphdata.rs Outdated
.map(|name| self.query_no_synthesis(name, None))
.collect();
if let Some(first_attr) = base_names_attributes.first() {
if let Some(first_attr) = base_names_attributes.first().unwrap() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a comment wrt unwrap safety?

#[test]
fn unknown_name_combined_with_mark() {
// if first part is unknown, we don't assign a category
assert_eq!(get_category("Whata-WEIRDNameLOL_brevecomb", &[]), None)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert_eq!(get_category("Whata-WEIRDNameLOL_brevecomb", &[]), None)
assert_eq!(get_category("Whata-WEIRDNameLOL_brevecomb", &[]), None);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the assert returns () which is the implied return value of the fn, so this is allowed 🤷

@anthrotype anthrotype Oct 22, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so you did it on purpose? naughty boy

Comment thread glyphs-reader/src/glyphdata.rs Outdated
A misplaced 'filter_map' was causing us to skip the (null) attributes of
the first glyph in a ligature sequence if that glyph had a name we could
not recognize. This caused us to treat the second glyph as the first,
and so miscategorize various glyphs as non-spacing marks, which was
causing various little diffs.
@cmyr cmyr force-pushed the glyphs-category-for-funny-name branch from faf5e0a to 10aec60 Compare October 22, 2025 17:55
@cmyr cmyr added this pull request to the merge queue Oct 22, 2025
Merged via the queue into main with commit 993d742 Oct 22, 2025
12 checks passed
@cmyr cmyr deleted the glyphs-category-for-funny-name branch October 22, 2025 17:58
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.

3 participants