Skip to content

Conversation

@blenderskool
Copy link

Changes:

  • Added a enableLigatures property to Text to toggle ligature substitution.
  • Ligature substitution is also automatically disabled when letter spacing is not zero.

This PR fixes #349

for (let ci = 0; ci < glyphIds.length; ci++) {
if (!joiningForms || !isJoiningFeature || formsToFeatures[joiningForms[ci]] === feature.tag) {
Typr.U._applySubs(glyphIds, ci, tab, lookupList)
if (enableLigatures) {
Copy link
Author

Choose a reason for hiding this comment

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

I noticed this part was responsible for ligature substitution, and I moved it behind the flag, but if it inadvertently disables something else do let me know!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, yeah I think we need to be more selective -- some substitutions are required for correctness (e.g. in Arabic scripts). We'll need to filter the supportedFeatures to remove just the stylistic ligatures. I think that's liga, but I'd have to research the others.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

Thanks, I've updated the code to only ignore liga, dlig and clig feature tags when non-zero letter spacing is applied. I think dlig and clig aren't supported right now going by this line:

const supportedFeatures = /^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws|ccmp)$/

so they don't have any effect but good to keep them if it gets supported in the future.

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.

Option to disable ligature substitution

2 participants