% This file is part of the TeluguTeX Software Package.
%Copyright (c) 1991 Lakshmankumar Mukkavilli
%
%The TeluguTeX Software Package is distributed in the hope that
%it will be useful,but WITHOUT ANY WARRANTY.  No author or distributor
%accepts responsibility to anyone for the consequences of using it
%or for whether it serves any particular purpose or works at all,
%unless he says so in writing.  Refer to the TeluguTeX Software Package
%General Public License for full details.
%
%Everyone is granted permission to copy, modify and redistribute
%the TeluguTeX Software Package, but only under the conditions described in the
%TeluguTeX Software Package General Public License.   A copy of this license is
%supposed to have been given to you along with TeluguTeX Software Package so you
%can know your rights and responsibilities.  It should be in a
%file named CopyrightLong.  Among other things, the copyright notice
%and this notice must be preserved on all copies.  
%%%%%
%  This file contains code to generate roman digits,
%   telugu digits and punctuation symbols
% --------- start of roman digits ------------
stest(drzero); telchar "Roman digit zero";
begintchar(dr_zero_code,7u#,fig_height#,0,0,0,ur#);
top z1=(w/2,h); lft z2=(0,1/2h);
bot z3=(w/2,0); rt z4=(w,1/2h);
sketch superellipse(z4,z1,z2,z3,0.707);
endtchar; etest;

stest(drone); telchar "Roman digit one";
begintchar(dr_one_code,4u#,fig_height#,0,0,0,ur#);
bot lft z1=(0,0); bot rt z2=(w,0); top z3=(x5,h);
lft z4=(x1,x_height+uh); bot z5=1/2[z1,z2];
sketch z1--z2; sketch z3--z5;
sketch z4..{up}z3;
endtchar; etest;

stest(drtwo); telchar "Roman digit two";
begintchar(dr_two_code,7u#,fig_height#,0,0,0,ur#);
bot lft z1=(0,0); bot rt z2=(w,0); lft z3=(0,x_height);
top z4=(w/2,h); rt z5=(w,y3);
sketch z1--z2; sketch z3..z4..z5..{-1,-1}z1;
endtchar; etest;

stest(drthree); telchar "Roman digit three";
begintchar(dr_three_code,7u#,fig_height#,0,0,0,ur#);
path pa; 
top lft z1=(0,3/4h); top z2=(w/2,h);
rt z3=(w,y1); z4=(w/2-u,1/2h);
pa= z1..z2..z3..{(-1,0)}z4; 
sketch pa; sketch pa  reflectedabout (z4,(w,y4));
endtchar; etest;

stest(drfour); telchar "Roman digit four";
begintchar(dr_four_code,7u#,fig_height#,0,0,0,ur#);
bot z1=(w-1.5u,0); top z2=(x1,h);
lft z3=(0,w_height); rt z4=(w,y3);
bot z1a=(x1-(x4-x1),0); bot z1b=(x4,0);
sketch z1a--z1b; sketch z1--z2;
sketch z3--z2; sketch z3--z4;
penlabels(1a,1b);
endtchar; etest;

stest(drfive); telchar "Roman digit five";
begintchar(dr_five_code,7u#,fig_height#,0,0,0,ur#);
top rt z1=(w,h); top lft z2=(0,h); lft z3=(0,6/10h);
z4=(1/2w,y3+uh); rt z5=(w,(y4+y6)/2); bot z6=(x4,0); lft z7=(0,1/4h);
sketch z1--z2; sketch z2--z3; 
sketch z3..z4..z5..z6..z7;
endtchar; etest;

stest(drsix); telchar "Roman digit six";
begintchar(dr_six_code,6u#,fig_height#,0,0,0,ur#);
dr_sixnine_form;
sketch dr_sixnine_p;
endtchar; etest;

stest(drseven); telchar "Roman digit seven";
begintchar(dr_seven_code,7u#,fig_height#,0,0,0,ur#);
top lft z1=(0,h); top rt z3=(w,h);
bot z4=(1/4w,0);
sketch z1--z3{(-1,-1)}..{down}z4;
endtchar; etest;

stest(dreight); telchar "Roman digit eight";
begintchar(dr_eight_code,7u#,fig_height#,0,0,0,ur#);
top z1=(w/2,h); z2=(x1,0.6h);
bot z3=(x1,0); lft z4=(0,y2/2); rt z5=(w,y4);
z6=(x4+u,1/2(y1+y2)); z7=(w-u,y6);
sketch superellipse(z7,z1,z6,z2,0.707);
sketch superellipse(z5,z2,z4,z3,0.707);
endtchar; etest;

stest(drnine); telchar "Roman digit nine";
begintchar(dr_nine_code,6u#,fig_height#,0,0,0,ur#);
dr_sixnine_form;
bot lft z10 = z1;
sketch dr_sixnine_p rotatedaround(z10,-180) shifted(-w,-h);
endtchar; etest;

%---------------------end of roman digits------------------------

% ------------- start of telugu digits ------------

stest(dtzero); telchar "telugu digit zero";
begintchar(dt_zero_code,tfig_width#,tfig_height#,0,0,0,ur#);
top z1=(w/2,h); lft z2=(0,h/2); bot z3=(x1,0); rt z4=(w,y2);
sketch superellipse(z4,z1,z2,z3,0.707);
endtchar; etest;

stest(dtone); telchar "telugu digit one";
begintchar(dt_one_code,tfig_width#+u#,tfig_height#,0,0,0,ur#);
bot z1=(w/5,0);  lft z2=(0,h/2);  top z3=(w/2,h);
rt z4=(w,h/2);  bot z5=(w-(w/5),0);
sketch z1..z2..z3..z4..z5;
endtchar; etest;

stest(dttwo); telchar "telugu digit two";
begintchar(dt_two_code,tfig_width#,tfig_height#,0,0,0,ur#);
z1=(3w/5,5h/6);  z2=(x1,4h/6);  z3=(w/2,y1);
top z4=(x1,h);  z5=((x8+x1)/2,y3);  bot z6=(x1,0);
bot lft z7=(0,0);rt z8=(w,h/2);
sketch z1..z2..z3..z4..z8..{(-1,0)}z6--z7;
endtchar; etest;


stest(dtthree); telchar "telugu digit three";
begintchar(dt_three_code,tfig_width#-2u#,tfig_height#,0,0,0,ur#);
path pa;
lft z1=(0,4h/5);  top z2=(w/2,h);  top z3=(4w/5,h);
rt z4=(w,3h/4);  z5=(3w/4,h/2);  z6=(w/3,h/2);
pa= z1..z2..z3..z4..z5;
sketch pa; sketch pa  reflectedabout(z5,z6);
sketch z5--z6;
endtchar; etest;

stest(dtfour); telchar "telugu digit four";
begintchar(dt_four_code,tfig_width#-u#,tfig_height#,0,0,0,ur#);
top z1=(w/5,h);  lft z2=(0,2h/3);  z4=(w/2,h/3);
bot z5=(x4,0);  z3=(w/3,1/2(y4+y5));
forsuffixes s=6,7,8:
    z.s=z.[s-5] reflectedabout(z4,z5); endfor;
sketch z1..z2..z4..z7..z6;
sketch z4..z3..z5..z8..z4;
endtchar; etest;

stest(dtfive); telchar "telugu digit five";
begintchar(dt_five_code,tfig_width#+u#,tfig_height#,0,0,0,ur#);
lft z1=(0,8h/10);  lft z2=(0,3h/10);  z3=(2w/3,(y1+y2)/2);
top z11=(w/3,h); z12 = z11 reflectedabout ((0,y3),(w,y3));
sketch z1..z11..z3..z12..z2;
top z4=(x3+(w-x3)/2,h); 
rt z5=(w,(y3+y4)/2); 
bot z7=(x4,0);  rt z8=(x9,y9-uh); rt z9=(w,y2);
sketch z3..z5..z4..z3..z7..z8..z9;
endtchar; etest;
  
stest(dtsix); telchar "telugu digit six";
begintchar(dt_six_code,tfig_width#,tfig_height#,0,0,0,ur#);
dt_six_form;
sketch dt_six_pa; sketch dt_six_pb;
endtchar; etest;
  
stest(dtseven); telchar "telugu digit seven";
begintchar(dt_seven_code,tfig_width#-2u#,tfig_height#,0,0,0,ur#);
lft z1=(0,3h/4);  top z2=(w/2,h);  rt z3=(w,y1);  z4=(w/2,h/2);
forsuffixes i=6,7,8:
   z.i=z.[i-5] rotatedaround (z4,180);
endfor;
sketch z1..z2..z3..z4..z8..z7..z6;
endtchar; etest;


stest(dteight); telchar "telugu digit eight";
begintchar(dt_eight_code,tfig_width#+u#,tfig_height#,0,0,0,ur#);
z2=(1.5u,w/2); lft z7=(0,(y2+y3)/2);
bot z3=(w/4,0);  z4=z2+(3(x3-x2),0);
top z5=(x3,h); top rt z6=(w,h);
sketch z2..z7..z3..z4..z5 & z5--z6;
endtchar; etest;

stest(dtnine); telchar "telugu digit nine";
begintchar(dt_nine_code,tfig_width#,tfig_height#,0,0,0,ur#);
dt_six_form;
sketch dt_six_pa reflectedabout((0,0),(w,0)) shifted (0,h);
sketch dt_six_pb reflectedabout((0,0),(w,0)) shifted (0,h);
endtchar; etest;

% end of telugu digits

% --------- start of punctuation ----------

stest(pperiod); telchar "punctuation period";
begintchar(p_period_code,2*dot_radius#,2*dot_radius#,0,0,0,ur#);
z1=(dot_radius,dot_radius);
fill_dot(1);
endtchar; etest;
  
stest(pcomma); telchar "punctuation comma";
begintchar(p_comma_code, p_comma_width#,2*dot_radius#,des_depth#,0,0,ur#);
p_comma_form;
endtchar; etest;

stest(pequal); telchar "punctuation equal";
begintchar(p_equal_code,10u#,3/4x_height#,0,0,0,ur#);
top lft z1=(0,h); top rt z2=(w,h);
bot lft z3=(0,1/4x_height); bot rt z4=(w,1/4x_height);
sketch z1--z2;  sketch z3--z4;
endtchar; etest;

stest(pbar); telchar "punctuation vertical bar";
begintchar(p_bar_code,u#,x_height#,0,0,0,ur#);
p_bar_form;
sketch p_bar_p;
endtchar; etest;

stest(pdbar); telchar "punctuation double bar";
begintchar(p_dbar_code,2.5u#,x_height#,0,0,0,ur#);
p_bar_form;
sketch p_bar_p;sketch p_bar_p reflectedabout ((w/2,0),(w/2,h));
endtchar; etest;

stest(pcolon); telchar "punctuation colon";
begintchar(p_colon_code,2*dot_radius#,x_height#,0,0,0,ur#);
z1=(dot_radius,dot_radius);
fill_dot(1);
z2=(x1,x_height-dot_radius);
fill_dot(2);
endtchar; etest;

stest(pscolon); telchar "punctuation semicolon";
begintchar(p_scolon_code,p_comma_width#,x_height#,des_depth#,0,0,ur#);
p_comma_form;
z5=(x1,x_height-dot_radius);
fill_dot(5);
endtchar; etest;

stest(pcquote); telchar "punctuation closing quote";
begintchar(p_cquote_code,p_comma_width#,asc_height#,0,0,0,ur#);
p_comma_form;
erase fill fill_dot_p; erase sketch p_comma_p;
fill fill_dot_p  shifted (0,asc_height-2*dot_radius);
sketch p_comma_p  shifted (0,asc_height-2*dot_radius);
endtchar; etest;

stest(pcquotes); telchar "punctuation closing quotes";
begintchar(p_cquotes_code,2*p_comma_width#+u#,asc_height#,0,0,0,ur#);
p_comma_form;
erase fill fill_dot_p; erase sketch p_comma_p;
fill fill_dot_p  shifted (0,asc_height-2*dot_radius);
sketch p_comma_p  shifted (0,asc_height-2*dot_radius);
fill fill_dot_p  shifted (0,asc_height-2*dot_radius)
                                  shifted (p_comma_width+u,0);
sketch p_comma_p  shifted (0,asc_height-2*dot_radius)
                                  shifted (p_comma_width+u,0);
endtchar; etest;

stest(poquote); telchar "punctuation opening quote";
begintchar(p_oquote_code,p_comma_width#,asc_height#,0,0,0,ur#);
p_comma_form;
erase fill fill_dot_p; erase sketch p_comma_p;
lft z5 = z2;
top rt z6 =z3;
fill fill_dot_p rotatedaround (z5,-180) shifted(-x5,asc_height-abs(y6));
sketch p_comma_p rotatedaround (z5,-180) shifted(-x5,asc_height-abs(y6));
endtchar; etest;

stest(poquotes); telchar "punctuation opening quotes";
begintchar(p_oquotes_code,2*p_comma_width#+u#,asc_height#,0,0,0,ur#);
p_comma_form;
erase fill fill_dot_p; erase sketch p_comma_p;
lft z5 = z2;
top rt z6 =z3;
fill fill_dot_p rotatedaround (z5,-180) shifted(-x5,asc_height-abs(y6));
sketch p_comma_p rotatedaround (z5,-180) shifted(-x5,asc_height-abs(y6));
fill fill_dot_p rotatedaround (z5,-180) shifted(-x5,asc_height-abs(y6))
                                      shifted(p_comma_width+u,0);
sketch p_comma_p rotatedaround (z5,-180) shifted(-x5,asc_height-abs(y6))
                                      shifted(p_comma_width+u,0);
endtchar; etest;

stest(pdquotes);telchar "punctuation double quotes";
begintchar(p_dquotes_code,4.5u#,asc_height#,0,0,0,ur#);
top lft z1=(1.5u,h); bot lft z2=(0,x_height);
top rt z3=(w,h);  bot rt z4=(x1+1.5u,x_height);
sketch z1--z2; sketch z3--z4;
endtchar; etest;

%stest(pdquotes);telchar "punctuation double quotes";
%begintchar(p_dquotes_code,2*dot_radius#+u#,asc_height#,0,0,0,ur#);
%%begintchar(p_dquotes_code,4*dot_radius#+u#,asc_height#,0,0,0,ur#);
%path pa;
%%z1=(dot_radius,h-dot_radius);z1l=(0,y1);z1r=(2x1,y1);z1t=(x1,h);
%z1=(dot_radius/2,h-dot_radius/2);z1l=(0,y1);z1r=(2x1,y1);z1t=(x1,h);
%z2=(x1,x_height);
%%z2=(x1,x_height);z2l=(dot_radius/2,y2);z2r=(x2+(x2-x2l),y2);
%%pa= z2l--z1l & flex(z1l,z1t,z1r) & z1r--z2r--cycle; fill pa;
%pa= z2--z1l & flex(z1l,z1t,z1r) & z1r--z2--cycle; filldraw pa;
%filldraw pa  shifted(dot_radius+u,0);
%%fill pa  shifted(2dot_radius+u,0);
%endtchar; etest;

stest(pslash); telchar "punctuation virgule (slash)";
begintchar(p_slash_code,6u#,asc_height#,des_depth#,0,0,ur#);
p_slash_form;
sketch p_slash_p;
endtchar; etest;

stest(phash); telchar "punctuation hash mark (number sign)";
begintchar(p_hash_code,12u#,asc_height#,des_depth#,0,0,ur#);
numeric midpoint;
midpoint = (-des_depth+asc_height)/2;
lft z1=(0,midpoint+2u); rt z2=(w,y1);
lft z3=(0,midpoint-2u); rt z4=(w,y3);
bot z5=(2u,-d); top z6=(x5+4u,h);
z7=(x5+4u,y5); z8=(x7+4u,y6);
sketch z1--z2; sketch z3--z4;
sketch z5--z6; sketch z7--z8;
endtchar; etest;

%stest(pexcla); telchar "punctuation exclamation point";
%begintchar(p_excla_code,dot_radius#,asc_height#,0,0,0,ur#);
%pickup pencircle;
%z1=(dot_radius/2,dot_radius/2);  
%filldraw fullcircle scaled 2x1 shifted z1;
%z2=(x1,5*y1); z3 =(x1,h-y1);
%z2l=(x1-dot_radius/4,y2); z2r=(x1+dot_radius/4,y2);
%z3l=(0,y3);  z3r=(x1+dot_radius/2,y3);  z3t=(x1,h);
%filldraw z2l--z3l & flex(z3l,z3t,z3r) & z3r--z2r--cycle;
%endtchar; etest;

stest(pexcla); telchar "punctuation exclamation point";
begintchar(p_excla_code,dot_radius#,asc_height#,0,0,0,ur#);
z1=(dot_radius,dot_radius);  
fill_dot(1);
fill fullcircle scaled 2x1 shifted z1;
top z2=(x1,h); bot z3 =(x1,4*y1);
sketch z2--z3;
endtchar; etest;

stest(pasterisk); telchar "punctuation asterisk";
begintchar(p_asterisk_code,x_height#,x_height#,0,0,0,ur#);
z1=(1/2w,1/2h);
   for d=30 step 60 until 330:
   z[d]=z1+0.5 dir d xscaled w yscaled h;
   sketch z1--z[d];
   penlabels(z[d]);
   endfor;
endtchar; etest;

stest(pplus); telchar "punctuation plus";
begintchar(p_plus_code,x_height#,x_height#,0,0,0,ur#);
lft z1=(0,h/2);  rt z2=(w,y1);  top z3=(w/2,h);  bot z4=(x3,0);
sketch z1--z2;  sketch z3--z4;
endtchar; etest;


stest(plbracket); telchar "punctuation left bracket";
begintchar(p_lbracket_code,3u#,top_height#,bot_depth#,0,0,ur#);
p_lbracket_form;
sketch p_lbracket_p;
endtchar; etest;

stest(prbracket); telchar "punctuation right bracket";
begintchar(p_rbracket_code,3u#,top_height#,bot_depth#,0,0,ur#);
p_lbracket_form;
sketch p_lbracket_p shifted (-w,0) reflectedabout ((0,0),(0,h));
endtchar; etest;

stest(plparen); telchar "punctuation left parenthesis";
begintchar(p_lparen_code,3u#,top_height#,bot_depth#,0,0,ur#);
p_rparen_form;
sketch p_rparen_p shifted (-w,0) reflectedabout ((0,0),(0,h));
endtchar; etest;

stest(prparen); telchar "punctuation right parenthesis";
begintchar(p_rparen_code,3u#,top_height#,bot_depth#,0,0,ur#);
p_rparen_form;
sketch p_rparen_p;
endtchar; etest;

stest(plbrace); telchar "punctuation left brace";
begintchar(p_lbrace_code,4u#,top_height#,bot_depth#,0,0,ur#);
p_lbrace_form;
sketch p_lbrace_p;
endtchar; etest;

stest(prbrace); telchar "punctuation right brace";
begintchar(p_rbrace_code,4u#,top_height#,bot_depth#,0,0,ur#);
p_lbrace_form;
 sketch (p_lbrace_p shifted (-w,0) reflectedabout ((0,0),(0,h)) );
endtchar; etest;

stest(ppercent); telchar "punctuation percent sign";
begintchar(p_percent_code,6u#,asc_height#,des_depth#,0,0,ur#);
p_slash_form;
sketch p_slash_p;
z3=(3(x1+x2)/8,-d+7/8(h+d)); 
z4=(w-x3,-d+(h-y3));
sketch fullcircle scaled (1.5u) shifted z3;
sketch fullcircle scaled (1.5u) shifted z4;
endtchar; etest;

stest(pbslash); telchar "punctuation backslash";
begintchar(p_bslash_code,6u#,asc_height#,des_depth#,0,0,ur#);
p_slash_form;
sketch p_slash_p reflectedabout ((w/2,h),(w/2,0));
endtchar; etest;

stest(plbar); telchar "punctuation long bar";
begintchar(p_lbar_code,u#,asc_height#,des_depth#,0,0,ur#);
top z1=(w/2,h);  bot z2=(x1,-d);
sketch z1--z2;
endtchar; etest;

stest(phyphen); telchar "punctuation hyphen";
begintchar(p_hyphen_code,6u#,1/2x_height#,0,0,0,ur#);
top lft z1=(0,h);  top rt z2=(w,h);
sketch z1--z2;
endtchar; etest;

stest(plhyphen); telchar "punctuation long hyphen";
begintchar(p_lhyphen_code,9u#,1/2x_height#,0,0,0,ur#);
top lft z1=(0,h);  top rt z2=(w,h);
sketch z1--z2;
endtchar; etest;

stest(pvlhyphen); telchar "punctuation very long hyphen";
begintchar(p_vlhyphen_code,15u#,1/2x_height#,0,0,0,ur#);
top lft z1=(0,h);  top rt z2=(w,h);
sketch z1--z2;
endtchar; etest;

stest(pubar); telchar "punctuation underbar";
begintchar(p_ubar_code,x_height#,0,uh#,0,0,ur#);
bot lft z1=(0,-d);  bot rt z2=(w,-d);
sketch z1--z2;
endtchar;  etest;

stest(pquestion); telchar "punctuation question mark";
begintchar(p_question_code,6u#,asc_height#,0,0,0,ur#);
lft z1=(0,h-2dot_radius); top z2=(w/2,h);
rt z3=(w,y1); z4=(x2,1/2x_height);
z5=(x2,1/3(y2+y4));  z6=(x2,dot_radius);fill_dot(6);
sketch z1..z2..z3..z5..tension 1.5..z4;
endtchar; etest;

stest(pdollar); telchar "punctuation dollar sign";
begintchar(p_dollar_code,cb_ka_width#,x_height#+1.5uh#,1.5uh#,0,0,ur#);
cb_ka_form;
sketch z1..z2..z3..z4..z5..z6..z7;
top z11 = (w/2,h); bot z12 = (w/2,-d);
sketch z11--z12;
endtchar; etest;

stest(pgreater); telchar "punctuation greater than";
begintchar(p_greater_code,7u#,x_height#,0,0,0,ur#);
bot lft z1=(0,0);  top lft z2=(0,x_height);  rt z3=(w,1/2(y1+y2));
sketch z1--z3;  sketch z2--z3;
endtchar; etest;

stest(pless); telchar "punctuation less than";
begintchar(p_less_code,7u#,x_height#,0,0,0,ur#);
bot rt z1=(w,0);  top rt z2=(w,x_height);  lft z3=(0,1/2(y1+y2));
sketch z1--z3;  sketch z2--z3;
endtchar; etest;

stest(pat); telchar "punctuation at sign";
begintchar(p_at_code,10u#,asc_height#,0,0,0,ur#);
z1=(w/2,3/4h);  z2=(1/5w,1/2h);
z3=(x1,1/4h);   z4=(4/5w,5/8h);
z5=(4/5w,3/8h); z6=(9/10w,y3);
rt z7=(w,y2); top z8=(x1,h);
lft z9=(0,y2);   bot z10=(x1,0);   rt z11=(x7,1/8h);
sketch z5..z3..z2..z1..z4&z4--z5& z5..z6..z7{up}..{left}z8..z9..z10..z11;
endtchar; etest;

stest(ptilde); telchar "punctuation tilde sign";
begintchar(p_tilde_code,9u#,asc_height#,0,0,0,ur#);
top lft z1=(0,asc_height2); top z2=(w/3,h); 
z3=(2/3w,y1); top rt z4=(w,y2);
sketch z1..z2..z3..z4;
endtchar; etest;

stest(phat); telchar "punctuation circumflex(hat)";
begintchar(p_hat_code,5u#,asc_height#,0,0,0,ur#);
lft z1=(0,asc_height1);  rt z2=(w,y1);  top z3=(1/2(x1+x2),h);
sketch z1--z3;  sketch z3--z2;
endtchar;  etest;

stest(pampersand); telchar "punctuation ampersand";
begintchar(p_ampersand_code,11u#,asc_height#,0,0,0,ur#);
rt z11=(w,1/4x_height);  bot z10=(3/4w,0);
z1=(x10+u,x_height); y1a=y1; x1-x1a=w-x1; rt z1b=(w,x_height);
bot z2=(w/4,0);lft z3=(0,y11);   z4=(w/8,1/2x_height+uh);
z5=(x2,3/4x_height);   z6=(w/2,asc_height1);
top z7=(5/12w,h);  z8=(5/24w,y6);  %z9=(x7,1/2x_height);
sketch z1a--z1b;  
sketch z1..{left}z2..z3..z4..z5..z6..z7..z8..z5..z10..z11;
penlabels (1a,1b);
endtchar; etest;

% ---------------- end of punctuation ------------