14
0
mirror of https://github.com/belluzj/fantasque-sans.git synced 2024-12-22 07:21:31 +01:00

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.
This commit is contained in:
John Mager 2020-06-20 19:54:02 -04:00
parent 7506577e37
commit 5c088fcf68

View File

@ -45,13 +45,17 @@ def rule(liga):
[LIG f i] LIG [LIG f i] LIG
[ f f i] LIG } [ f f i] LIG }
""" """
rules = []
# standard ignores: # standard ignores:
# ignore sub {0} {0}' {1}; # ignore sub {0} {0}' {1};
# ignore sub {0}' {1} {1}; # ignore sub {0}' {1} {1};
rules = [ if tuple(liga) not in skip_ignores:
ignore(prefix=liga[:1], head=liga[0], suffix=liga[1:]), rules.extend(
ignore(head=liga[0], suffix=(liga[1:] + [liga[-1]])), [
] ignore(prefix=liga[:1], head=liga[0], suffix=liga[1:]),
ignore(head=liga[0], suffix=(liga[1:] + [liga[-1]])),
]
)
# careful with repeats: # careful with repeats:
# #133 ->->->->, /**/**/**/, etc. # #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): def indent(text, prefix):
return '\n'.join(prefix + line for line in text.split('\n')) return '\n'.join(prefix + line for line in text.split('\n'))