diacrit.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #include "e.h"
  2. #include "y.tab.h"
  3. extern double Dvshift, Dhshift, Dh2shift, Dheight, Barv, Barh, Ubarv, Ubarh;
  4. void diacrit(int p1, int type)
  5. {
  6. int c, t;
  7. c = salloc();
  8. t = salloc();
  9. nrwid(p1, ps, p1);
  10. printf(".nr 10 %gm\n", max(REL(eht[p1]-ebase[p1]-1,ps), 0)); /* vert shift if high */
  11. if (type == HIGHBAR)
  12. printf(".nr 10 \\n(10+%gm\n", Dvshift);
  13. else if (type == LOWBAR)
  14. printf(".nr 10 0\n");
  15. else
  16. printf(".if \\n(ct>1 .nr 10 \\n(10+%gm\n", Dvshift);
  17. printf(".nr %d %gm\n", t, Dhshift); /* horiz shift if high */
  18. printf(".if \\n(ct>1 .nr %d %gm\n", t, Dh2shift); /* was .1 and .15 */
  19. switch (type) {
  20. case VEC:
  21. printf(".ds %d %s\n", c, lookup(deftbl, "vec_def")->cval);
  22. break;
  23. case DYAD:
  24. printf(".ds %d %s\n", c, lookup(deftbl, "dyad_def")->cval);
  25. break;
  26. case HAT:
  27. printf(".ds %d %s\n", c, lookup(deftbl, "hat_def")->cval);
  28. break;
  29. case TILDE:
  30. printf(".ds %d %s\n", c, lookup(deftbl, "tilde_def")->cval);
  31. break;
  32. case DOT:
  33. printf(".ds %d %s\n", c, lookup(deftbl, "dot_def")->cval);
  34. break;
  35. case DOTDOT:
  36. printf(".ds %d %s\n", c, lookup(deftbl, "dotdot_def")->cval);
  37. break;
  38. case BAR:
  39. case LOWBAR:
  40. case HIGHBAR:
  41. printf(".ds %d \\v'%gm'\\h'%gm'\\l'\\n(%du-%gm'\\h'%gm'\\v'%gm'\n",
  42. c, -Barv, Barh, p1, 2*Barh, Barh, Barv);
  43. break;
  44. case UNDER:
  45. printf(".ds %d \\v'%gm'\\l'\\n(%du-%gm\\(ul'\\h'%gm'\\v'%gm'\n",
  46. c, -Ubarv, p1, Ubarh, Ubarh, Ubarv);
  47. /* printf(".ds %d \\v'-%gm'\\l'\\n(%du\\(ul'\\v'%gm'\n",
  48. c, Ubarv, p1, Ubarv);
  49. */
  50. printf(".nr %d 0\n", t);
  51. printf(".nr 10 0-.1m-%gm\n", REL(ebase[p1],ps));
  52. printf(".if \\n(ct%%2=1 .nr 10 0\\n(10-.1m\n");
  53. break;
  54. case UTILDE:
  55. printf(".ds %d %s\n", c, lookup(deftbl, "utilde_def")->cval);
  56. printf(".nr %d 0\n", t);
  57. printf(".nr 10 0-%gm\n", REL(ebase[p1],ps));
  58. printf(".if \\n(ct%%2=1 .nr 10 0\\n(10-%gm\n", 0.1);
  59. break;
  60. }
  61. nrwid(c, ps, c);
  62. if (lfont[p1] != ITAL)
  63. printf(".nr %d 0\n", t);
  64. printf(".as %d \\h'-\\n(%du-\\n(%du/2u+\\n(%du'\\v'0-\\n(10u'\\*(%d",
  65. p1, p1, c, t, c);
  66. printf("\\v'\\n(10u'\\h'-\\n(%du+\\n(%du/2u-\\n(%du'\n", c, p1, t);
  67. if (type != UNDER && type != UTILDE)
  68. eht[p1] += EM(Dheight, ps); /* was .15 */
  69. dprintf(".\tdiacrit: %c over S%d, lf=%c, rf=%c, h=%g, b=%g\n",
  70. type, p1, lfont[p1], rfont[p1], eht[p1], ebase[p1]);
  71. sfree(c); sfree(t);
  72. }