% Turkish font with full diacriticals, based on the
% Computer Modern Roman family of fonts (by D. E. Knuth, 1979--1985)

% Adapted for Turkish by P. A. MacKay, January, 1987.

% If command line includes |pxlfont=128;|, |use_pxl| becomes true
boolean use_pxl;
if unknown pxlfont: use_pxl:=false; else: use_pxl:=true; fi

% Use the roman questionmark for this class of fonts
% This will come out of romanp.mf if a 256-character font is being
% written, otherwise it will be supplied by conditional code in
% tkpnct.mf.  This code is activated by a known value in |romquery|.
if use_pxl: romquery=oct"077";
else: spanish_shriek=oct"016"; spanish_query=oct"017"; fi

if not monospace: izafet_dot= if use_pxl: oct"0175" else: oct"0375" fi; fi

if ligs>0: font_coding_scheme:="TeX Turkish"
else: font_coding_scheme:="TeX typewriter Turkish" fi;

mode_setup; font_setup;

input romanu;  % upper case (majuscules) unchanged for Turkish
input tkroml;  % lower case (minuscules) romanl with dotless i
input romand;  % numerals
if ligs>0: input comlig; fi % ligatures common with italic text
input tkpnct;  % punctuation common to roman and italic (reduced set)
input aynhmz;  % ayn and hamza, izafet dot |iff not monospace|
if use_pxl:
else:
 input greeku;  % upper case Greek letters
 input romanp;  % ampersand, question marks, currency sign
 input romspl;  % lowercase specials (dotless \i, ligature \ae, etc.)
 input romspu;  % uppercase specials (\AE, \OE, \O)
 input accent;  % accents common to roman and italic text
 if ligs<=1: input romsub; fi  % substitutes for ligatures

 ligtable "!": "`" =: spanish_shriek;
 ligtable "?": "`" =: spanish_query;
 extra_endchar:=extra_endchar&"charcode:=charcode+code_offset";
 code_offset:=128; % move accented chars into 128..255 region
fi
input tkdotu;  % upper case with dotted diacriticals
input tkdotl;  % lower case with dotted diacriticals
input tkaccu;  % upper case with assorted accents
input tkaccl;  % lower case with assorted accents
if ligs<=0: input tksub; fi  % substitutes for ligatures

% A thoroughly mixed list of names for the accented characters.
% These follow English, Arabic and Turkish conventions rather arbitrarily
% Only the letters that appear more than once in the ligtable are coded here.

if use_pxl:
HAT_A=oct"044"; CHIM=oct"013"; DAD=oct"000"; DHAL=oct"014";
CUP_G=oct"015"; GHAYN=oct"001"; QAF=oct"004";
DOT_O=oct"005"; TTA=oct"007";
DOT_U=oct"010"; HAT_U=oct"046";
hat_a=oct"074"; chim=oct"033"; dhal=oct"034"; dad=oct"020";
cup_g=oct"035"; ghayn=oct"021";
hha=oct"022"; kha=oct"036"; dot_i=oct"023"; hat_i=oct"075";
qaf=oct"024"; gnaf=oct"037"; dot_o=oct"025";  hat_o=oct"040";
tta=oct"027"; dot_u=oct"030"; hat_u=oct"076";
else:
HAT_A=oct"0244"; CHIM=oct"0213"; DAD=oct"0200"; DHAL=oct"0214";
CUP_G=oct"0215"; GHAYN=oct"0201"; QAF=oct"0204";
DOT_O=oct"0205"; TTA=oct"0207";
DOT_U=oct"0210"; HAT_U=oct"0246";
hat_a=oct"0274"; chim=oct"0233"; dhal=oct"0234"; dad=oct"0220";
cup_g=oct"0235"; ghayn=oct"0221";
hha=oct"0222"; kha=oct"0236"; dot_i=oct"0223"; hat_i=oct"0275";
qaf=oct"0224"; gnaf=oct"0237"; dot_o=oct"0225";  hat_o=oct"0240";
tta=oct"0227"; dot_u=oct"0230"; hat_u=oct"0276";
fi

font_slant slant; font_x_height x_height#;

% Accent ligatures not complicated by questions of kerning
% good for both monospace and variable-space fonts.

ligtable "C": ":"=:CHIM; ligtable "G": ":"=:GHAYN, "="=:CUP_G;
ligtable "H": "="=:if use_pxl: oct"016" else: oct"0216" fi,
             "!"=:if use_pxl: oct"002" else: oct"0202" fi;
ligtable "N": "="=:if use_pxl: oct"017" else: oct"0217" fi;
ligtable "S": ":"=:if use_pxl: oct"052" else: oct"0252" fi,
             "="=:if use_pxl: oct"0136" else: oct"0336" fi,
             "!"=:if use_pxl: oct"006" else: oct"0206" fi;
