% Copyright 2003-2005 Han The Thanh <hanthethanh@gmx.net>.
% This file is part of vntex.  License: LPPL, version 1.3 or newer,
% according to http://www.latex-project.org/lppl.txt

% Computer Modern Roman upper case "A" precomposed glyphs:
% Inclusion:
%               A'      A`      A?      A~      A.
%       A(      A('     A(`     A(?     A(~     A(.
%       A^      A^'     A^`     A^?     A^~     A^.

begin_letter(a);
    set_letter_dimens(a)(
        13u#, cap_height#, 0,
        0,
        cap_serif_fit#, cap_serif_fit#
    );
    numeric left_stem, right_stem, outer_jut, alpha;
    right_stem = cap_stem - stem_corr;
    left_stem = min(cap_hair if hefty: -3stem_corr fi, right_stem);
    outer_jut = .8cap_jut;
    x1l = w - x4r = l + letter_fit + outer_jut + .5u;
    y1 = y4 = 0;
    x2 - x1 = x4 - x3;
    x3r = x2r + apex_corr;
    y2 = y3 = h+apex_o + apex_oo;
    alpha = diag_ratio(2, left_stem, y2 - y1, x4r - x1l - apex_corr);
    penpos1(alpha*left_stem, 0);
    penpos2(alpha*left_stem, 0);
    penpos3(alpha*right_stem, 0);
    penpos4(alpha*right_stem, 0);
    z0 = whatever[z1r, z2r] = whatever[z3l, z4l];
    if y0 < h-cap_notch_cut: y0 := h - cap_notch_cut;
        fill z0 + .5right{down} ... {z4 - z3}diag_end(3l, 4l, 1, 1, 4r, 3r)
        -- diag_end(4r, 3r, 1, 1, 2l, 1l) -- diag_end(2l, 1l, 1, 1, 1r, 2r){z2 - z1}
        ... {up}z0 + .5left -- cycle; % left and right diagonals
    else: fill z0 -- diag_end(0, 4l, 1, 1, 4r, 3r) -- diag_end(4r, 3r, 1, 1, 2l, 1l)
        -- diag_end(2l, 1l, 1, 1, 1r, 0) -- cycle;
    fi % left and right diagonals
    penpos5(whatever, angle(z2 - z1));
    z5 = whatever[z1, z2];
    penpos6(whatever, angle(z3 - z4));
    z6 = whatever[z3, z4];
    y6 = y5;
    if hefty: y5r else: y5 fi =5/12y0;
    y5r - y5l = y6r - y6l = cap_band;
    penstroke z5e -- z6e; % bar line
    if serifs: numeric inner_jut;
        pickup tiny.nib;
        prime_points_inside(1, 2);
        prime_points_inside(4, 3);
        if rt x1'r + cap_jut + .5u + 1<=lft x4'l - cap_jut: inner_jut = cap_jut;
        else: rt x1'r + inner_jut + .5u + 1=lft x4'l - inner_jut;
        fi
        dish_serif(1', 2, a, 1/2, outer_jut, b, .6, inner_jut)(dark);  % left serif
        dish_serif(4', 3, c, 1/2, inner_jut, d, 1/3, outer_jut);
        set_letter_join(a, max(x2, x3), 6.5u#);
    else:
        set_letter_join(a, x0, 6.5u#);
    fi  % right serif
    penlabels(0, 1, 2, 3, 4, 5, 6);
end_pic;

input vnacomp;

endinput;
