Font Text Graphics, Centered Symbol (PTEXT)
ptext, lstyle, pcstr | pmark
PTEXT, LSTYLE, PCSTR (Font Text Graphics)
NAME
lsytle - Select font, size, direction, color of text string to draw,
and background color to paint
ptext - Draw text string
The string can be aligned left, right or center, with/without
background color painting.
pcstr - Draw Courier font string in black
SYNOPSIS
call lstyle(font, high, angle, itcol, ibcol)
font [char] Character string defining literal font style
(3 chars or less. 4th char and the behind are neglected.)
1st char: 'T'|'H'|'C'|'S'|'K'|'M'|'G' (may be a small letter), which
stands for Times | Helvetica | Courier | Symbol | Kanji |
Mincho | Gothic , where Mincho and Gothic are equivalent to
{Kanji & Fine} and {Kanji & Bold}, respectively.
2nd/3rd char: modifiers (may be a small letter)
'B' (Bold) / 'F' (Fine: disable bold)
'O','I' (Oblique,Italic) / 'N','R' (Normal,Roman)
Others have no effect.
If conflicting each other, the latter is effective.
(e.g.) 'Mincho' : 'cho' is neglected, 'i' is overridden by 'n', then
as a result {Kanji & Fine & Normal}.
'Courier': 'rier' is neglected, 'u' has no effect, then
as a result {Courier & Fine & Oblique}.
high [float] Height (in cm) describing the font size
Actual character size is dependent on the font, the ratio of
actual size to the specified height is about 85% for Kanji
fonts, about 70% for Times and Helvetica, and about 60% for
Courier.
The range of background color painting is 125% of the height
specified, 100% above baseline and 25% below baseline.
angle [float] Direction angle to draw text (in degrees from +X axis)
itcol [int] Color of text
ibcol [int] Color of background
Color values for itcol, and ibcol :
0 thru 16777215 : 24bit color code, 8 bit each for R,G,B
0 thru -255 : monochromatic gray level from black to white
[ 0 : black ; -255,16777215 : white]
If itcol is out-of-range, black color is assigned for text color.
If ibcol is out-of-range (for example ibcol=-999), the background
is ragarded as colorless transparent, i.e., rectanglar background
painting is not performed.
call ptext(text, ltxt, xp, yp, kp)
text [char] Text string to be drawn with pre-selected font
ltxt [int] Length (number of bytes) of text string
xp, yp [float] Coordinates (in cm) of base point to draw string
kp [int] If kp=0, string (lower left) is started at the base point.
If kp=1, string (lower right) is ended at the base point.
If kp=2, middle center of string is adjusted to the base
point (xp,yp).
Else (kp>2 or 0>kp), same as kp=0.
call pcstr(xp, yp, chi, str, angle, ns)
xp, yp [float] Coordinates (in cm) of base point to draw string
chi [float] Height (in cm) of effective character size
[different from 'high' specification in 'lstyle']
str [char] Text string to be drawn with Courier font
angle [float] Direction angle to draw text (in degrees from +X axis)
ns [int] Number of bytes of text string
If given as positive value, string (lower left) is started
from the base point (xp,yp).
If given as negated value, end point (lower right) of the
string is adjusted to the base point (xp,yp).
EXAMPLE
parameter (iwhite = -255, igray = -128, iblack = 0, none = -999)
parameter (iblue = 255, iyellow = (255*256 + 255) * 256)
call psopn('ptext.ps', 'A4P')
call plots(2., 2.)
call dfpcol(0, 200)
call paintr(0., 0., 15., 9.)
call lstyle('HB', 1., 0., iblack, none)
call ptext('Helvetica-Bold', 14, 1., 7., 0)
call lstyle('ti', 1., 30., iwhite, iblack)
call ptext('Times-Italic', 12, 12., 7., 2)
call pcstr(15., 6., 1., 'Courier', 30., -7)
call lstyle('Kbi', 1., 0., iyellow, igray)
call ptext('Test', 10, 6., 4., 1)
call ptext('Test', 10, 6., 4., 2)
call lstyle('M', 1., 180., iblue, iwhite)
call ptext('Test', 10, 6., 2., 0)
call lstyle('S', 1.5, 0., iblack, iyellow)
call ptext('W=abc', 5, 9.5, 1., 0)
call plote
call pscls
stop
end
NOTES List of 'Symbol' fonts refered to ASCII character
PMARK (Centered Symbol)
NAME
pmark - Draw a centered symbol mark
SYNOPSIS
call pmark(mark, xp, yp, size, thick, icol)
mark [int] Mark identifier (0-9)
Refer to EXAMPLE for each mark shape.
If mark>9 or 0> mark, black solid circle with 'size'
dimension (mark=0, thick=0., and icol=0) is assumed.
xc, yc [float] Coordinates (in cm) of center of the mark to be drawn
size [float] Dimension (in cm) of mark
thick [float] Line thickness (in cm) to draw mark
If thick=0., it has special meaning 'solid' for mark
identifier 0 thru 6, the inside of the mark is painted
with the color specified, and further the inside of inner
circle in case of mark=1 is painted with white.
icol [int] Color of mark
0 thru 16777215 : 24bit color code, 8 bit each for R,G,B
0 thru -255 : monochromatic gray level from black to white
[ 0 : black ; -255,16777215 : white]
If icol is out-of-range (icol>16777215 or -255>icol),
black color (icol=0) is assigned.
EXAMPLE
character mark*2
call psopn('pmark.ps', 'a4p')
call plots(2., 2.)
call dfpcol(1, -200)
call paintr(0., 0., 15.5, 4.8)
do 1 i=0,9
x = float(i)*1.5 + 1.
write(mark,'(i2)') i
call pcstr(x-0.5, 4.2, 0.3, mark, 0., 2)
call pmark(i, x, 3.4, 1., 0.1, -255)
call pmark(i, x, 2.1, 1., 0.03, 0)
call pmark(i, x, 0.8, 1., 0. , -128)
1 continue
call plote
call pscls
stop
end