BSD 3 development
[unix-history] / usr / src / cmd / eqn / diacrit.c
# include "e.h"
# include "e.def"
diacrit(p1, type) int p1, type; {
int c, t, effps;
c = oalloc();
t = oalloc();
effps = EFFPS(ps);
nrwid(p1, effps, p1);
printf(".nr 10 %du\n", VERT(max(eht[p1]-ebase[p1]-6*ps,0))); /* vertical shift if high */
printf(".if \\n(ct>1 .nr 10 \\n(10+\\s%d.25m\\s0\n", effps);
printf(".nr %d \\s%d.1m\\s0\n", t, effps); /* horiz shift if high */
printf(".if \\n(ct>1 .nr %d \\s%d.15m\\s0\n", t, effps);
switch(type) {
case VEC:
printf(".ds %d \\v'-.4m'\\s%d\\(->\\s0\\v'.4m'\n", c, max(effps-3, 6));
break;
case DYAD:
printf(".ds %d \\v'-.4m'\\s%d\\z\\(<-\\(->\\s0\\v'.4m'\n", c, max(effps-3, 6));
break;
case HAT:
printf(".ds %d ^\n", c);
break;
case TILDE:
printf(".ds %d ~\n", c);
break;
case DOT:
printf(".ds %d \\s%d\\v'-.67m'.\\v'.67m'\\s0\n", c, effps);
break;
case DOTDOT:
printf(".ds %d \\s%d\\v'-.67m'..\\v'.67m\\s0'\n", c, effps);
break;
case BAR:
printf(".ds %d \\s%d\\v'.18m'\\h'.05m'\\l'\\n(%du-.1m\\(rn'\\h'.05m'\\v'-.18m'\\s0\n",
c, effps, p1);
break;
case UNDER:
printf(".ds %d \\l'\\n(%du\\(ul'\n", c, p1);
printf(".nr %d 0\n", t);
printf(".nr 10 0-%d\n", ebase[p1]);
break;
}
nrwid(c, ps, c);
if (lfont[p1] != ITAL)
printf(".nr %d 0\n", t);
printf(".as %d \\h'-\\n(%du-\\n(%du/2u+\\n(%du'\\v'0-\\n(10u'\\*(%d",
p1, p1, c, t, c);
printf("\\v'\\n(10u'\\h'-\\n(%du+\\n(%du/2u-\\n(%du'\n", c, p1, t);
/* BUG - should go to right end of widest */
if (type != UNDER)
eht[p1] += VERT( (6*ps*15) / 100); /* 0.15m */
if(dbg)printf(".\tdiacrit: %c over S%d, lf=%c, rf=%c, h=%d,b=%d\n",
type, p1, lfont[p1], rfont[p1], eht[p1], ebase[p1]);
ofree(c); ofree(t);
}