Design: 04.02.03.01/P11
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 11: Geometric interaction of text attributes
CHARACTERISTICS: ynny
OPERATOR SCRIPT:
GEOMETRY OF TEXT ATTRIBUTES: Several text primitives in font #1 are
displayed. The characters of all but one should be similar in size,
position, and orientation to the outline formed by the dashed
polylines. Identify the primitive with an incorrect outline.
GEOMETRY OF NEGATIVE TEXT ATTRIBUTES: Same as for GEOMETRY OF
TEXT ATTRIBUTES, above.
DESIGN:
Throughout, use font#1 (monospaced), STROKE precision, color #1
for text, color #2 and dashed lines for outline
Throughout, use text string "ELF", because letters are simple to
outline, and asymmetric (to reveal reversals).
chstr = "ELF"
numlin = number of lines to display = 5
TEST: #SR 1 2 11 27 28 31 35 36 41 42 58 59 60 66 67 68 69 74 75 80 81
"The transformation effects of text path, text alignment,
and character up vector and of various positive values for
character expansion factor, character spacing, and
character height should work correctly in conjunction with
the text direction vectors for a 3D test primitive."
Use <inquire text extent> to determine
nomwid = nominal character width for font #1
nombht = nominal character body height for font #1
vtab = list of nominal offsets for the various vertical
text alignments, relative to BASE.
nominal quantities are for char-ht=1, char-sp=0, char-xp=1
ngline = random integer from 1 to numlin
set up random order for text paths, alignments - make sure each
possible value is chosen at least once
do ix = 1 to numlin
pick random values for text path, text alignment,
and character up vector
pick random positive values for character expansion factor,
character spacing, and character height
if (ix = ngline) then
distort expected outline for ngline:
expected position based on chht*1.25
endif
Represent position of text primitive in MC as follows:
LLE : 3D location of lower-left corner (LEFT,BASE) of "E"
NXTC : vector to next character
UPCH : character up 3D vector (direction and length)
RTCH : character right 3D vector (direction and length)
COR : 3D location of (LEFT,BASE) corner of text extent rectangle
CLNG : vector from corner along long dimension of rectangle
CSHT : vector from corner along short dimension of rectangle
Calculate expected TLC position of text primitive: apply
attributes in this order:
1: character expansion, character spacing, and text path
2: text alignment
3: character up
4: character height
pick random values for text position and direction vectors
Calculate xf3d = expected rotation from TLC to MC
apply xf3d to vectors: nxtc,upch,rtch,clng,csht
Calculate xf3d = expected rotation and shift from TLC to MC
apply xf3d to points: lle,cor
Correct MC values for lle, nxtc, upch, rtch, cor, clng, csht
now computed.
compute and set global modelling transform to re-locate text
extent rectangle (MC) to display area for this line (WC).
re-set local transformation to identity; only global applies to
actual text primitive.
generate text primitive, with chosen attributes and geometry
calculate and set local transformation to move outline to
expected MC location.
draw outline of expected text.
next ix
OPQA/GEOMETRY OF TEXT ATTRIBUTES: Which text primitive is NOT similar
in size, position, and orientation to the dashed outline?
pass/fail depending on (primitive #ngline selected)
TEST: #SR 1 2 11 27 28 31 35 36 41 42 58 59 60 66 67 68 69 74 75 80 81
"The transformation effects of text path, text alignment,
and character up vector and of various negative values for
character expansion factor, character spacing, and
character height should work correctly in conjunction with
the text direction vectors for a 3D test primitive."
Use <inquire text extent> to determine
nomwid = nominal character width for font #1
nombht = nominal character body height for font #1
vtab = list of nominal offsets for the various vertical
text alignments, relative to BASE.
nominal quantities are for char-ht=1, char-sp=0, char-xp=1
ngline = random integer from 1 to numlin
set up random order for text paths, alignments - make sure each
possible value is chosen at least once
do ix = 1 to numlin
pick random values for text path, text alignment,
and character up vector
pick random mostly negative values for character expansion
factor, character spacing, and character height
if (ix = ngline) then
distort expected outline for ngline:
expected position based on chht*1.25
endif
Represent position of text primitive in MC as follows:
LLE : 3D location of lower-left corner (LEFT,BASE) of "E"
NXTC : vector to next character
UPCH : character up 3D vector (direction and length)
RTCH : character right 3D vector (direction and length)
COR : 3D location of (LEFT,BASE) corner of text extent rectangle
CLNG : vector from corner along long dimension of rectangle
CSHT : vector from corner along short dimension of rectangle
Calculate expected TLC position of text primitive: apply
attributes in this order:
1: character expansion, character spacing, and text path
2: text alignment
3: character up
4: character height
pick random values for text position and direction vectors
Calculate xf3d = expected rotation from TLC to MC
apply xf3d to vectors: nxtc,upch,rtch,clng,csht
Calculate xf3d = expected rotation and shift from TLC to MC
apply xf3d to points: lle,cor
Correct MC values for lle, nxtc, upch, rtch, cor, clng, csht
now computed.
compute and set global modelling transform to re-locate text
extent rectangle (MC) to display area for this line (WC).
re-set local transformation to identity; only global applies to
actual text primitive.
generate text primitive, with chosen attributes and geometry
calculate and set local transformation to move outline to
expected MC location.
draw outline of expected text.
next ix
OPQA/GEOMETRY OF NEGATIVE TEXT ATTRIBUTES: Which text primitive is NOT
similar in size, position, and orientation to the dashed outline?
pass/fail depending on (primitive #ngline selected)
END PROGRAM 11