Design: 04.02.04.02/P06

This is an abstract, language-independent design. Grim details may be found in the corresponding source code. You may return to the documentation for the module containing this program design, or to the entire hierarchical table of topics covered by the PVT.


PROGRAM 6: Appearance of character expansion factor and
           character spacing

CHARACTERISTICS: ynny

OPERATOR SCRIPT:

CHARACTER EXPANSION AND SPACING IN HORIZONTAL ANNOTATION TEXT:
Several horizontal lines containing an annotation text string are
drawn with various values for the character attributes.
The expected character body positions are outlined with a dotted
line and a dashed baseline is drawn, usually of different colors
than the annotation text itself. Identify the single line in which
the characters either do NOT fall within the dotted boxes or are NOT
aligned on the baseline. Since the boxes are character bodies,
they are bounded by the topline and bottomline, and thus may be
somewhat larger vertically than the enclosed character.  In the
case of overlapping characters due to negative character spacing,
half-boxes are drawn, so that the boxes themselves don't overlap.

CHARACTER EXPANSION AND SPACING IN VERTICAL ANNOTATION TEXT: Same
as above, except that the annotation text choices are vertical columns,
not horizontal lines.  Note that the expected position is
aligned on the vertical centerline (not left- or right-justified);
the actual characters, therefore, must not appear to the left or
right of the expected box.

DESIGN:

set all ASFs to BUNDLED

use <inquire text extent> with
  text font                  = 1
  character height           = 1
  character spacing          = 0
  character expansion factor = 1
  text string                = "WWiig!"
to determine
  ncbht = nominal character body height
  ncbwd = nominal character body width

set annotation text path = RIGHT
numlin = number of lines = 6
ngline = random number from 1 to numlin
for ix = 1 to numlin
   randomly select, to fit on one line
      chht  = character height
      chexp = expansion factor
      chsp  = character spacing

   set annotation text character height = chht
   set text index = ix
   set text rep #ix: font,   precision, expansion, spacing, color
                     1,      STROKE,    chexp,     chsp,    1

   display annotation text "WWiig!" on line ix
   calculate expected character boxes
   if (ix = ngline) then
      distort character boxes
   endif
   draw annotation text in character boxes, using dotted line style,
     color #2
next ix

TEST: #SR 1 3 4 18 23 24 25 26 27 28
      "The size and shape of an annotation text string displayed with
       STROKE precision in a monospaced font on a horizontal annotation
       text path should conform exactly to the annotation text character
       height, expansion factor, and spacing in effect."

OPQA/CHARACTER EXPANSION AND SPACING IN HORIZONTAL ANNOTATION TEXT:
  In which line are the characters of the annotation text string NOT
  aligned within dotted character boxes and on the dashed baseline?
pass/fail depending on (operator picks location ngline)

set annotation text path = DOWN
numcol = number of columns = 6
ngcol  = random number from 1 to numcol
for ix = 1 to numcol
   randomly select, to fit in one column
      chht  = character height
      chexp = expansion factor
      chsp  = character spacing

   set annotation character height = chht
   set text index = ix
   set text rep #ix: font,   precision, expansion, spacing, color
                     1,      STROKE,    chexp,     chsp,    1

   display annotation text "WWiig!" in column ix
   calculate expected character boxes
   if (ix = ngcol) then
      distort character boxes
   endif
   draw annotation text in character boxes, using dotted line style,
     color #2
next ix

TEST: #SR 1 3 4 18 23 24 25 26 27 28
      "The size and shape of an annotation text string displayed with
       STROKE precision in a monospaced font on a vertical annotation
       text path should conform exactly to the annotation text character
       height, expansion factor, and spacing in effect."

OPQA/CHARACTER EXPANSION AND SPACING IN VERTICAL ANNOTATION TEXT:
  In which column are the characters of the annotation text string NOT
  aligned within dotted character boxes and on the dashed centerline?