ligtable "U": ":"=:DOT_U, "="=:HAT_U;
ligtable "Z": ":"=:if use_pxl: oct"011" else: oct"0211" fi,
             "="=:if use_pxl: oct"0137" else: oct"0337" fi,
             "!"=:if use_pxl: oct"012" else: oct"0212" fi;

ligtable "d": "="=:dhal, "!"=:dad; ligtable "i": ":"=:dot_i, "="=:hat_i;
ligtable "s": ":"=:if use_pxl: oct"053" else: oct"0253" fi,
             "="=:if use_pxl: oct"0176" else: oct"0376" fi,
             "!"=:if use_pxl: oct"026" else: oct"0226" fi;
ligtable "z": ":"=:if use_pxl: oct"031" else: oct"0231" fi,
             "="=:if use_pxl: oct"0177" else: oct"0377" fi,
             "!"=:if use_pxl: oct"032" else: oct"0232" fi;

if monospace: font_normal_space 9u#; % no stretching or shrinking
font_quad 18u#;
font_extra_space 9u#;
ligtable "A": "="=:HAT_A; ligtable "a": "="=:hat_a;
ligtable "D": "="=:DHAL, "!"=:DAD;
ligtable "I": ":"=:if use_pxl: oct"003" else: oct"0203" fi,
              "="=:if use_pxl: oct"045" else: oct"0245" fi;
ligtable "K": "!"=:QAF; ligtable "k": "!"=:qaf;
ligtable "O": ":"=:DOT_O; ligtable "o": ":"=:dot_o; % no |hat_o| here
ligtable "T": "!"=:TTA; ligtable "t": "!"=:tta;
ligtable "c": ":"=:chim; ligtable "g": ":"=:ghayn, "="=:cup_g;
ligtable "h": "="=:kha, "!"=:hha; ligtable "n": "="=:gnaf;
ligtable "u": ":"=:dot_u, "="=:hat_u;
else: font_normal_space 6u#+2letter_fit#;
font_normal_stretch 3u#; font_normal_shrink 2u#;
font_quad 18u#+4letter_fit#;
font_extra_space 2u#;
k#:=-.5u#; kk#:=-1.5u#; kkk#:=-2u#; % three degrees of kerning

% The following ligtable entries are based on the entries in
% roman.mf.  It has been necessary to extract many parts of the
% original entries in order to keep the ligature structure clear.

ligtable "k": "!"=:qaf, % new ligature---kerns from what follows
 qaf: % remainder---kerns only
 if serifs: "v": "a" kern -u#, hat_a kern -u#, fi\\
 "w": "e" kern k#,
 "a" kern k#, hat_a kern k#, "c" kern k#, chim kern k#,
 "o" kern k#, dot_o kern k#, hat_o kern k#;

ligtable "P": "A" kern kk#, HAT_A kern kk#,
 "y": "o" kern k#, hat_o kern k#, dot_o kern k#,
 "e" kern k#, "a" kern k#, hat_a kern k#, "." kern kk#, "," kern kk#;

ligtable "F": "V": "W": if serifs: % remainder---kerns only
   "o" kern kk#, hat_o kern kk#, dot_o kern kk#,
   "e" kern kk#, "u" kern kk#, dot_u kern kk#, hat_u kern k#,
   "r" kern kk#, "a" kern kk#, hat_a kern kk#,
   "A" kern kkk#, HAT_A kern kkk#,
  else: "o" kern k#, hat_o kern k#, dot_o kern k#,
   "e" kern k#, "u" kern k#, dot_u kern k#, hat_u kern k#,
   "r" kern k#, "a" kern k#, hat_a kern k#,
   "A" kern kk#, HAT_A kern kk#, fi
 "K": "!"=:QAF, % new ligature---kerns from what follows
 QAF: "X": "O" kern k#, DOT_O kern k#,
  "C" kern k#, CHIM kern k#, "G" kern k#, GHAYN kern k#, CUP_G kern k#,
  "Q" kern k#;

ligtable "T": "!"=:TTA, % new ligature---kerns from what follows
  TTA: "y" kern if serifs: k# else: kk# fi, % remainder---kerns only
  "Y": "e" kern kk#, "o" kern kk#, hat_o kern kk#, dot_o kern kk#,
  "r" kern kk#, "a" kern kk#, hat_a kern kk#,
  "A" kern kk#, HAT_A kern kk#,
  "u" kern kk#, dot_u kern kk#, hat_u kern kk#;

