Design: 04.02.03.02/P15
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 15: Appearance of character expansion factor and
character spacing
CHARACTERISTICS: ynny
OPERATOR SCRIPT:
CHARACTER EXPANSION AND SPACING IN HORIZONTAL TEXT: Several
horizontal lines containing a 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 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 TEXT: Same as above,
except that the 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 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 character height = chht
set text index = ix
set text rep #ix: font, precision, expansion, spacing, color
1, STROKE, chexp, chsp, 1
calculate expected character boxes
if (ix = ngline) then
distort character boxes
endif
draw in character boxes, using dotted line style, color #2
display text "WWiig!" on line ix
next ix
TEST: #SR 3 5 6 45 50 57 58 59 61 62
"The size and shape of a text string displayed with STROKE
precision in a monospaced font on a horizontal text path
should conform exactly to the character height, expansion
factor, and spacing in effect."
OPQA/CHARACTER EXPANSION AND SPACING IN HORIZONTAL TEXT:
In which line are the characters of the text string NOT aligned
within dotted character boxes and on the dashed baseline?
pass/fail depending on (operator picks location ngline)
set 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 character height = chht
set text index = ix
set text rep #ix: font, precision, expansion, spacing, color
1, STROKE, chexp, chsp, 1
calculate expected character boxes
if (ix = ngcol) then
distort character boxes
endif
draw in character boxes, using dotted line style, color #2
display text "WWiig!" in column ix
next ix
TEST: #SR 3 5 6 45 50 57 58 59 61 62
"The size and shape of a text string displayed with STROKE
precision in a monospaced font on a vertical text path
should conform exactly to the character height, expansion
factor, and spacing in effect."
OPQA/CHARACTER EXPANSION AND SPACING IN VERTICAL TEXT:
In which column are the characters of the 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
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
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 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 character height = chht
set text index = ix
set text rep #ix: font, precision, expansion, spacing, color
bestfn, STROKE, chexp, chsp, 1
calculate expected character boxes
if (ix = ngline) then
distort character boxes
endif
draw in character boxes, using dotted line style, color #2
display text "WWiiiW" on line ix
next ix
TEST: #SR 3 5 6 50 57 58 59 61 62
"The size and shape of a text string displayed with STROKE
precision in any font on a horizontal text path should
conform exactly to the character height, expansion factor,
and spacing in effect."
OPQA/CHARACTER EXPANSION AND SPACING IN HORIZONTAL TEXT:
In which line are the characters of the text string NOT aligned
within dotted character boxes and on the dashed baseline?
pass/fail depending on (operator picks location ngline)
set 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 character height = chht
set text index = ix
set text rep #ix: font, precision, expansion, spacing, color
bestfn, STROKE, chexp, chsp, 1
calculate expected character boxes
if (ix = ngcol) then
distort character boxes
endif
draw in character boxes, using dotted line style, color #2
display text "WWiiiW" in column ix
next ix
TEST: #SR 3 5 6 50 57 58 59 61 62
"The size and shape of a text string displayed with STROKE
precision in any font on a vertical text path should
conform exactly to the character height, expansion factor,
and spacing in effect."
OPQA/CHARACTER EXPANSION AND SPACING IN VERTICAL TEXT:
In which column are the characters of the text string NOT
aligned within dotted character boxes and on the dashed
centerline?
pass/fail depending on (operator picks location ngcol)
endit:
END PROGRAM 15