Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter ElevenSGML Functions (continued)

11.3.8 SGML Values and SGML Math

This section covers functions that assist in the processing of SGML values. Conventionally, SGML attributes are strings or character data (CDATA), the meaning of which depends on the DTD and the systems using the data. This section discusses values that are more in tune with HTML and CSS.

For XML processing, data is generally processed a CDATA thus leaving the supporting application or script to interpret the string content.

Obviously pvalues cannot just be added or subtracted using normal math operators. The first problem is the PT_ type codes will also have math operations performed on them thus destroying the unit values and also becoming part of the equation. A series of functions are provided to normalize, perform math and convert values back to the appropriate units.

When adding or subtracting pvalues they must be normalized. For example, added points to inches does not make sense. One of the values must be normalized using the SGMLNormalizeUnits function. The function converts to TWIPS (20th of a point) and then to the desired unit value.

TWIPS is not a CSS or HTML unit type but is a convenient measurement value because it has a reasonably high resolution value (1 TWIP = 1/1440th of an inch). TWIPS are screen-independent units to ensure that the proportion of screen elements are the same on all display systems. (Note that a TWIP is actually 1440.5 of an inch which also follows that points are treated as 72 points per inch, but are slightly smaller depending on the typesetting reference. The application and Legato work off of the traditional computer values.) It is important to realize that fractional errors can be added in certain circumstances, for example, normalize 1.5in to millimeters and back to inches will result in a value of 1.502in.

TWIPS can also be used manually by converting to and from TWIPS by using the SGMLValueToTWIPS and SGMLTWIPSToValue functions.

Note that many of the value functions do not check for overflow, the signed 27 bit value represents +/- 67108863. or 671088.63 or 6710.8863, depending on the decimal place. For the units, this range is more than adequate (better than 500 feet or inches, 750 feet in points, or better than 0.5km for mm).

While not seemingly obvious, certain unit types do not have a relationship and cannot be generally normalized. For example, inches to seconds, or, points to degrees, etc.... Such operations will result in an undefined value or error. With that in mind, HTML and CSS have a number of measurements in relative sizes such as percent or ems. Certain functions SGMLValueToPixels allow reference values (in TWIPS) to accommodate translation.

Character Entity Functions

Math Functions

Testing Functions

Unit Functions

Value Conversion Functions