ligtable "D": "="=:DHAL, "!"=:DAD, % new ligature---kerns from what follows
  "X" kern k#, "W" kern k#, "A" kern k#, HAT_A kern k#,
  "V" kern k#, "Y" kern k#;

ligtable "O": ":"=:DOT_O, % another new ligature in this group
  DOT_O: DHAL: DAD: % remainder---kerns only
  "X" kern k#, "W" kern k#, "A" kern k#, HAT_A kern k#,
  "V" kern k#, "Y" kern k#;

ligtable "c": ":"=:chim, % new ligature---kerns from what follows
  if serifs: "h" kern k#, hha kern k#, kha kern k#,
  "k" kern k#, qaf kern k#; fi
ligtable "h": "="=:kha, "!"=:hha,  % another new ligature in this group
  if serifs: "t" kern k#, tta kern k#, "u" kern k#, dot_u kern k#,
  "b" kern k#, "y" kern k#, "v" kern k#, "w" kern k#; fi
ligtable "n": "="=:gnaf,  % another new ligature in this group
  if serifs: "t" kern k#, tta kern k#,
  "u" kern k#, dot_u kern k#, hat_u kern k#,
  "b" kern k#, "y" kern k#, "v" kern k#, "w" kern k#; fi
if serifs: ligtable hha: kha: "m": gnaf: % remainder---kerns only
  "t" kern k#, "u" kern k#, dot_u kern k#, hat_u kern k#,
  "b" kern k#, "y" kern k#, "v" kern k#, "w" kern k#;
 ligtable chim:
  "h" kern k#, hha kern k#, kha kern k#,
  "k" kern k#, qaf kern k#; fi

ligtable "o": ":"=:dot_o, "="=:hat_o, %new ligature---kerns from what follows
  "e" kern -k#, "o" kern -k#, hat_o kern -k#, dot_o kern -k#, "x" kern k#,
  "d" kern -k#, dhal kern -k#, dad kern -k#,
  "c" kern -k#, chim kern -k#, "q" kern -k#,
 if serifs: "v" kern k#, "j" kern u#, else: "r" kern k#, fi
 "y" kern k#, "w" kern k#;
ligtable "a": "="=:hat_a,  % another new ligature in this group
 if serifs: "v" kern k#, "j" kern u#, else: "r" kern k#, fi
 "y" kern k#, "w" kern k#;
ligtable "t": "!"=:tta,  % another new ligature in this group
 "y" kern k#, "w" kern k#;
ligtable "u": ":"=:dot_u, "="=:hat_u,
 "w" kern k#;  % another new ligature in this group
ligtable hat_o: dot_o: "b": "p": % remainder---kerns only
  "e" kern -k#, "o" kern -k#, hat_o kern -k#, dot_o kern -k#, "x" kern k#,
  "d" kern -k#, dhal kern -k#, dad kern -k#,
  "c" kern -k#, chim kern -k#, "q" kern -k#,
 hat_a: if serifs: "v" kern k#, "j" kern u#, else: "r" kern k#, fi
 tta: "y" kern k#,
 dot_u: hat_u: "w" kern k#;

ligtable "A": "="=:HAT_A, % new ligature---kerns follow
 HAT_A: if serifs: "R": fi  % remainder---kerns only
 "t" kern k#, tta kern k#,
 "C" kern k#, CHIM kern k#,
 "O" kern k#, DOT_O kern k#,
 "G" kern k#, GHAYN kern k#, CUP_G kern k#,
 "U" kern k#, DOT_U kern k#, HAT_U kern k#, "Q" kern k#,
 "L": "T" kern kk#, TTA kern kk#,
 "Y" kern kk#, "V" kern kkk#, "W" kern kkk#;

ligtable "g": ":"=:ghayn, "="=:cup_g, % new ligature
 "j" kern -k#; % logjam (might happen in a foreign word.)
ligtable "I": ":"=:if use_pxl: oct"003" else: oct"0203" fi,
              "="=:if use_pxl: oct"045" else: oct"0245" fi, % new ligature
 "I" kern -k#; % Possible for ikinci Mehmed ?
ligtable oct"043": oct"100":   % kerns for ayn and hamza
  "A" kern kkk#, HAT_A kern kkk#,
  "a" kern k#, hat_a kern k#;
ligtable ".": "."=:if use_pxl: oct"0175" else: oct"0375" fi;
ligtable "f": % Turkish cannot use the ordinary ligatures for |"f"|.
  hat_i kern 3u#, dot_i kern 3u#, % and therefore needs these kerns
  oct"043" kern 3u#, oct"0100" kern 3u#;
fi
% ligatures for |"-"|, |"`"|, and |"'"| in the {\tt comlig} file
bye.