% Computer Modern Roman Caps and Small Caps
% Completely rebuildt for Sauter-2.3 version. 
% Now truely supports the ams extracm fonts cmcsc8 and cmcsc9.
% Sauter-2.3b: Bugs for design_sizes \ge 10 fixed
% Changes[Sauter-2.4] Bug in lower.comma_depth for design_sizes \ge 10 fixed;

if unknown cmbase: input cmbase fi

font_identifier:="CMCSC"; font_size design_size * pt#;

% first come parameters used to set the uppercase letters
% (including some for lowercase that aren't actually used)
% These parameters are nearly the same as the Computer Modern Roman
% parameters.

input c-cmr;

% cmcsc8 is 18, cmcsc9 is 19, cmcsc10 is 21.
u#:=                      % unit width
  (if design_size < 9:
     (u#*36 - 0.5*design_size + 5)
   elseif design_size < 10:
     (u#*36 + 0.5*(design_size - 8))
   else:
     ((u#*36) + (design_size/10))
   fi) / 36*pt#;

% cmcsc8 is 2.5, cmcsc9 is 3.5, cmcsc10 is 5.
letter_fit#:=             % extra space added to all sidebars
  (if design_size < 8:
     (letter_fit# * 36  + 2.5)
   elseif design_size < 9:
     ((design_size - 8)  + 2.5) 
   elseif design_size < 10:
     (1.5 * design_size -10)
   else:
     ((letter_fit#*36) + (design_size *0.5))
   fi) / 36*pt#;

ligs:=1;                  % level of ligatures to be included

% now come replacements used to set the lowercase caps

lower.u#:=                % unit width
    (if design_size < 10:
       (1.5*design_size + 1)
     else:
        (u#*36*16/21)
     fi) / 36*pt#;

lower.width_adj#:=        % width adjustment for certain characters
    width_adj#;

% cmsc8 is 2.7, cmcsc9 is 3.4, cmsc10 is 4.
lower.cap_serif_fit#:=    % extra sidebar near uppercase serifs
  (if design_size < 9:
     ((design_size - 8) * 0.7 + 2.7)
   elseif design_size < 10:
     (0.6*design_size -2)
   else:
     (cap_serif_fit# * 36 * 4)/5
   fi) / 36*pt#;

% cmsc8 is 4, cmcsc9 is 3.5, cmsc10 is 2.4.
lower.letter_fit#:=       % extra space added to all sidebars
  (if design_size <= 9:
     ( -(design_size - 8)/2 + 4)
   elseif design_size < 10:
     (-1.1*design_size + 13.4)
   else:
    (letter_fit# * 36 * 12) / 25
   fi) / 36*pt#;


lower.body_height#:=      % height of tallest characters
  (if design_size < 10:
     (27*design_size -70)
   else:
    (body_height#*36*20/27)
   fi) /36*pt#;

% cmsc8 is 145.8, cmcsc9 is 170.4, cmsc10 is 185.
lower.cap_height#:=       % height of caps
  (if design_size < 9:
     (24.6*design_size - 51)
   elseif design_size < 10:
     (14.6*design_size + 39)
   else:
    ((cap_height#*36*18.5)/24.6)
   fi) / 36*pt#;

lower.x_height#:=         % height of lowercase without ascenders
    if design_size < 10:
      (15.5*design_size - 39)/36pt#;
    else:
      (x_height#*116)/(155);
    fi;

lower.bar_height#:=       % height of crossbar in lowercase e
    (if design_size < 10:
       (8.7*design_size - 22)
     else:
       (bar_height#*36*65)/87
     fi) / 36*pt#;

% cmsc8 is 38, cmcsc9 is 45, cmsc10 is 52.
lower.comma_depth#:=      % depth of comma below baseline
    (if design_size < 10:
        ((design_size - 8) * 7 + 38)
     else:
        (comma_depth#*36*52)/70
     fi) / 36*pt#;

lower.flare#:=            % diameter of bulbs or breadth of terminals
    (if design_size < 9:
       (2*design_size + 4)
     elseif design_size < 10:
       (3*design_size -5)
     else:
       (flare#*36*25)/33
     fi) / 36*pt#;

lower.cap_hair#:=         % uppercase hairline breadth
    (if design_size < 10:
       (0.5*design_size + 4.1)
     else:
       (cap_hair#*36*91)/110
     fi) / 36*pt#;

lower.stem#:=             % lowercase stem breadth
     (if design_size < 10:
        (2*design_size + 1)
      else:   
        (stem#*36*21)/25
      fi) / 36*pt#;

% cmcsc8 is 21, cmcsc9 is 23.5, cmcsc10 is 26.
lower.cap_stem#:=         % uppercase stem breadth
    (if design_size < 10:
        (2.5*design_size + 1)
     else:
        (cap_stem#*36*13)/16
     fi) / 36*pt#;
 
lower.cap_curve#:=        % uppercase curve breadth
    (if design_size < 10:
        (3*design_size + 1)
     else:
        (cap_curve#*36*31)/37
     fi) / 36*pt#;

lower.cap_ess#:=          % breadth in middle of uppercase s
    (if design_size < 10:
        (4*design_size -12)
     else:
         (cap_ess#*36*4)/5
     fi) / 36*pt#;

lower.cap_jut#:=          % protrusion of uppercase serifs
    (if design_size < 10:
         (3*design_size - 4)
     else:
         (cap_jut#*36*26)/37
     fi) / 36*pt#;

lower.beak_jut#:=         % horizontal protrusion of beak serifs
    (if design_size < 10:
         (0.8*design_size - 1)
     else:
         (beak_jut#*36*7)/10
     fi) / 36*pt#;

lower.beak#:=             % vertical protrusion of beak serifs
    (if design_size < 10:
         (7*design_size - 18)
     else:
         (beak#*36*52)/70
     fi) / 36*pt#;

lower.slab#:=             % serif and arm thickness
    (if design_size < 10:
         (0.5*design_size + 4.1)
     else:
         (slab#*36*91)/110
     fi) / 36*pt#;

lower.cap_bar#:=          % uppercase bar thickness
    (if design_size < 10:
         (0.5*design_size + 4.1)
     else:
         (cap_bar#*36*91)/110
     fi) / 36*pt#;

lower.cap_band#:=         % uppercase thickness above/below lobes
    (if design_size < 10:
         (0.5*design_size + 4.1)
     else:
        (cap_band#*36*91)/110
     fi) / 36*pt#;

lower.cap_notch_cut#:=    % max breadth above/below uppercase notches
    cap_notch_cut#;

lower.o#:=                % amount of overshoot for curves
    (if design_size < 10:
        0.5*design_size
     else:
        (o#*36*5)/8
    fi) / 36*pt#;

lower.apex_o#:=           % amount of overshoot for diagonal junctions
     (if design_size < 9:
         3
      elseif design_size < 10:
         (design_size -6)
      else:
         (apex_o#*36*0.5) 
      fi) / 36*pt#;

lower.fudge:=             % factor applied to weights of heavy characters
    fudge;

generate csc      % switch to the driver file