pass/fail depending on (operator picks location ngcol)

bestfn = a stroke text font other than 1, preferably not #2 and
         not monospaced

bestsc = best score so far for font properties = -1
bestfn = best font so far = -1
for ix = each available non-#1 stroke font
   thisfn = ixth font from <inquire text facilities>
   use <inquire text extent> with
     text font                  = thisfn
     character height           = 1
     character spacing          = 0
     character expansion factor = 1
     annotation text string     = "WWW"
   to determine
     tcbhtw = nominal character body height for W
     tcbwdw = nominal character body width for W

   use <inquire text extent> with
     text font                  = thisfn
     character height           = 1
     character spacing          = 0
     character expansion factor = 1
     annotation text string     = "iii"
   to determine
     tcbhti = nominal character body height for i
     tcbwdi = nominal character body width for i

   if (thisfn = 2) then
      fnscor = score for this font = 0
   else
      fnscor = score for this font = 1
   endif

   if (ncbwdi approx= ncbwdw) then
      do nothing
   else
      add 2 to fnscor
   endif

   if (fnscor > bestsc) then
      best font so far:
      bestsc = fnscor
      bestfn = thisfn
      ncbhtw = tcbhtw
      ncbwdw = tcbwdw
      ncbhti = tcbhti
      ncbwdi = tcbwdi
      if (fnscor .ge. 3) then
         got a non-2, non-monospaced font: goto got_font
      endif
   endif
next stroke font

if (bestsc <= -1) then
   message: skipping tests for proportionately spaced fonts; none
            available.
   goto endit
endif

got_font:

set annotation text path = LEFT
numlin = number of lines = 6
ngline = random number from 1 to numlin
for ix = 1 to numlin
   randomly select, to fit on one line
      chht  = character height
      chexp = expansion factor
      chsp  = character spacing

   set annotation text character height = chht
   set text index = ix
   set text rep #ix: font,   precision, expansion, spacing, color
                     bestfn, STROKE,    chexp,     chsp,    1

   display annotation text "WWiiiW" on line ix
   calculate expected character boxes
   if (ix = ngline) then
      distort character boxes
   endif
   draw annotation text in character boxes, using dotted line style,
     color #2
next ix

TEST: #SR 1 3 4 23 24 25 26 27 28
      "The size and shape of an annotation text string displayed with
       STROKE precision in any font on a horizontal annotation text
       path should conform exactly to the annotation text character
       height, expansion factor, and spacing in effect."

OPQA/CHARACTER EXPANSION AND SPACING IN HORIZONRAL ANNOTATION TEXT:
  In which line are the characters of the annotation text string NOT
  aligned within dotted character boxes and on the dashed baseline?
pass/fail depending on (operator picks location ngline)

set annotation text path = UP
numcol = number of columns = 6
ngcol  = random number from 1 to numcol
for ix = 1 to numcol
   randomly select, to fit in one column
      chht  = character height
      chexp = expansion factor
      chsp  = character spacing

   set annotation text character height = chht
   set text index = ix
   set text rep #ix: font,   precision, expansion, spacing, color
                     bestfn, STROKE,    chexp,     chsp,    1

   display annotation text "WWiiiW" in column ix
   calculate expected character boxes
   if (ix = ngcol) then
      distort character boxes
   endif
   draw annotation text in character boxes, using dotted line style,
     color #2
next ix

TEST: #SR 1 3 4 23 24 25 26 27 28
      "The size and shape of an annotation text string displayed with
       STROKE precision in any font on a vertical annotation text path
       should conform exactly to the annotation text character height,
       expansion factor, and spacing in effect."

OPQA/CHARACTER EXPANSION AND SPACING IN VERTICAL ANNOTATION TEXT:
  In which column are the characters of the annotation text string NOT
  aligned within dotted character boxes and on the dashed centerline?
pass/fail depending on (operator picks location ngcol)

endit:

END PROGRAM 6