Design: 04.02.03.02/P12
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 12: Appearance of text fonts 1 and 2
CHARACTERISTICS: ynny
OPERATOR SCRIPT:
ASCII SPECIAL CHARACTERS: Each numbered character should be
recognizable from its name in the prompt. Respond by entering
a list of numeric labels, in the same order as requested by the
prompt. For instance if the screen shows:
1: (
2: *
3: &
and the prompt asks for <asterisk>, <ampersand>, <opening
parenthesis>, the correct response is 2,3,1. All 33 special
characters are checked for all three precisions in fonts 1 and 2,
so there will be several prompts for this heading.
ASCII UPPERCASE LETTERS: All 26 uppercase letters and one
lowercase letter should be displayed. Identify the position of
the lowercase letter. Character positions are displayed to the
left of each of the strings. For example, in this line:
9-16: DTSRFkCB
the lowercase "k" is in position 14. As above, this test is
executed for all three precisions in fonts 1 and 2.
ASCII LOWERCASE LETTERS: All 26 lowercase letters and one
uppercase letter should be displayed. Identify the position of
the uppercase letter. Character positions are displayed to the
left of each of the strings. As above, this test is executed for
all three precisions in fonts 1 and 2.
ASCII DIGITS: All 10 digits and one non-digit should be
displayed. Identify the position of the non-digit. Character
positions are displayed to the left of each of the strings. As
above, this test is executed for all three precisions in fonts 1
and 2.
DISTINGUISHABILITY OF FONTS 1 AND 2: For each of the three
precisions, five lines are displayed, four in one font (1 or 2)
and one in the other font. Identify the line in the distinctive
font.
FONT 1 MONOSPACED: Each line has a character string with some
leading potentially narrow characters and trailing potentially
wide characters. In every string but one, each of its characters
should line up between the vertical lines. Identify the one
string where this is not so.
DESIGN:
set all ASFs to BUNDLED
set up array for ASCII characters and names:
ascch = all special characters = !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
ascnm = names of all special characters
= space, exclamation point, double quote, pound sign,
dollar sign, percent sign, ampersand, apostrophe, left
parenthesis, right parenthesis, asterisk, plus sign, comma, dash,
period, slash, colon, semi-colon, less-than sign, equals,
greater-than sign, question mark, at sign, left bracket, back
slash, right bracket, carat, underline, single opening quote,
left curly brace, vertical bar, right curly brace, tilde
TEST: #SR 3 5 6 34 38 39 40 41
"Fonts 1 and 2 should both contain all the ASCII special
characters, in any precision."
grpsiz = how many characters to display at a time = 6
for font = 1 to 2
for prec = STRING, CHAR, STROKE
if (font,prec not directly available) goto end_fp_spec
set text rep #3: font, precision, expansion, spacing, color
font, prec 1.0 0.1 1
set text index = 3
perm = array to randomize order of the 33 characters
for ix = 0 to 32 by grpsiz
display next grpsiz randomly ordered characters starting
from ascch(perm(ix+1))
OPQA/ASCII SPECIAL CHARACTERS: Identify, in order, the following
characters: ascnm(perm(ix+1)) to ascnm(perm(ix+grpsiz))
if (operator response incorrect) then
fail
goto end_ascii_special
endif
next ix
end_fp_spec:
next prec
next font
pass
end_ascii_special:
upper = uppercase characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
noncap = a lowercase letter randomly chosen from "bdfhkt"
tststr = test string = noncap + upper
TEST: #SR 3 5 6 34 38 39 40 41
"Fonts 1 and 2 should both contain all the ASCII uppercase
letters, in any precision."
set text index = 2
for font = 1 to 2
for prec = STRING, CHAR, STROKE
if (font,prec not directly available) goto end_fp_upper
set text rep #2: font, precision, expansion, spacing, color
font, prec 1.0 0.1 1
perm = array to randomize order of the 27 characters
display tststr in random order
OPQA/ASCII UPPERCASE LETTERS: which character is NOT an
uppercase letter?
if (operator fails to identify noncap) then
fail
goto end_ascii_upper
endif
end_fp_upper:
next prec
next font
pass
end_ascii_upper:
lower = lowercase characters = 'abcdefghijklmnopqrstuvwxyz'
nonlow = an uppercase letter randomly chosen from upper
tststr = test string = nonlow + lower
TEST: #SR 3 5 6 34 38 39 40 41
"Fonts 1 and 2 should both contain all the ASCII lowercase
letters, in any precision."
set text index = 3
for font = 1 to 2
for prec = STRING, CHAR, STROKE
if (font,prec not directly available) goto end_fp_lower
set text rep #3: font, precision, expansion, spacing, color
font, prec 1.0 0.1 1
perm = array to randomize order of the 27 characters
display tststr in random order
OPQA/ASCII LOWERCASE LETTERS: which character is NOT a
lowercase letter?
if (operator fails to identify nonlow) then
fail
goto end_ascii_lower
endif
end_fp_lower:
next prec
next font
pass
end_ascii_lower:
digit = digit characters = '0123456789'
nondig = one non-digit randomly chosen from "CEISZ"
tststr = test string = nondig + digit
TEST: #SR 3 5 6 34 38 39 40 41
"Fonts 1 and 2 should both contain all the ASCII digit
characters, in any precision."
set text index = 4
for font = 1 to 2
for prec = STRING, CHAR, STROKE
if (font,prec not directly available) goto end_fp_digit
set text rep #4: font, precision, expansion, spacing, color
font, prec 1.0 0.1 1
perm = array to randomize order of the 11 characters
display tststr in random order
OPQA/ASCII DIGITS: which character is NOT a digit?
if (operator fails to identify nondig) then
fail
goto end_ascii_digit
endif
end_fp_digit:
next prec
next font
pass
end_ascii_digit:
TEST: #SR 3 5 6 34 38 39 40 42
"Text fonts 1 and 2 should be visually distinguishable in
any precision."
fonta = random integer, 1 or 2
fontb = 3 - fonta
numlin = 5
for prec = STRING, CHAR, STROKE
txdif = random integer from 1 to numlin
fonta = 3 - fonta
fontb = 3 - fontb
set text rep #2: font, precision, expansion, spacing, color
1 prec 1.0 0.1 1
set text rep #1: font, precision, expansion, spacing, color
2 prec 1.0 0.1 1
for ix = 1 to numlin
if (ix = txdif) then
set text index = fontb
else
set text index = fonta
endif
display "Test" at next location
next ix
OPQA/DISTINGUISHABILITY OF FONTS 1 AND 2: Which line has a
different font?
if (operator response does not indicate location txdif) then
fail
goto end_distin
endif
next prec
pass
end_distin:
TEST: #SR 3 5 6 38 39 43 44 45 50 57 58 61 62
"In text font 1, all character bodies affected by the same
character height, character expansion factor, and
character spacing should have the same width."
set text alignment = LEFT,BASE
Use <inquire text extent> to determine
ncwh = nominal character width/height ratio for font 1
numlin = number of lines to display = 6
ngline = incorrect line = random number from 1 to numlin
display labels for all numlin lines to be shown
chsp = character spacing = 0.2
for ix = 1 to numlin
chht = random value from .2/numlin to .6/numlin
chexp = random value from .3 to 3
chsiz = horizontal distance per character
= chht * (ncwh*chexp + chsp)
numch = number of characters this string = .6 / chsiz
make sure numch between 4 and 25, else pick new values
numnar = number of narrow characters = numch/2
distrg = display string = numnar narrow characters
followed by (numch-numnar) wide characters
set character height = chht
set text index = ix
set text rep #ix: font, precision, expansion, spacing, color
1, STROKE, chexp, chsp, 1
display distrg at location ix
if (ix = ngline) then
offact = offset factor = .80 or 1.20
else
offact = offset factor = 1.00
endif
draw vertical lines between characters, assuming that chht,
chsp, and chexp are in effect, distorted by offact
next ix
OPQA/FONT 1 MONOSPACED: In which line are the characters NOT
located between the separators?
pass/fail depending on (operator indicates location ngline)
END PROGRAM 12