Design: 04.02.03.03/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 text extent rectangle
CHARACTERISTICS: ynny
OPERATOR SCRIPT:
ACCURACY OF TEXT EXTENT: Several text primitives are displayed.
All but one should be correctly surrounded by its text extent
rectangle, drawn with a solid polyline. For horizontal
primitives, the left (right) edge of the rectangle should
coincide with the left (right) edge of the leftmost (rightmost)
character of the text string, and the top and bottom edges with
the top and bottom edges of the character bodies (which may be
somewhat larger than the characters themselves). Check
especially that the bottom of the "g" in "Phigs" is enclosed.
For vertical text paths, the top (bottom) edge of the rectangle
should coincide with the top (bottom) edge of the topmost
(bottommost) character of the text string, and its left and right
edges should be equidistant from the centreline along which the
character bodies are aligned. A vertical rectangle may be wider
than necessary, but must completely enclose the characters.
Identify the one rectangle which does NOT properly enclose a text
primitive.
ACCURACY OF VERTICAL ALIGNMENTS: Several text primitives
consisting of capital letters are displayed. All but one of
these primitives should be properly aligned with a dotted
capline, a dashed-dotted halfline and a dashed baseline. For
horizontal text paths, all the characters in the text string have
the same capline, halfline, and baseline. For vertical text
paths, the capline should apply to the topmost character,
baseline to the bottommost character, and the halfline should be
midway between the halflines of the topmost and bottommost
characters. The capline and baseline should coincide with the
top and bottom edges of the appropriate characters (not the
character bodies). The halfline should be at a reasonable
intermediate position. Identify the one primitive which is NOT
properly aligned.
ACCURACY OF CONCATENATION POINT: Several pairs of text primitives
are drawn, the second member of each pair using the concatenation
point from the first. The resulting display should appear to be
a single text primitive in which the characters are aligned and
separated (or overlapped) by consistent spacing. Identify the one
primitive in which the characters are NOT aligned and evenly
separated.
DESIGN:
Open primary workstation
Establish specwt = specific primary workstation type
Message to operator: The tests in this program require careful
visual inspection; see OPERATOR SCRIPT in documentation.
testr = "Phigs...rules!"
testv = "UPPER CASE"
testC = "HXHXHXHXHXHX"
font = 2 (ASCII, possibly non-monospaced)
default text alignment = CENTRE,TOP
numrec = number of text extent rectangles per screen = 6
for all text paths, txp = RIGHT,LEFT,UP,DOWN
namtxp = name of text path
*** *** *** *** *** text extent rectangle *** *** *** *** ***
ngrec = incorrect entry = random choice between 1 and numrec
set text path = txp
for ix = 1 to numrec
chht,chxp,chsp = some random values for character height,
expansion factor, and spacing
draw and label a text extent rectangle (horizontal or vertical,
depending on txp)
<inquire text extent> with specwt, font, chxp, chsp,
chht, txp, txal=[CENTRE,TOP], testr
to determine text extent rectangle
apply scale and shift transformation to put testr in next
text extent rectangle
if (ix = ngrec) then
apply additional distorting transformation
endif
display text primitive = testr
restore identity local transformation
next ix
TEST: #SR 2 6 7 8 10 15 16
"<Inquire text extent> should accurately report the size
and position of text primitives when text path = " +
namtxp + "."
OPQA/ACCURACY OF TEXT EXTENT: Which rectangle does NOT
properly enclose a text primitive?
pass/fail depending on (operator indicates entry #ngrec)
clear contents of rectangles, but leave rectangles themselves
*** *** *** *** *** vertical alignment *** *** *** *** ***
ngrec = incorrect entry = random choice between 1 and numrec
set text path = txp
for ix = 1 to numrec
chht,chxp,chsp = some random values for character height,
expansion factor, and spacing
for txalv = TOP,CAP,HALF,BASE
<inquire text extent> with specwt, font, chxp, chsp,
chht, txp, txal=[CENTRE,txalv], testv
to determine text extent rectangle and location of
topline, capline,halfline,baseline
if (txalv = TOP) then
apply scale and shift transformation to put testv in
next text extent rectangle
else
valoc(txalv) = top of rectangle
= location of cap,half,base lines
endif
next txalv
draw expected capline,halfline,baseline
if (ix = ngrec) then
apply additional distorting transformation
endif
display text primitive = testv
restore identity local transformation
next ix
TEST: #SR 2 6 7 8 10 11
"<Inquire text extent> should accurately report the
vertical alignment values for text primitives when
text path = " + namtxp + "."
OPQA/ACCURACY OF VERTICAL ALIGNMENTS: Which text primitive
does NOT have a properly aligned capline (dotted),
halfline (dashed-dotted), or baseline (dashed)?
pass/fail depending on (operator indicates entry #ngrec)
clear screen
*** *** *** *** *** concatenation point *** *** *** *** ***
ngrec = incorrect entry = random choice between 1 and numrec
set text path = txp
pick text alignment:
txalh,txalv = NORMAL,NORMAL
if (txp is horizonatl) then
txalv = HALF
else
txalh = RIGHT
endif
set text alignment to txalh,txalv
for ix = 1 to numrec
chht,chxp,chsp = some random values for character height,
expansion factor, and spacing
<inquire text extent> with specwt, font, chxp, chsp,
chht, txp, txal=[txalh,txalv], testc
to determine text extent rectangle
apply scale and shift transformation to put testc in next
labelled location
display left part of testc
if (ix = ngrec) then
distort concatenation point
endif
<inquire text extent> with specwt, font, chxp, chsp,
chht, txp, txal=[txalh,txalv], left part of testc
to determine concatenation point = ccpx,ccpy
display right part of testc
restore identity local transformation
next ix
TEST: #SR 2 6 7 8 10 11 12 17 18
"<Inquire text extent> should accurately report the
concatenation point when text path = " + namtxp + "."
OPQA/ACCURACY OF CONCATENATION POINT: In which text primitive
are the characters NOT aligned and evenly separated?
pass/fail depending on (operator indicates entry #ngrec)
clear screen
next text path
END PROGRAM 6