Adobe 65010248 Scripting Guide - Page 29

Measurement units, Em space units, item positioning and dimensions

Page 29 highlights

CHAPTER 3: Scripting Illustrator Measurement units 29 Measurement units Illustrator uses points as the unit of measurement for almost all distances. One inch equals 72 points. The exception is values for properties like kerning, tracking, and the aki properties (used for Japanese text composition), which use em units. (See "Em space units" on page 29.) Illustrator uses points when communicating with your scripts regardless of the current ruler units. If your script depends on adding, subtracting, multiplying, or dividing specific measurement values for units other than points, it must perform any unit conversions needed to represent your measurements as points. For example, to use inches for coordinates or measurement units, you must multiply all inch values by 72 when entering the values in your script. The following table shows conversion formulas for various units of measurement: Unit centimeters inches millimeters picas Qs Conversion formula 28.346 points = 1 centimeter 72 points = 1 inch 2.834645 points = 1 millimeter 12 points = 1 pica 0.709 point = 1 Q (1 Q equals 0.23 millimeter) JavaScript provides the UnitValue object type, which offers unit-conversion utilities. For details, see JavaScript Tools Guide. Em space units Values that use em units instead of points are measured in thousandths of an em. An em is proportional to the current font size. For example, in a 6-point font, 1 em equals 6 points; in a 10-point font, 1 em equals 10 points. In a 10-point font, a kerning value of 20 em units is equivalent to: (20 units x 10 points) / 1000 units/em = 0.2 points Page-item positioning and dimensions Illustrator uses simple, two-dimensional geometry in the form of points to record the position of page item objects in a document. Every page item object in a document has a position property that defines a fixed point as a pair of page coordinates in the format [x, y]. The fixed point is the top-left corner of the object's bounding box. For information on the types of objects that comprise the page items collection, see "The artwork tree" on page 19. A point is designated by a pair of coordinates: ➤ The horizontal position, x ➤ The vertical position, y

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57

C
HAPTER
3: Scripting Illustrator
Measurement units
29
Measurement units
Illustrator uses points as the unit of measurement for almost all distances. One inch equals 72 points. The
exception is values for properties like
kerning
,
tracking
, and the
aki
properties (used for Japanese text
composition), which use em units. (See
Em space units
” on page 29
.)
Illustrator uses points when communicating with your scripts
regardless of the current ruler units
. If your
script depends on adding, subtracting, multiplying, or dividing specific measurement values for units
other than points, it must perform any unit conversions needed to represent your measurements as
points. For example, to use inches for coordinates or measurement units, you must multiply all inch values
by 72 when entering the values in your script.
The following table shows conversion formulas for various units of measurement:
JavaScript provides the
UnitValue
object type, which offers unit-conversion utilities. For details, see
JavaScript Tools Guide
.
Em space units
Values that use em units instead of points are measured in thousandths of an em.
An em is proportional to the current font size. For example, in a 6-point font, 1 em equals 6 points; in a
10-point font, 1 em equals 10 points. In a 10-point font, a kerning value of 20 em units is equivalent to:
(20 units x 10 points) / 1000 units/em = 0.2 points
Page-item positioning and dimensions
Illustrator uses simple, two-dimensional geometry in the form of points to record the
position
of
pageitem
objects in a document. Every
page
item
object in a document has a
position
property that
defines a fixed point as a pair of page coordinates in the format [x, y]. The fixed point is the top-left corner
of the object’s bounding box.
For information on the types of objects that comprise the
page
items
collection, see
The artwork tree
” on
page 19
.
A point is designated by a pair of coordinates:
The horizontal position,
x
The vertical position,
y
Unit
Conversion formula
centimeters
28.346 points = 1 centimeter
inches
72 points = 1 inch
millimeters
2.834645 points = 1 millimeter
picas
12 points = 1 pica
Qs
0.709 point = 1 Q (1 Q equals 0.23 millimeter)