Reading and writing data

The following instructions make it possible to get and to set a point coordinate, to measure the distance between two points, and to determine the current settings for pixels per em and point size.

Get Coordinate projected onto the projection_vector

GC[a]

Code Range

0x46 - 0x47

a

0: use current position of point p

1: use the position of point p in the original outline

Pops

p: point number (ULONG)

Pushes

value: coordinate location (F26Dot6)

Uses

zp2, projection_vector


Measures the coordinate value of point p on the current projection_vector and pushes the value onto the stack.

Example

The following example shows that the value returned by GC is dependent upon the current position of the projection_vector. Note that point p is at the position (300,420) in the coordinate grid.

GC[1] 9

The projection_vector is parallel to the line from (0,0) to (300,420)

Sets Coordinate From the Stack using projection_vector and freedom_vector

SCFS[ ]

Code Range

0x48

Pops

value: distance from origin to move point (F26Dot6)

p: point number (ULONG)

Pushes

Uses

zp2, freedom_vector, projection_vector


Moves point p from its current position along the freedom_vector so that its component along the projection_vector becomes the value popped off the stack.

Measure Distance

MD[a]

Code Range

0x49 - 0x4A

a

0: measure distance in grid-fitted outline

1: measure distance in original outline

Pops

p1: point number (ULONG)

p2: point number (ULONG)

Pushes

distance (F26Dot6)

Uses

zp1 with point p1, zp0 with point p2, projection_vector


Measures the distance between outline point p1 and outline point p2. The value returned is in pixels (F26Dot6) If distance is negative, it was measured against the projection vector. Reversing the order in which the points are listed will change the sign of the result.

Example:

In the illustration below MD[1] between points 25 and 31 will return a smaller value than MD[0] at 10 pixels per em on a 72 dpi device. The difference is due to the effects of grid-fitting which, at this size, stretches out the counter.

Measure Pixels Per EM

MPPEM[ ]

Code Range

0x4B

Pops

Pushes

ppem: pixels per em (ULONG)


This instruction pushes the number of pixels per em onto the stack. Pixels per em is a function of the resolution of the rendering device and the current point size and the current transformation matrix. This instruction looks at the projection_vector and returns the number of pixels per em in that direction.

Measure Point Size

MPS[ ]

Code Range

0x4C

Pops

Pushes

pointSize: the size in points of the current glyph (F26Dot6)


Pushes the current point size onto the stack.

Measure point size can be used to obtain a value which serves as the basis for choosing whether to branch to an alternative path through the instruction stream. It makes it possible to treat point sizes below or above a certain threshold differently.

12, 18, and 36 point Helvetica g at 72 dpi