[x3d-public] interaction between 'length' and 'maxExtent' text node fields

Andreas Plesch andreasplesch at gmail.com
Fri Sep 11 10:30:19 PDT 2015


Hello,

the MFFloat 'length' field enforces prescribed lengths for the lines of a
text node. It may squeeze or expand lines. The 'maxExtent' field squeezes
the width of the text to the given width if a line is longer than this
width. From what I interprete from the spec., the squeezing factor would be
applied uniformly to all lines of text to maintain a uniform appearance of
the glyphs, at least if no length field is given. If both are specified
there can be interaction between how the two fields affect the rendering of
the text.

In most interaction cases, the expected result is clear. For example, if
after adjusting all lines to the provided lengths of the 'length' field,
the widest length is smaller than 'maxExtent' width, there is no need to
further manipulate the rendered text.

In other cases, the expected result is less obvious. For example, if after
adjusting all lines to the provided lengths of the 'length' field, the
widest length becomes larger than 'maxExtent' there are two options:

- squeeze only the lines which are now wider than maxExtent
- squeeze all lines by a uniform squeezing factor which is derived from the
longest line

The second option will result in lines that do not have their prescribed
length. The first option seems more viable but will result in line length
to line length ratios which do not correspond to the prescribed ratios.
Simply put, in the first case a length='1 2 3 4' and maxExtent='2' will
look like a column, whereas in the second case it will look like a squeezed
triangle.

So the question may boil down to if the maxExtent squeezing should be
applied line by line, or affect the complete text uniformly. It may need to
behave differently depending on if there is a length field provided or not.
Perhaps this kind of detail is outside of the scope of spec. and should be
left to the discretion of the browser. Is more clarification needed in the
spec. ?

Interaction cases where one of the lengths is 0 indicating no adjustment
probably need similar consideration. For example, a length='1 2 0 4'  and
maxExtent='3' may mean:

- the third line is not modified as long as it is shorter than length 3 or
- the third line is at least squeezed by a factor of 3/4 along with all
other lines.

- if longer than 3, the third line is squeezed to length 3 or
- if between 3 and 4, the third line is squeezed by a factor of 3/4

Two possible algorithms:

Maintain ratios
1) apply lengths
2) find longest length (measure it if length=0)
3) squeeze uniformly if maxExtent < longest length

line by line
1) cap all lengths at maxExtent, if longer
2) for 0 lengths, measure and set to maxExtent if longer
3) apply lengths

Any preference ?

Any thoughts welcome,

Andreas








-- 
Andreas Plesch
39 Barbara Rd.
Waltham, MA 02453
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20150911/02ede701/attachment.html>


More information about the x3d-public mailing list