summaryrefslogtreecommitdiff
path: root/fonts/mnsymbol/source/Sym-Init.mf
blob: 00a335a14c530d2d88942011b7837b8e2fd4b76c (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

def select(expr n)(text values) =
  begingroup;
    i := 0;
    for v = values:
      result := v;
      exitif i = n;
      i := i + 1;
    endfor;
    result
  endgroup
enddef;

def interpolate(expr x)(text values) =
  begingroup;
    if design_size <= 5:
      x * select(0)(values) * design_size/5
    elseif design_size >= 12:
      x * select(6)(values) * design_size/12
    elseif design_size >= 10:
      x * ((design_size - 10)/2)[select(5)(values), select(6)(values)]
    else:
      n := floor design_size;

      x * (design_size - n)[select(n-5)(values), select(n-4)(values)]
    fi
  endgroup
enddef;