[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: gEDA: Overbars
> When we get around to fixing the PS output, it is important
> to use the PS string measuring functions to determine how long a certain
> overbar should be depending on the string. This will guarantee that
> the overbar are drawn in the right place and length.
Here's a sample postscript program for whoever does this. It shows a
couple ways of measuring text and managing overbars.
%!PS-Adobe
/getobar {
gsave
findfont exch scalefont setfont
newpath 0 0 moveto (X) true charpath pathbbox
/ury exch def
/urx exch def
/lly exch def
/llx exch def
ury lly sub
grestore
} def
/setobar {
/fontX exch def
/overbarwidth fontX 10 div def
/overbarheight overbarwidth 2 mul fontX add def
} def
/cbar20 20 /Courier getobar def
/hbar20 20 /Helvetica getobar def
/tbar40 40 /Times-Roman getobar def
/obshow {
/s exch def
/sl s stringwidth pop def
gsave
gsave
newpath 0 0 moveto (X) true charpath pathbbox
grestore
/ury exch def
/urx exch def
/lly exch def
/llx exch def
/overbarwidth ury lly sub 10 div def
overbarwidth setlinewidth
0 ury lly sub overbarwidth 2 mul dup == add rmoveto sl 0 rlineto stroke
grestore
s show
} def
/obvshow {
/s exch def
/sl s stringwidth pop def
gsave
overbarwidth setlinewidth
0 overbarheight rmoveto sl 0 rlineto stroke
grestore
s show
} def
gsave
/Helvetica findfont 20 scalefont setfont
100 100 moveto
(XSIGNAL) obshow
/Courier findfont 20 scalefont setfont
200 100 moveto
(XSIGNAL) obshow
/Times-Roman findfont 40 scalefont setfont
300 100 moveto
(XSIGNAL) obshow
grestore
0 100 translate
/Helvetica findfont 20 scalefont setfont
hbar20 setobar
100 100 moveto
(XSIGNAL) obvshow
/Courier findfont 20 scalefont setfont
cbar20 setobar
200 100 moveto
(XSIGNAL) obvshow
/Times-Roman findfont 40 scalefont setfont
tbar40 setobar
300 100 translate 0 rotate 0 0 moveto
(XSIGNAL) obvshow
showpage