summaryrefslogtreecommitdiff
path: root/src/features/liga.fea
blob: a387f16e7eead5664d4e2aadbea0a873b8fd3c69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Standard ligatures
# https://docs.microsoft.com/en-us/typography/opentype/spec/features_ko#liga

@DASH = [
  hyphen
  endash
  emdash
];
@DASH_CASE = [
  hyphen.case
  endash.case
  emdash.case
];
@DASH_ANY = [ @DASH @DASH_CASE ];

# --->
sub @DASH @DASH @DASH greater by rightLongArrow2;
sub @DASH_ANY @DASH_ANY @DASH_ANY greater.case by rightLongArrow2.case;
# -->
sub @DASH @DASH greater by rightLongArrow;
sub @DASH_ANY @DASH_ANY greater.case by rightLongArrow.case;
# [endash emdash]-> (legacy)
sub [endash emdash] greater by rightLongArrow;
sub [endash emdash endash.case emdash.case] greater.case by rightLongArrow.case;
# ->
sub hyphen greater by rightArrow;
sub [hyphen hyphen.case] greater.case by rightArrow.case;
# <---
sub less @DASH @DASH @DASH by leftLongArrow2;
sub less.case @DASH_ANY @DASH_ANY @DASH_ANY by leftLongArrow2.case;
# <--
sub less @DASH @DASH by leftLongArrow;
sub less.case @DASH_ANY @DASH_ANY by leftLongArrow.case;
# <-[endash emdash] (legacy)
sub less [endash emdash] by leftLongArrow;
sub less.case [endash emdash endash.case emdash.case] by leftLongArrow.case;
# ignore e.g. "<-3" ("less than negative")
ignore sub less' hyphen' @Numeral;
ignore sub less.case' [hyphen hyphen.case]' @Numeral;
# <-
sub less' hyphen' by leftArrow;
sub less.case' [hyphen hyphen.case]' by leftArrow.case;
# <->
sub less rightArrow by leftRightArrow; #  <,->
sub [less less.case] rightArrow.case by leftRightArrow.case;
sub leftArrow greater by leftRightArrow; # <-,-
sub leftArrow.case [greater greater.case] by leftRightArrow.case;
# <-->
sub less rightLongArrow by leftRightLongArrow; # <,-->
sub [less less.case] rightLongArrow.case by leftRightLongArrow.case;
sub leftLongArrow greater by leftRightLongArrow; # <--,>
sub leftLongArrow.case [greater greater.case] by leftRightLongArrow.case;
# <=>
sub less equal greater by leftRightDoubleArrow;
sub less.case [equal equal.case] [greater greater.case] by leftRightDoubleArrow.case;
sub less equal equal greater by leftRightLongDoubleArrow;
sub less.case [equal equal.case] [equal equal.case] [greater greater.case] by leftRightLongDoubleArrow.case;
# =>
sub equal equal greater by rightLongDoubleArrow;
sub [equal equal.case] [equal equal.case] greater.case by rightLongDoubleArrow.case;
sub equal greater by rightDoubleArrow;
sub [equal equal.case] greater.case by rightDoubleArrow.case;
# <==
sub less equal equal by leftLongDoubleArrow;
sub less.case [equal equal.case] [equal equal.case] by leftLongDoubleArrow.case;
# Note: We do NOT (sub less equal by leftDoubleArrow) as that would
# interfere with "<=" (less than or equal to)

# x surrounded by numbers, e.g. 3x4 -> 3×4
sub @Numeral x' @Numeral                                                 by multiply; # 3x9
sub @Numeral @Whitespace x' @Numeral                                     by multiply; # 3 x9
sub @Numeral @Whitespace @Whitespace x' @Numeral                         by multiply; # 3  x9
sub @Numeral x' @Whitespace @Numeral                                     by multiply; # 3x 9
sub @Numeral @Whitespace x' @Whitespace @Numeral                         by multiply; # 3 x 9
sub @Numeral @Whitespace @Whitespace x' @Whitespace @Numeral             by multiply; # 3  x 9
sub @Numeral x' @Whitespace @Whitespace @Numeral                         by multiply; # 3x  9
sub @Numeral @Whitespace x' @Whitespace @Whitespace @Numeral             by multiply; # 3 x  9
sub @Numeral @Whitespace @Whitespace x' @Whitespace @Whitespace @Numeral by multiply; # 3  x  9