Skip generating ignores for certain ligatures.

- Logic ripped from FiraCode, not currently applicable to Fantasque
 Sans

 - Some potential ligatures ( <*>, <$> ), can be arbitrarily extended
 while still making sense: ( <<<$>>>, etc). Standard 'ignore' rules will
 prevent this from displaying, so we can skip those for certain
 ligatures.
pull/134/head
John Mager 2020-06-20 19:54:02 -04:00
parent 7506577e37
commit 5c088fcf68
1 changed files with 17 additions and 4 deletions

View File

@ -45,13 +45,17 @@ def rule(liga):
[LIG f i] LIG
[ f f i] LIG }
"""
rules = []
# standard ignores:
# ignore sub {0} {0}' {1};
# ignore sub {0}' {1} {1};
rules = [
ignore(prefix=liga[:1], head=liga[0], suffix=liga[1:]),
ignore(head=liga[0], suffix=(liga[1:] + [liga[-1]])),
]
if tuple(liga) not in skip_ignores:
rules.extend(
[
ignore(prefix=liga[:1], head=liga[0], suffix=liga[1:]),
ignore(head=liga[0], suffix=(liga[1:] + [liga[-1]])),
]
)
# careful with repeats:
# #133 ->->->->, /**/**/**/, etc.
@ -220,5 +224,14 @@ ignore_prefixes = [
]
# DO NOT generate ignores at all
skip_ignores = {
# # <<*>> <<+>> <<$>>
# ("less", "asterisk", "greater"),
# ("less", "plus", "greater"),
# ("less", "dollar", "greater"),
}
def indent(text, prefix):
return '\n'.join(prefix + line for line in text.split('\n'))