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

Can't enable ss09 ligature for => without enabling <= ligature? #219

Open
ian-h-chamberlain opened this issue May 12, 2024 · 4 comments
Open
Milestone

Comments

@ian-h-chamberlain
Copy link

Hi, I was testing the changes in version 1.101 (thanks for such a quick release!), particularly as related to #206, and I noticed there doesn't seem to be any way to use <= and >= without ligatures, while still enabling an arrow ligature for =>. I thought maybe i could use cv60 (or 'cv60' off?) to set this, but it seems to only have an effect with ss02 turned on (which isn't what I was looking for).

Maybe relates to #217 as well?

Here are some screenshots of combinations I tried — none of them result in the <=, >= combo I was hoping for:

Screenshot 2024-05-12 at 11 53 20 Screenshot 2024-05-12 at 11 53 44 Screenshot 2024-05-12 at 11 53 57 Screenshot 2024-05-12 at 11 54 07 Screenshot 2024-05-12 at 12 05 12

Is it expected that cv60 would work with ss09 as well, not just ss02? Or is there some other way to configure what I'm trying to accomplish here? Thank you!

@ian-h-chamberlain ian-h-chamberlain changed the title Can't enable ss09 ligature for => without enabling <= ligature Can't enable ss09 ligature for => without enabling <= ligature? May 12, 2024
@heathercran
Copy link
Collaborator

Hi @ian-h-chamberlain! Can you clarify which appearance you want to see for each of those pairs? Which ligatures exactly do you want to have enabled?

@ian-h-chamberlain
Copy link
Author

ian-h-chamberlain commented May 15, 2024

Hi, sorry, I guess maybe it got lost in my description. What I would like (and I think was possible in 1.000, but not in 1.100 due to #206):

  • <=, >=: no ligature, i.e. 'ss02' off
  • =>: display as image, i.e. 'ss09' on (formerly documented as ss03)

The issue seems to be that ss09 always enables the image ligature, with no ability to disable it while keeping image enabled. It's possible to replace it with , but not restore it to the original <= pair.


As a side note: https://monaspace.githubnext.com/#code-ligatures doesn't seem to work for ss09, the left and right sides of the comparison look the same in my browser, unlike the actual font when using in e.g. VSCode. It also doesn't seem to include an example for <= although ss09 does enable a ligature for that pair.

@heathercran
Copy link
Collaborator

Ok, that's what I thought, I just wanted to make sure I was understanding you correctly! I will include some more variants within cv60 in the next update, so that you'll be able to specify which version of the pair you want to see, regardless of which stylistic sets are enabled.

In the meantime, if you don't want to wait, you can use an open source font editor like FontForge to remove the <= pair from ss09, which would achieve the same result you're looking for.

I'll also make sure @idan knows about the ligatures on the website. Thanks for bringing that to our attention!

@heathercran heathercran added this to the 1.2 milestone May 15, 2024
@ian-h-chamberlain
Copy link
Author

Thanks for the tip! I wasn't able to get FontForge working without breaking the variable fonts (it seems to have limited support), but I managed to do it more correctly with https://github.com/fonttools/fonttools.

Posting my little script here in case anyone else finds it useful... I think this could probably be used to selectively disable any ligature as long as you know its name, so it might be a workaround for anyone else whose preferences aren't met by enabling/disabling ssXX font features:

import sys

from fontTools import ttLib

_UNWANTED_LIGATURE = "less_equal.alt"


def main():
    for font_name in sys.argv[1:]:
        print(f"Removing '{_UNWANTED_LIGATURE}' from {font_name}... ", end="")

        with ttLib.TTFont(font_name) as font:
            # Open the font file and remove the `<=` ligature (less_equal.alt)
            # while keeping >>=, => etc. in place

            for lookup in font["GSUB"].table.LookupList.Lookup:
                for subst in lookup.SubTable:
                    if not hasattr(subst, "ligatures"):
                        continue

                    if "less" not in subst.ligatures:
                        continue

                    subst.ligatures["less"] = [
                        lig
                        for lig in subst.ligatures["less"]
                        if lig.LigGlyph != _UNWANTED_LIGATURE
                    ]

            font.save(font_name)

        print("Done")


if __name__ == "__main__":
    main()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

2 participants