Full version, Basic version

Specification link: 10.4 The 'text' element

text-spacing-01-b ← index → text-text-03-b

# text-text-01-b
SVG Image | PNG Image

Test viewer capibility to handle basic use of 'textLength' and 'lengthAdjust' attributes.

There are four pairs of sub-tests. Each pair of sub-tests consists of the same two strings: "Line to Stretch" on the left, and "this is a line to squeeze" on the right.

The first (topmost) pair contains no occurrences of the textLength and lengthAdjust attributes in the 'text' elements. The red reference line under each of the top two strings indicates the approximate length of the strings. Since the lengths are not constrained by the 'textLength' attribute, small variations of the lengths are permissible.

The remaining three pairs each applies 'textLength' attributes to the strings. In the leftmost sub-test of each pair, the 'textLength' value will cause a stretching of the string of approximately 25% over the "normal" length. In the rightmost sub-test of each pair, the 'textLength' value will cause a squeezing of the string of approximately 20% under the "normal" length for the string.

In each of the sub-tests with an application of 'textLength', the red reference lines indicate the exact extent of the rendered text. The rendered text should fit snugly just within the ticks at the end of the red lines.

The second pair from the top contains 'textLength' but no 'lengthAdjust' attributes. In this case, the effect should be as if the value "spacing" were specified. Only the inter-character advancement and inter-word spacing should change. The aspect ratio of the glyphs should be unaffected. The reference image illustrates one valid way to achieve this, by a uniform increase or decrease of inter-character advancement.

The third pair from the top explicitly sets 'lengthAdjust' value to "spacing". Therefore it should be rendered identically to the second pair.

The fourth (bottommost) sub-test pair explicitly sets 'lengthAdjust' value to "spacingAndGlyphs". The advancements between characters and words, as well as the glyph aspect ratios should be affected. The reference image illustrates one valid way to achieve this, by a uniform expansion or compression of the string as a whole. This effect is equivalent to application of a "scale(xfactor, 1.0)" transformation to the 'text' elements.

The rendered picture should match the reference image, except as noted above. In particular, the 'textLength' constraint must be satisfied precisely, and the basic rules associated with the "spacing" and "spacingAndGlyphs" values of 'lengthAdjust' must be met, but the precise algorithm for meeting all of the required contraints is otherwise unspecified.

The test also uses the 'transform' attribute, the 'rect' element, as well as basic fill (solid primary colors), stroke (black 1-pixel lines), font-family (Arial) and font-size properties.

text-spacing-01-b ← index → text-text-03-b

Distributed under both the W3C Test Suite License and the W3C 3-clause BSD License.
To contribute to a W3C Test Suite, see the policies and contribution forms.