Previous Next


                                             750
CHAPTER 8                                                                Interactive Features



To use a number format array to create a text string containing the appropriately
formatted units for display in a user interface, apply Algorithm 8.2:

Algorithm 8.2

   1.   The entry in the rectilinear measure dictionary (see Table 8.111) that references
        the number format array determines the meaning of the initial measurement val-
        ue. For example, the X entry specifies user space units, and the T entry specifies
        degrees.
   2.   Multiply the value specified above by the C entry of the first number format dic-
        tionary in the array, which converts the measurement to units of the largest gran-
        ularity specified in the array. Apply the value of RT as appropriate.
   3.   If the result contains no nonzero fractional portion, concatenate the label speci-
        fied by the U entry in the order specified by O, after adding spacing from PS and
        SS. The formatting is then complete.
   4.   If there is a nonzero fractional portion and no more elements in the array, format
        the fractional portion as specified by the RD, F, D, and FD entries of the last dictio-
        nary. Concatenate the label specified by the U entry in the order specified by O, af-
        ter adding spacing from PS and SS. The formatting is then complete.
   5.   If there is a nonzero fractional portion and more elements in the array, proceed to
        the next number format dictionary in the array. Multiply its C entry by the frac-
        tional result from the previous step. Apply the value of RT as appropriate. Then
        proceed to step 3.

Note: The concatenation of elements in this process assumes left-to-right order. Doc-
uments using right-to-left languages can modify the process and the meaning of the
entries as appropriate to produce the correct results.

Example 8.22 shows a measure dictionary that specifies that changes in x or y are
expressed in miles; distances are expressed in miles, feet, and inches; and area is
expressed in acres. Given a sample distance in scaled units of 1.4505 miles, the
formatted text produced by applying the number format array would be
“1 mi 2,378 ft 7 5/8 in”.

Previous Next