Previous: symtxb Up: ../plot79_s.html Next: symup


SYMTXT

       SUBROUTINE  SYMTXT (TEXT,ISTART,LENTXT)
 C$    (Symbol Text -- Extended)
 C$    Plot a  text  string.   The current  orientation  and  size
 C$    attributes  for  text  are  assumed.   The  current   point
 C$    determines the location  where the  text is  drawn, and  is
 C$    unchanged on return.  The arguments are:
 C$
 C$    TEXT(*).....Packed Hollerith string  defining characters to
 C$                be  plotted.  The character  string may contain
 C$                format specifiers as  described below to modify
 C$                the form of the output.
 C$
 C$                For convenience,  leading  and trailing  blanks
 C$                are ***IGNORED***  when   justifying the   text
 C$                left, right, or  centered.   In the rare  cases
 C$                where such  blanks are required, a substitution
 C$                character should be defined to be equivalent to
 C$                one of  the Hershey  blank  characters, or else
 C$                the string  can  be  protected with braces (see
 C$                below).
 C$
 C$    ISTART......Index  of   starting   character  in   TEXT(*),
 C$                counting from 1 from the left.
 C$
 C$    LENTXT......Number of characters in TEXT(*) to plot.
 C$
 C$    In some applications, there is a  need  for a more powerful
 C$    text drawing  capability than was provided by  the original
 C$    SYMTX().     Examples  include subscripts and superscripts,
 C$    graph  annotation and  legends,   and multi-colored   text.
 C$    These  are implemented here  in  SYMTXT() by supporting the
 C$    embedding of special format strings  in the text  to modify
 C$    plotting attributes   without themselves  generating output
 C$    text.  The TEXT(*) string then becomes a small program in a
 C$    simple language that describes how to plot itself.
 C$
 C$    Inspiration from the  Scribe,  TeX,  and  troff typesetting
 C$    systems is hereby acknowledged.
 C$
 C$    In addition to format   strings, braces  may   be used  for
 C$    grouping, as in TeX; changes to graphics attributes made in
 C$    a  group  are lost   when  the  group is ended.     This is
 C$    convenient to avoid the  need  to reset attributes  after a
 C$    temporary  change.  The current   point,  and  CORE viewing
 C$    parameters, are   not saved and   restored  around  groups.
 C$    Format item  arguments are groups in  this  sense, whatever
 C$    delimiters  are used,  and  the   entire TEXT(*)  string is
 C$    implicitly in a group as well.
 C$
 C$    The current point, 3-D  mode, color index, pen, line style,
 C$    line width,  and all font  parameters  are preserved across
 C$    calls to SYMTXT().
 C$
 C$    Format strings conform to the following grammar:
 C$
 C$    <format-string> :== <escape-char><format-letter><optional-arg>
 C$
 C$    <optional-arg>  :== <open-delim><string><close-delim> |
 C$                        <nothing>
 C$
 C$    <escape-char>   :== <backslash> \ |
 C$                        <dollar> $ |
 C$                        <at-sign> @
 C$
 C$    <open-delim>    :== <apostrophe> |
 C$                        <grave accent> |
 C$                        <left angle> |
 C$                        <left brace> |
 C$                        <left bracket> |
 C$                        <left parenthesis> |
 C$                        <quotation mark>
 C$
 C$    <close-delim>   :== <apostrophe> |
 C$                        <grave accent> |
 C$                        <right angle> |
 C$                        <right brace> |
 C$                        <right bracket> |
 C$                        <right parenthesis> |
 C$                        <quotation mark>
 C$
 C$    <string>        :== argument  text.      For subscripts and
 C$                        superscripts, this may possibly include
 C$                        nested   format strings,  provided that
 C$                        the  surrounding  delimiters match  and
 C$                        are  balanced (i.e.  a left parenthesis
 C$                        is matched only by a right parenthesis,
 C$                        not a  right  brace, right  bracket, or
 C$                        any kind of quote mark).
 C$
 C$    A variety of escape and delimiter characters is provided to
 C$    reduce the  need for  escape  quoting,  and to   cope  with
 C$    limited character sets in some environments.
 C$
 C$    Nesting of  groups,    subscripts,   and  superscripts   is
 C$    supported to a depth of MAXSV, set below to at least 6.  It
 C$    can be    adjusted  arbitrarily,   along  with   the  array
 C$    dimensions that depend on  it.  Large values of  MAXSV  are
 C$    not  encouraged,  because  considerable  attribute  context
 C$    space is required (stored in the arrays named SVxxxx()).
 C$
 C$    Omitted  optional arguments default  to zero, or the  empty
 C$    string, as required  by the   format letter.  Format   item
 C$    argument lengths, except  for subscripts, superscripts, and
 C$    groups, are  limited to MAXSTR  characters,  set below to a
 C$    minimum of  100, which should  be more  than  ample for any
 C$    real application.
 C$
 C$    Letter case is not significant  in format letters.  The set
 C$    of currently recognized ones is:
 C$
 C$    .    save the current point in register <arg> (0 .. 9 are
 C$         supported)
 C$    =    restore the current point from register <arg>
 C$    +    print <arg> as superscript
 C$    -    print <arg> as subscript
 C$    A    draw an absolute line from current point to <x,y> or
 C$         <x,y,z> (omitted coordinate values default to the
 C$         corresponding ones from the current point)
 C$    C    character number <arg>
 C$    F    font name <text>
 C$    I    (invisible) move absolute from current point to <x,y> or
 C$         <x,y,z> (omitted coordinate values default to the
 C$         corresponding ones from the current point)
 C$    J    (invisible) move relative from current point by <dx,dy> or
 C$         <dx,dy,dz> (omitted coordinate values default to the
 C$         corresponding ones from the current point)
 C$    K    set color number to <arg>
 C$    L    set line style number to <arg>
 C$    M    plot marker number <arg>
 C$    N    newline; with no argument, assume <1> newline
 C$    P    set pen number to <arg>
 C$    R    draw a relative line from current point by <dx,dy> or
 C$         <dx,dy,dz> (omitted coordinate values default to zero)
 C$    S    scale current font size by <arg>
 C$    U    relative move by <arg> in character path direction, with
 C$         units of width of last character plotted (width is
 C$         zero if there is no previous character)
 C$    V    relative move by <arg> in character up direction, with
 C$         units of height of last character plotted (height is font
 C$         height if there is no previous character)
 C$    W    set line width to <arg>
 C$    X    relative move by <arg> world units in character path
 C$         direction
 C$    Y    relative move by <arg> world units in character up
 C$         direction
 C$
 C$    For  the A and R  format items, which normally  take 2 or 3
 C$    numbers in the argument, use spaces,  commas, or semicolons
 C$    to separate the numbers.
 C$
 C$    Any other character prints as itself, thereby  allowing the
 C$    escape character  and  open and  close  delimiters   to  be
 C$    represented as themselves;  thus, $$  is  a literal  dollar
 C$    sign, and @( is a literal left parenthesis.
 C$
 C$    Font  heights are automatically  reduced in  subscripts and
 C$    superscripts.
 C$
 C$    The A, I, J, and R formats, together with L and  M, make it
 C$    possible to  create legend  text that  includes the  marker
 C$    symbol or a line drawn in a specified dashing style.
 C$
 C$    The  S format allows character  size   adjustments when the
 C$    default sizes are not adequate.
 C$
 C$    The U, V, X and Y formats provide for detailed control over
 C$    the position of  characters, usually for accents, analogous
 C$    to the \kern, \lower, and \raise  control sequences  in the
 C$    TeX typesetting system.  U  and  V   work in  units of  the
 C$    current font, which will usually be more convenient  than X
 C$    and Y.  Note that J is only representable by an X Y pair if
 C$    the character path is along  the x direction, and character
 C$    up is along the y direction.
 C$
 C$    Because of the widespread use of  TeX, TeX-style subscripts
 C$    and superscripts are  also supported.  These take the  form
 C$    _{xxx}  or  _x  for  subscripts,   and ^{xxx}  or  ^x   for
 C$    superscripts.  If the group  brace delimiters are  omitted,
 C$    the   following  single   character   is  the subscript  or
 C$    superscript.
 C$
 C$    Here are some examples:
 C$
 C$    @+[p]       display 'p' as a superscript
 C$    @-"k,l"     display 'k,l' as a subscript
 C$    @C[2230]    display Hershey character number 2230 (musical
 C$                G clef)
 C$    $A<1.2,2.7> draw a line to (1.2,2.7), making it the new
 C$                current point
 C$    @f[UCSR3]   replace current font number by font UCSR3
 C$                (Upper Case Simplex Roman, Variant 3)
 C$    $n          newline
 C$    $N<2>       two newlines
 C$    @P[3]       change to pen number 3
 C$    \W(0.1)     set line width to 0.1 (double stroke; see SETLW)
 C$    @S(0.75)    reduce font height to 75% of current value
 C$    \X(-2.5)    move left by -2.5 world units
 C$    @.O@=+      overstrike + on O
 C$
 C$    X@+[pq]@-[nm]
 C$                         pq
 C$                Display X
 C$                           nm
 C$
 C$                Note that  the subscripts and  superscripts are
 C$                not vertically  aligned.   This can be achieved
 C$                as shown in the next example:
 C$
 C$    X@.@+[pq]@=@-[nm]
 C$                         pq
 C$                Display X
 C$                         nm
 C$
 C$                Note the use of  the  @.  and @= to  save   and
 C$                restore the  current point in  default register
 C$                0, so as to vertically align the subscript with
 C$                the superscript.
 C$
 C$    X@+[@f[ucci1]pq]@-[@f[ucci2]nm]
 C$
 C$                          pq
 C$                 Display X
 C$                          nm
 C$
 C$                 using different  fonts for  the  subscript and
 C$                 superscript.
 C$
 C$    @C[1402]@.@u[-0.7]@v[-0.6]@-[n]@=x@+[n]
 C$
 C$                                n
 C$                 Display SIGMA x
 C$                           n
 C$
 C$                 The  extra  vertical   kern,   @v[-0.6],    is
 C$                 necessary  because  the  Greek  capital  Sigma
 C$                 extends below the baseline.
 C$
 C$    (25-Jul-1990)