% ligatures and kerns for roman fonts

ligtable
    "`":  "`"=:oct"020",
          oct"020" kern 2u#,
          "?" kern 2u#,
          "!" kern 2u#;

ligtable
    "'":  "'"=:oct"021",
          oct"021" kern 2u#,
          "?" kern 2u#,
          "!" kern 2u#;

ligtable
    "-":  "-" =: oct"025",
     oct"177" =: oct"177"; % <hyphen><hyphenchar> => <hyphenchar>

ligtable
    oct"025": "-"=:oct"026";  % "---"  => emdash

ligtable "<": "<" =: oct"023";     % "<<"
ligtable ">": ">" =: oct"024";     % ">>"
ligtable ",": "," =: oct"022";     % ",,"

k#:=-.5u#; ku#:=-1u#; kk#:=-1.5u#; kkk#:=-2u#; % four degrees of kerning

ligtable boundarychar:
   oct"020" kern -kk#, oct"021" kern -kk#, oct"022" kern -kk#,
   oct"055" kern -kk#, oct"140" kern -kk#, oct"047" kern -kk#;

ligtable oct"022":
   oct"015" kern 2u#, "," kern 2u#,
         oct"015":
   oct"022" kern 2u#,
   "j" kern -kkk#, oct"032" kern -kkk#, "g" kern -ku#, 
   y_fam(kern -ku#,) 
   "v" kern kk#, "w" kern ku#, "V" kern kkk#, "W" kern kk#,
   Y_fam(kern kk#,)  
   O_fam(kern k#,) 
   lig_CGQ_table(k#),
   boundarychar kern -kk#;

ligtable oct"020":
   oct"140" kern 2u#, oct"020" kern 2u#, boundarychar kern -kk#;

ligtable oct"021":
   oct"047" kern 2u#, oct"021" kern 2u#, boundarychar kern -kk#;

ligtable oct"024": % ">>"
   "." kern kk#, "," kern kk#;

ligtable
      "k":  "W" kern kk#, "V" kern kk#,
      if serifs: "v": a_fam(kern -u#,) fi
      "w": e_fam(kern k#,)
           a_fam(kern k#,)
           o_fam(kern k#,)
           "c" kern k#;

ligtable
      "P":   A_fam(kern kk#,)
      y_fam(:)
             o_fam(kern k#,)
             e_fam(kern k#,)
             a_fam(kern k#,)
             "." kern kk#,
             "," kern kk#;
ligtable
      "F":"V": "W":
           if serifs:
             o_fam(kern kk#,)
             a_fam(kern kk#,)
             e_fam(kern kk#,)
             y_fam(kern kk#,)
             u_fam(kern kk#,)
             "r" kern kk#,
             "v" kern kk#,
             "s" kern kk#,
             "c" kern kk#,
             d_fam(kern kk#,)
             "g" kern kk#,
             "m" kern kk#,
             "n" kern kk#,
             "p" kern kk#,
             "w" kern kk#,
             "z" kern kk#,
             A_fam(kern kkk#,)
            else: 
             o_fam(kern k#,)
             a_fam(kern k#,)
             e_fam(kern k#,)
             y_fam(kern k#,)
             u_fam(kern k#,)
             "r" kern k#,
             "v" kern k#,
             "s" kern k#,
             "c" kern k#,
             d_fam(kern k#,)
             "g" kern k#,
             "m" kern k#,
             "n" kern k#,
             "p" kern k#,
             "w" kern k#,
             "z" kern k#,
             A_fam(kern kk#,)
            fi
       "X":  O_fam(kern k#,)
             lig_CGQ_table(k#);

ligtable "K":  if serifs:
                 "v" kern kk#,
                 "w" kern k#,
               else:
                 "v" kern k#,
               fi 
               o_fam(kern k#,)
               lig_CGQ_table(k#);

ligtable
       "T":
               y_fam(kern if serifs: k# else: kk# fi,)
       Y_fam(:)
               A_fam(kern kk#,)
               e_fam(kern kk#,)
               o_fam(kern kk#,)
               "r" kern kk#,
               a_fam(kern kk#,)
               u_fam(kern kk#,)
               "n" kern kk#,
               oct"031" kern kk#, % \i
               "c" kern kk#, 
               d_fam(kern kk#,)
               "g" kern kk#,
               "p" kern kk#,
               "s" kern kk#,
               "v" kern kk#,
               "w" kern kk#,
               "x" kern kk#,
               "z" kern kk#;
ligtable
 O_fam(:)
 D_fam(:)
               "X" kern k#,
               "W" kern k#,
               A_fam(kern k#,)
               Y_fam(kern k#,)
               "V" kern k#;
if serifs:
ligtable
       "m": "n": "h": 
               "W" kern kk#, "V" kern kk#,
               "t" kern k#,
               u_fam(kern k#,)
               "b" kern k#,
               y_fam(kern k#,)
               "v" kern k#,
               "w" kern k#;
ligtable
       "c":
               "h" kern k#,
               "k" kern k#;
fi
ligtable
 o_fam(:)
 "b": "p":     e_fam(kern -k#,)
               o_fam(kern -k#,)
               "x" kern k#,
               d_fam(kern -k#,)
               "c" kern -k#,
               "q" kern -k#,
 a_fam(:) 
              if serifs:
               "v" kern k#,
               "j" kern u#,
              else:
               "r" kern k#,
              fi
 "t": 
              y_fam(kern k#,) 
 u_fam(:) 
              "w" kern k#;
ligtable
       A_fam(:)
              y_fam(kern if serifs: kk# else: k# fi,)
              "v" kern if serifs: kkk# else: k# fi, 
              "w" kern if serifs: kk# else: k# fi,
              "c" kern k#,
              d_fam(kern k#,)  
              e_fam(kern k#,)
              o_fam(kern k#,)
              "q" kern k#,
  if serifs: "R": fi 
              "t" kern k#, 
              lig_CGQ_table(k#),
              O_fam(kern k#,)
              U_fam(kern k#,)
  "L": 
       "T" kern kk#, 
       Y_fam(kern kk#,) 
       "V" kern kkk#,
       "W" kern kkk#;
ligtable "g": "j" kern -k#; % logjam
ligtable "I": "I" kern -k#; % Richard III
ligtable e_fam(:) "V" kern kk#; % eV

endinput;
