Design: 04.02.04.01/P08
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 8: Annotation text alignment
CHARACTERISTICS: ynny
OPERATOR SCRIPT:
EXPLICIT ALIGNMENT FOR HORIZONTAL ANNOTATION TEXT: Each of the
dotted annotation text extent rectangles except one should
contain an annotation text primitive, aligned on a dashed
baseline, filling the rectangle from left to right. Identify the
single non-aligned annotation text primitive.
IMPLICIT ALIGNMENT FOR HORIZONTAL ANNOTATION TEXT: Same as for
EXPLICIT ALIGNMENT FOR HORIZONTAL ANNOTATION TEXT, above.
EXPLICIT ALIGNMENT FOR VERTICAL ANNOTATION TEXT: Same as for
EXPLICIT ALIGNMENT FOR HORIZONTAL ANNOTATION TEXT, above, except
that a dashed centerline is used to measure alignment.
IMPLICIT ALIGNMENT FOR VERTICAL ANNOTATION TEXT: Same as for
EXPLICIT ALIGNMENT FOR VERTICAL ANNOTATION TEXT, above.
DESIGN:
txstr = annotation text string to be used for test = "Widget!?"
use <inquire text extent> on horizontal txstr to determine:
ntxwd = nominal width of annotation text extent rectangle
ntxht = nominal height of annotation text extent rectangle
for each ix = vertical annotation text alignment
use <inquire text extent> on horizontal txstr to determine:
vtab(ix) = normalized height for this alignment
next ix
htab(left) = normalized width of left line = 0
htab(center) = normalized width of center line = ntxwd/2
htab(right) = normalized width of right line = ntxwd
Throughout, use text font = 2
text precision = STROKE
table of alignments and paths to be tested:
hor-align vert-align annotation text path
algnh algnv algntp
--------- ---------- ---------
1: left top left
2: center cap right
3: right half left
4: right base right
5: center bottom left
6: left bottom right
set up PERM to randomize position
draw and label 6 identical horizontal annotation text rectangles,
using dotted lines, distinct color, dashed baseline,
stacked vertically, and labelled 1-6
for ix = 1,6
set desired y-location based on perm(ix)
calculate txpos = annotation text position, so as to fit annotation text
into expected box, using values from algnh(ix),algnv(ix)
if ix=6 then
change txpos to generate incorrect result
endif
set annotation text alignment = algnh(ix), algnv(ix)
set annotation text path = algntp(ix)
draw annotation text at txpos
next ix
TEST: #SR 1 2 5 9 19 23 56 57 58 63 64 65 66
"Explicit annotation text alignment attributes should
affect the position of a horizontal annotation text
rectangle in accordance with the values returned by
<inquire text extent>."
OPQA/EXPLICIT ALIGNMENT FOR HORIZONTAL ANNOTATION TEXT: Which
annotation text primitive is NOT aligned within the dotted
annotation text extent rectangle on the dashed baseline?
pass/fail depending on
(operator response indicates location of 6th annotation text primitive)
table of expected and requested alignments and paths to be tested:
requested: | expected:
text path hor-align vert-align | hor-align vert-align
algntp ralgnh ralgnv | ealgnh ealgnv
--------- --------- ---------- | --------- ----------
1: left normal normal | right base
2: right normal normal | left base
3: left center normal | center base
4: right normal top | left top
5: left normal normal | right base
set up PERM to randomize position
draw and label 5 identical horizontal annotation text rectangles,
using dotted lines, distinct color, dashed baseline,
stacked vertically, and labelled 1-5
for ix = 1,5
set desired y-location based on perm(ix)
calculate txpos = annotation text position, so as to fit annotation text
into expected box, using values from ealgnh(ix),ealgnv(ix)
if ix=5 then
change txpos to generate incorrect result
endif
set annotation text alignment = ralgnh(ix), ralgnv(ix)
set annotation text path = algntp(ix)
draw annotation text at txpos
next ix
TEST: #SR 1 2 5 9 19 23 57 58 63 64 65 66 67
"Implicit annotation text alignment attributes should
affect the position of a horizontal annotation text
rectangle in accordance with the values returned by
<inquire text extent>."
OPQA/IMPLICIT ALIGNMENT FOR HORIZONTAL ANNOTATION TEXT: Which
annotation text primitive is NOT aligned within the dotted
annotation text extent rectangle on the dashed baseline?
pass/fail depending on
(operator response indicates location of 5th annotation text primitive)
use <inquire text extent> on vertical txstr to determine:
ntxwd = nominal width of annotation text extent rectangle
ntxht = nominal height of annotation text extent rectangle
for each ix = vertical annotation text alignment
use <inquire text extent> on horizontal txstr to determine:
vtab(ix) = normalized height for this alignment
next ix
htab(left) = normalized width of left line = 0
htab(center) = normalized width of center line = ntxwd/2
htab(right) = normalized width of right line = ntxwd
table of alignments and paths to be tested:
hor-align vert-align annotation text path
algnh algnv algntp
--------- ---------- ---------
1: right top up
2: left cap down
3: center half up
4: center base down
5: left bottom up
6: right bottom down
set up PERM to randomize position
draw and label 6 identical vertical annotation text rectangles,
using dotted lines, distinct color, dashed centerline,
placed adjacent left-to-right and labelled 1-6
for ix = 1,6
set desired x-location based on perm(ix)
calculate txpos = annotation text position, so as to fit
annotation text into expected box, using values from
algnh(ix),algnv(ix)
if ix=6 then
change txpos to generate incorrect result
endif
set annotation text alignment = algnh(ix), algnv(ix)
set annotation text path = algntp(ix)
draw annotation text at txpos
next ix
TEST: #SR 1 2 5 9 19 23 56 57 58 63 64 65 66
"Explicit annotation text alignment attributes should
affect the position of a vertical annotation text
rectangle in accordance with the values returned by
<inquire text extent>."
OPQA/EXPLICIT ALIGNMENT FOR VERTICAL ANNOTATION TEXT: Which
annotation text primitive is NOT aligned within the dotted
annotation text extent rectangle on the dashed centerline?
pass/fail depending on
(operator response indicates location of 6th annotation text primitive)
table of expected and requested alignments and paths to be tested:
requested: | expected:
text path hor-align vert-align | hor-align vert-align
algntp ralgnh ralgnv | ealgnh ealgnv
--------- --------- ---------- | --------- ----------
1: up normal normal | center base
2: down normal normal | center top
3: up right normal | right base
4: down normal half | center half
5: up normal normal | center base
set up PERM to randomize position
draw and label 5 identical vertical annotation text rectangles,
using dotted lines, distinct color, dashed centerline,
placed adjacent left-to-right and labelled 1-5
for ix = 1,5
set desired x-location based on perm(ix)
calculate txpos = annotation text position, so as to fit
annotation text into expected box, using values from
ealgnh(ix),ealgnv(ix)
if ix=5 then
change txpos to generate incorrect result
endif
set annotation text alignment = ralgnh(ix), ralgnv(ix)
set annotation text path = algntp(ix)
draw annotation text at txpos
next ix
TEST: #SR 1 2 5 9 19 23 57 58 63 64 65 66 67
"Implicit annotation text alignment attributes should
affect the position of a vertical annotation text
rectangle in accordance with the values returned by
<inquire text extent>."
OPQA/IMPLICIT ALIGNMENT FOR VERTICAL ANNOTATION TEXT: Which
annotation text primitive is NOT aligned within the dotted
annotation text extent rectangle on the dashed centerline?
pass/fail depending on
(operator response indicates location of 5th annotation text primitive)
END PROGRAM 8