PageRenderTime 29ms CodeModel.GetById 21ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/contrib/groff/tmac/pspic.tmac

https://bitbucket.org/freebsd/freebsd-head/
Unknown | 106 lines | 106 code | 0 blank | 0 comment | 0 complexity | 489baa1dd43cfc65a2f4dcd7a840b057 MD5 | raw file
  1.\" pspic.tmac
  2.\"
  3.\" Define the PSPIC macro.
  4.\"
  5.\" When used other than with -Tps, -Tdvi, or -Thtml it will draw a box
  6.\" around where the picture would go.
  7.
  8.de PSPIC
  9.  nr ps-offset-mode 0
 10.  ie '\\$1'-L' \{\
 11.    nr ps-offset-mode 1
 12.    shift
 13.    HTML-DO-IMAGE \\$1 l
 14.  \}
 15.  el \{\
 16.    ie '\\$1'-R' \{\
 17.      nr ps-offset-mode 2
 18.      shift
 19.      HTML-DO-IMAGE \\$1 r
 20.    \}
 21.    el \{\
 22.      ie '\\$1'-I' \{\
 23.        nr ps-offset-mode 3
 24.        nr ps-offset (m;\\$2)
 25.        shift 2
 26.        HTML-DO-IMAGE \\$1 i
 27.      \}
 28.      el \
 29.        HTML-DO-IMAGE \\$1 c
 30.    \}
 31.  \}
 32.
 33.  br
 34.
 35.  psbb \\$1
 36.  if (\\n[llx] : \\n[lly] : \\n[urx] : \\n[ury]) \{\
 37.    nr ps-wid (\\n[urx] - \\n[llx])
 38.    nr ps-ht (\\n[ury] - \\n[lly])
 39.    if (\\n[ps-wid] < 0) \
 40.      nr ps-wid (-\\n[ps-wid])
 41.    if (\\n[ps-ht] < 0) \
 42.      nr ps-ht (-\\n[ps-ht])
 43.    ie (\\n[.$] >= 2) \
 44.      nr ps-deswid (i;\\$2)
 45.    el \
 46.      nr ps-deswid ((\\n[.l] - \\n[.i]) <? \\n[ps-wid]p)
 47.    nr ps-desht (\\n[ps-deswid] * 1000 + (\\n[ps-wid] / 2) \
 48                  / \\n[ps-wid] * \\n[ps-ht] \
 49                  + 500 / 1000)
 50.    if ((\\n[.$] >= 3) & (\\n[ps-desht] > (i;0\\$3))) \{\
 51.      nr ps-desht (i;\\$3)
 52.      nr ps-deswid (\\n[ps-desht] * 1000 + (\\n[ps-ht] / 2) \
 53                     / \\n[ps-ht] * \\n[ps-wid] \
 54                     + 500 / 1000)
 55.    \}
 56.
 57.    ne (\\n[ps-desht]u + 1v)
 58.
 59.    if (\\n[ps-offset-mode] == 0) \
 60.      nr ps-offset (\\n[.l] - \\n[.i] - \\n[ps-deswid] / 2)
 61.    if (\\n[ps-offset-mode] == 1) \
 62.      nr ps-offset 0
 63.    if (\\n[ps-offset-mode] == 2) \
 64.      nr ps-offset (\\n[.l] - \\n[.i] - \\n[ps-deswid])
 65.
 66.    ie '\*[.T]'dvi' \{\
 67.      ie (\\n[ps-wid]p == \\n[ps-deswid]) \{\
 68.        ds ps-scale \" empty
 69.        ds ps-hoffset hoffset=-\\n[llx]
 70.        ds ps-voffset voffset=-\\n[lly]
 71.      \}
 72.      el \{\
 73.        nr ps-scale (\\n[ps-deswid] * 100 / \\n[ps-wid]p)
 74.        nr ps-hoffset (-\\n[llx] * \\n[ps-scale] / 100)
 75.        nr ps-voffset (-\\n[lly] * \\n[ps-scale] / 100)
 76.        ds ps-scale hscale=\\n[ps-scale] vscale=\\n[ps-scale]
 77.        ds ps-hoffset hoffset=\\n[ps-hoffset]
 78.        ds ps-voffset voffset=\\n[ps-voffset]
 79.      \}
 80.
 81\h'\\n[ps-offset]u'\
 82\v'\\n[ps-desht]u'\
 83\X'psfile=\\$1 \\*[ps-hoffset] \\*[ps-voffset] \\*[ps-scale]'
 84.    \}
 85.    el \{\
 86.      ie (\\n[.$] >= 3) \
 87.        ds ps-desht \\n[ps-desht]
 88.      el \
 89.        ds ps-desht \" empty
 90.
 91\h'\\n[ps-offset]u'\
 92\X'ps: invis'\
 93\Z'\D'p 0 \\n[ps-desht]u \\n[ps-deswid]u 0 0 -\\n[ps-desht]u''\
 94\X'ps: endinvis'\
 95\v'\\n[ps-desht]u'\
 96\X'ps: import \
 97       \\$1 \\n[llx] \\n[lly] \\n[urx] \\n[ury] \\n[ps-deswid] \\*[ps-desht]'
 98.    \}
 99.
100.    br
101.    sp \\n[ps-desht]u
102.  \}
103.  HTML-IMAGE-END
104..
105.
106.\" end of pspic.tmac