Skip to content

Conversation

@grisha
Copy link

@grisha grisha commented Jan 30, 2026

Fixes boxesandglue/boxesandglue#14

When callers pass an empty feature slice (e.g., make([]Feature, 0) or []Feature{}), the default features including ccmp are not applied. This is because the check features == nil only matches a nil slice, not an empty one.

This causes issues when using textshape through boxesandglue, which initializes features with make([]Feature, 0, ...). The result is that GSUB features like ccmp (glyph composition/decomposition) are skipped, leading to incorrect rendering of combining marks.

For example, in Church Slavonic text, the letter И (U+0418) can have two combining diacritical marks: psili (U+0486) and oxia (U+0301). The font's ccmp feature substitutes these two marks into a single precomposed ligature glyph (uni04860301) that positions them correctly side-by-side. Without ccmp, the marks are rendered separately using mkmk positioning, which in some fonts results in overlapping or incorrectly stacked marks.

Before the fix:

Screenshot 2026-01-29 at 21 59 35

After the fix:

Screenshot 2026-01-29 at 21 59 49

@pgundlach
Copy link
Contributor

Looks good to me, I am currently working on textshape, I will include this when I merge my changes (hopefully today)

@pgundlach
Copy link
Contributor

I think that the current implementation in textshape is wrong. I will commit a change, then I will check if this issue persists. => I might not merge your pull request, but come up with a different solution. I hope you don't mind.

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.

Incorrect rendering when combining diacritical marks

2 participants