Adobe 27510753 Scripting Guide - Page 75
Converting pixel and percentage values, UnitValue object properties
UPC - 718659445294
View all Adobe 27510753 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 75 highlights
Adobe InDesign CS2 Scripting Guide Using ExtendScript Tools and Features 67 tpc traditional pica traditional picas 12 tpt ci cicero ciceros 12.7872 pt px pixel pixels baseless (see below) % percent percent baseless (see below) If an unknown unit type is supplied, the type is set to "?", and the UnitValue object prints as "UnitValue 0.00000". For example, all of the following formats are equivalent: myVal = new UnitValue (12, "cm"); myVal = new UnitValue ("12 cm"); myVal = UnitValue ("12 centimeters"); UnitValue object properties baseUnit type value UnitValue String Number A UnitValue Object that defines the size of one pixel, or a total size to use as a base for percentage values. This is used as the base conversion unit for pixels and percentages; see the "Converting pixel and percentage values" section . Default is 0.013889 inches (1/72 in), which is the base conversion unit for pixels at 72 dpi. Set to null to restore the default. The unit type in abbreviated form; for example, "cm" or "in". The numeric measurement value. UnitValue object functions as unitValueObj.as (unit) Returns the numeric value of this object in the given unit. If the unit is unknown or cannot be computed, generates a run-time error. unit The unit type in abbreviated form; for example, "cm" or "in". convert unitValueObj.convert (unit) Converts this object to the given unit, resetting the type and value accordingly. Returns true if the conversion is successful. If the unit is unknown or the object cannot be converted, generates a run-time error and returns false. unit The unit type in abbreviated form; for example, "cm" or "in". Converting pixel and percentage values Converting measurements among different units requires a common base unit. For example, for length, the meter is the base unit. All length units can be converted into meters, which makes it possible to convert any length unit into any other length unit. Pixels and percentages do not have a standard common base unit. Pixel measurements are relative to display resolution , and percentages are relative to an absolute total size.