Apple Type Services for Fonts Reference (Not Recommended)

Framework
ApplicationServices/ApplicationServices.h
Declared in
ATSFont.h
ATSTypes.h

Overview

Apple Type Services for Fonts is a collection of functions and data types that you can use to access and manage font data in Mac OS X. It is designed to handle a wide range of font technologies and data formats. The programming interface is designed with performance, scalability, and consistency in mind, and is available to Cocoa and Carbon applications through the Apple Type Services (ATS) and QuickDraw frameworks in Mac OS X.

Functions by Task

Activating and Deactivating Fonts

Working With Font Families

Working With Fonts

Setting Up Notifications and Queries

Creating, Calling, and Deleting Universal Procedure Pointers

Callbacks by Task

ATS Callbacks

The callbacks in this section are used by ATS for Fonts.

FM Callbacks

The callbacks in this section are used by the Font Manager.

Callbacks

ATSFontApplierFunction

Defines a pointer to a customized function to be applied to a font iteration.

typedef OSStatus (*ATSFontApplierFunction) (
   ATSFontRef iFont,
   void * iRefCon
);

If you name your function MyATSFontApplierFunction, you would declare it like this:

OSStatus MyATSFontApplierFunction (
   ATSFontRef iFont,
   void * iRefCon
);

Parameters
iFont

A font reference. This is the font on which your callback operates.

iRefCon

An arbitrary 32-bit value specified by your application and that is passed to your callback.

Discussion

You provide a pointer to an ATSFontApplierFunction callback as a parameter to the function ATSFontApplyFunction. You can also provide a pointer to an ATSFontApplierFunction callback in the ATSFontFilter data structure. This structure can be passed as a parameter to the functions ATSFontIteratorCreate and ATSFontIteratorReset.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSFont.h

ATSFontFamilyApplierFunction

Defines a pointer to a customized function to be applied to a font family iteration.

typedef OSStatus (*ATSFontFamilyApplierFunction) (
   ATSFontFamilyRef iFamily,
   void * iRefCon
);

If you name your function MyATSFontFamilyApplierFunction, you would declare it like this:

OSStatus MyATSFontFamilyApplierFunction (
   ATSFontFamilyRef iFamily,
   void * iRefCon
);

Parameters
iFamily

A font family reference. This is the font family on which your callback operates.

iRefCon

An arbitrary 32-bit value specified by your application and that is passed to your callback.

Discussion

You provide a pointer to an ATSFontFamilyApplierFunction callback as a parameter to the function ATSFontFamilyApplyFunction. You can also provide a pointer to an ATSFontApplierFunction callback in the ATSFontFilter data structure. This structure can be passed as a parameter to the functions ATSFontFamilyIteratorCreate and ATSFontFamilyIteratorReset.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSFont.h

ATSFontQueryCallback

Defines a pointer to a customized function that handles font queries.

typedef CFPropertyListRef (*ATSFontQueryCallback) (
   ATSFontQueryMessageID msgid,
   CFPropertyListRef data
   void * iRefCon
);

If you name your function MyATSFontQueryCallback, you would declare it like this:

CFPropertyListRef MyATSFontQueryCallback (
   ATSFontQueryMessageID msgid,
   CFPropertyListRef data
   void * iRefCon
);

Parameters
msgid

An ATSFontQueryMessageID value that identifies the message type your application receives from ATS. See “Font Query Message ID” for the constants you can supply.

data

A CFPropertyListRef that represents the font query. The content of the CFPropertyList is specific to the message type. The property list should contain data that specifies the font for which the query is sent.

iRefCon

An arbitrary 32-bit value specified by your application and that is passed to your callback.

Return Value

A CFPropertyListRef that represents your application’s response to the query. The content of the CFPropertyList is specific to the message type, and it may be NULL.

Discussion

ATS for Fonts calls your customized function each time ATS receives a font query from another application. You provide a pointer to an ATSFontQueryCallback as a parameter to the function ATSCreateFontQueryRunLoopSource.

Availability
  • Available in OS X v10.2 and later.
Declared In
ATSFont.h

ATSNotificationCallback

Defines a pointer to a customized function that handles notifications.

typedef void (*ATSNotificationCallback) (
   ATSFontNotificationInfoRef info,
   void * iRefCon
);

If you name your function MyATSNotificationCallback, you would declare it like this:

void MyATSNotificationCallback (
   ATSFontNotificationInfoRef info,
   void * iRefCon
);

Parameters
info

Reserved for future use. Currently, your callback is passed NULL.

iRefCon

An arbitrary 32-bit value specified by your application and that is passed to your callback.

Discussion

ATS for Fonts calls your customized function each time ATS receives a font notification from another application. You provide a pointer to an ATSNotificationCallback callback function as a parameter to the function ATSFontNotificationSubscribe.

Availability
  • Available in OS X v10.2 and later.
Declared In
ATSFont.h

FMFontCallbackFilterProcPtr

Defines a pointer to a customized filter function to be used with a font iterator.

typedef OSStatus (*FMFontCallbackFilterProcPtr) (
   FMFont iFont,
   void * iRefCon
);

If you name your function MyFMFontCallbackFilterProc, you would declare it like this:

OSStatus MyFMFontCallbackFilterProcPtr (
   FMFont iFont,
   void * iRefCon
);

Parameters
iFont

A font reference. This is the font on which your callback operates.

iRefCon

A pointer to arbitrary data that defines your custom filter.

Discussion

The Font Manager calls your customized function each time it obtains a font in a font iteration. You can use a custom filter function in any Font Manager function that has a parameter of type FMFilter. You provide a universal procedure pointer to your filter callback function in the FMFilter data structure. First, you must use the NewFMFontCallbackFilterUPP function to create a universal procedure pointer (UPP) of type FMFontCallbackFilterUPP. You can do so with code similar to the following:

FMFontCallbackFilterUPP MyFMFontFilterUPPMyFMFontFilterUPP = NewFMFontCallbackFilterUPP (&MyFMFontCallbackFilterCallback)

Your application must specify the result code that should be returned by the Font Manager. Any value other than noErr will cause the iterator to ignore a font.

When you are finished with your filter callback function, you should use the DisposeFMFontCallbackFilterUPP function to dispose of the UPP associated with it. However, if you plan to use the same filter callback function in subsequent calls, you can reuse the same UPP, rather than dispose of it and later create a new UPP.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

FMFontFamilyCallbackFilterProcPtr

Defines a pointer to a customized filter function to be used with a font family iterator.

typedef OSStatus (*FMFontFamilyCallbackFilterProcPtr) (
   FMFontFamily iFontFamily,
   void * iRefCon
);

If you name your function MyFMFontFamilyCallbackFilterProc, you would declare it like this:

OSStatus MyFMFontFamilyCallbackFilterProcPtr (
   FMFontFamily iFontFamily,
   void * iRefCon
);

Parameters
iFontFamily

A font family reference. This is the font family on which your callback operates.

iRefCon

A pointer to arbitrary data that defines your custom filter.

Discussion

The Font Manager calls your customized function each time it obtains a font family in a font family iteration. You can use a custom filter function in any Font Manager function that has a parameter of type FMFilter. You provide a universal procedure pointer to your filter callback function in the FMFilter data structure. First, you must use the function NewFMFontFamilyCallbackFilterUPP to create a universal procedure pointer (UPP) of type FMFontFamilyCallbackFilterUPP. You can do so with code similar to the following:

FMFontFamilyCallbackFilterUPP MyFMFontFamilyFilterUPPMyFMFontFamilyFilterUPP = NewFMFontFamilyCallbackFilterUPP (&MyFMFontFamilyCallbackFilterCallback)

Your application must specify the result code that should be returned by the Font Manager. Any value other than noErr will cause the iterator to ignore a font family.

When you are finished with your filter callback function, you should use the DisposeFMFontFamilyCallbackFilterUPP function to dispose of the UPP associated with it. However, if you plan to use the same filter callback function in subsequent calls, you can reuse the same UPP, rather than dispose of it and later create a new UPP.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

Data Types

ATS Data Types

The data types in this section are used by ATS for Fonts.

ATSFontContainerRef

An opaque data type that represents a reference to a font file or folder.

typedef UInt32 ATSFontContainerRef;
Discussion

A font container reference is an opaque type used as a parameter in the functions ATSFontActivateFromFileSpecification and ATSFontActivateFromMemory.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

ATSFontFamilyIterator

An opaque data type that represents a font family iterator.

typedef struct ATSFontFamilyIterator_ * ATSFontFamilyIterator;
Discussion

You initialize a structure of type ATSFontFamilyIterator by calling the function ATSFontFamilyIteratorCreate. You should not attempt to modify the contents of a font family iterator.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSFont.h

ATSFontFamilyRef

An opaque data type that represents a font family reference.

typedef UInt32 ATSFontFamilyRef;
Discussion

Unlike font family and font names which are part of a font’s data, data types, such as ATSFontFamily represent values that are arbitrarily assigned by ATS at system startup. These values can change when the system is restarted.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

ATSFontFilter

Contains font filter information.

struct ATSFontFilter {
   UInt32 version
   ATSFontFilterSelector filterSelector
   union {
      ATSGeneration generationFilter;
      ATSFontFamilyRef fontFamilyFilter;
      ATSFontFamilyApplierFunction fontFamilyApplierFunctionFilter;
      ATSFontApplierFunction fontApplierFunctionFilter;
   } filter;
};
typedef struct ATSFontFilter ATSFontFilter;
Fields
version

The version of the filter.

filterSelector

A font filter selector. See “Font Filter Selectors”for a list of the filter selectors you can specify.

filter

A union whose contents are specified by the filterSelector field.

generationFilter

An ATSGeneration value that specifies the generation to which you want to restrict an operation.

fontFamilyFilter

A font family reference that specifies the font family to which you want to restrict an operation.

fontFamilyApplierFunctionFilter

A pointer the callback you want applied to a font family iteration. See ATSFontFamilyApplierFunction for more information on the callback you can supply.

fontApplierFunctionFilter

A pointer the callback you want applied to a font iteration. See ATSFontApplierFunction for more information on the callback you can supply.

Discussion

You can pass an ATSFontFilter structure to the functions ATSFontFamilyIteratorCreate, ATSFontFamilyIteratorReset, ATSFontIteratorCreate, and ATSFontIteratorReset.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSFont.h

ATSFontIterator

An opaque data type that represents a font iterator.

typedef struct ATSFontIterator_ * ATSFontIterator;
Discussion

You initialize a structure of type ATSFontIterator by calling the function ATSFontIteratorCreate. You should not attempt to modify the contents of a font iterator.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSFont.h

ATSFontMetrics

Contains metrics for a font.

struct ATSFontMetrics {
   UInt32 version;
   Float32 ascent;
   Float32 descent;
   Float32 leading;
   Float32 avgAdvanceWidth;
   Float32 maxAdvanceWidth;
   Float32 minLeftSideBearing;
   Float32 minRightSideBearing;
   Float32 stemWidth;
   Float32 stemHeight;
   Float32 capHeight;
   Float32 xHeight;
   Float32 italicAngle;
   Float32 underlinePosition;
   Float32 underlineThickness;
};
typedef struct ATSFontMetrics ATSFontMetrics;
Fields
version

The version of the font metrics structure.

ascent

The maximum height from the baseline to the ascent line of the glyphs in the font. For vertical text, the maximum distance from the center line to the ascent line of the glyphs in the font.

descent

The maximum distance from the baseline to the descent line of the the glyphs in the font. For vertical text, the maximum distance from center line to the descent line of the glyphs in the font.

leading

The spacing from the descent line to the ascent line below it. This defines the spacing between lines of text

avgAdvanceWidth

The average advance width of the glyph in the font.

maxAdvanceWidth

The maximum advance width of the glyphs in the font.

minLeftSideBearing

The minimum left-side bearing value of the glyphs in the font. For vertical text, the minimum top-side bearing value of the glyphs in the font.

minRightSideBearing

The minimum right-side bearing value of the glyphs in the font. For vertical text, the minimum bottom side bearing of a glyphs in the font.

stemWidth

The width of the dominant vertical stems of the glyphs in the font.

stemHeight

The vertical width of the dominant horizontal stems of glyphs in the font.

capHeight

The height of a capital letter in the font from the baseline to the top of the letter.

xHeight

The height of lowercase characters in the font, specifically the letter x, excluding ascenders and descenders.

italicAngle

The angle (in degrees counterclockwise) at which glyphs in the font slant when italicized.

underlinePosition

The position at which an underline stroke should be placed for the font.

underlineThickness

The thickness, in pixels, of the underscore character used to underline the glyphs in the font.

Discussion

This structure is passed as a parameter to the functions ATSFontGetHorizontalMetrics and ATSFontGetVerticalMetrics.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

ATSFontNotificationInfoRef

An opaque data type that represents a font notification information structure.

typedef struct ATSFontNotificationInfoRef_ * ATSFontNotificationInfoRef;
Discussion

This data type is used in the ATSNotificationCallback callback function.

Availability
  • Available in OS X v10.2 and later.
Declared In
ATSFont.h

ATSFontNotificationRef

An opaque data type that represents a font notification structure.

typedef struct ATSFontNotificationRef_ * ATSFontNotificationRef;
Discussion

The ATSFontNotificationRef data type is returned by the function ATSFontNotificationSubscribe and passed as a parameter to the function ATSFontNotificationUnsubscribe.

Availability
  • Available in OS X v10.2 and later.
Declared In
ATSFont.h

ATSFontQuerySourceContext

Contains font query information that is passed back to a font query callback.

struct ATSFontQuerySourceContext {
   UInt32 version;
   void * refCon;
   CFAllocatorRetainCallBack retain;
   CFAllocatorReleaseCallBack release;
};
typedef struct ATSFontQuerySourceContext ATSFontQuerySourceContext;
Fields
version

A 32-bit unsigned integer that indicates the version of this data structure. You can set this value to 0.

refCon

An arbitrary 32-bit value specified in your font query callback function.

retain

A callback you supply for increasing the retention count associated with the refCon value. The CFAllocatorRetainCallBack is defined in the header file CFBase.h. For more information on Core Foundation allocators, see the Core Foundation Base Services Reference.

release

A callback you supply for decreasing the retention count associated with the refCon value. The CFAllocatorReleaseCallBack is defined in the header file CFBase.h.

Discussion

You pass a ATSFontQuerySourceContext data structure to the function ATSCreateFontQueryRunLoopSource.

Availability
  • Available in OS X v10.2 and later.
Declared In
ATSFont.h

ATSFontRef

An opaque data type that represents a font reference.

typedef UInt32 ATSFontRef;
Discussion

Unlike font names which are part of a font’s data, data types, such as ATSFontRef represent values that are arbitrarily assigned by ATS at system startup. These values can change when the system is restarted.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

ATSFontSize

Represents a font size.

typedef Float32 ATSFontSize;
Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

ATSGeneration

Represents a generation count.

typedef UInt32 ATSGeneration;
Discussion

The generation count data type is used by ATS for Fonts to keep track of the generation of the font database, each font family, and each font. You can obtain a generation count from the functions ATSGetGeneration, ATSFontFamilyGetGeneration, and ATSFontGetGeneration.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

ATSOptionFlags

Represents options you can pass to various ATS functions.

typedef OptionBits ATSOptionFlags;
Discussion

There are a variety of options associated with this data type. See “Assorted Options,” “Scoping Options,” and “Iteration Precedence Options.”

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

FM Data types

The data types in this section are used by the Font Manager.

FMFilter

Contains a filter format, a selector and filter information.

struct FMFilter {
   UInt32 format
   FMFilterSelector selector
   union {
      FourCharCode fontTechnologyFilter;
      FSSpec fontContainerFilter;
      FMGeneration generationFilter;
      FMFontFamilyCallbackFilterUPP fontFamilyCallbackFilter;
      FMFontCallbackFilterUPP fontCallbackFilter;
      FMFontDirectoryFilter fontDirectoryFilter;
   } filter;
};
typedef struct FMFilter FMFilter;
Fields
format

A filter format. For possible values, see FM Filter Format.

selector

A filter selector. The selector indicates the data contained in the union. For possible values, see “FM Filter Selectors.”

filter

The filter you want to use to restrict an operation. The filter must correspond to the selector parameter. If you are using a custom filter, you should provide a universal procedure pointer that is either of type FMFontFamilyCallbackFilterUPP or FMFontCallBackFilterUPP.

fontTechnologyFilter

A FourCharCode value that specifies the font technology to which you want to restrict an operation. See “FM Font Technologies” for constants you can supply.

fontContainerFilter

A pointer to the file specification that specifies the name and location of a file or directory to which you want to restrict an operation.

generationFilter

The generation count to which you want to restrict an operation.

fontFamilyCallbackFilter

The font family callback that you want to use to restrict an operation.

fontCallbackFilter

The font callback that you want to use to restrict an operation.

fontDirectoryFilter

The font directory filter that you want to use to restrict an operation.

Discussion

You use the FMFilter data structure when you want to restrict the enumeration and activation functions to the criteria specified by a filter.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

FMFont

An opaque data type that specifies a font registered with the font database.

typedef UInt32 FMFont;
Discussion

You should not modify this value.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

FMFontCallbackFilterUPP

Defines a universal procedure pointer to a font filter callback.

typedef FMFontCallbackFilterProcPtr FMFontCallbackFilter;
Discussion

For more information, see the description of the FMFontCallbackFilterProcPtr callback function.

FMFontDirectoryFilter

Contains font directory information used to restrict a font iteration.

struct FMFontDirectoryFilter {
   SInt16 fontFolderDomain;
   UInt32 reserved[2];
};
typedef struct FMFontDirectoryFilter FMFontDirectoryFilter;
Fields
fontFolderDomain

A signed 16-bit integer that specifies the directory to which you want to restrict the font iteration.

reserved

Reserved for future use.

Discussion

You supply the FMFontDirectoryFilter data structure as part of the FMFilter data structure when you want to restrict a font iteration to a font directory.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

FMFontFamily

A reference to a collection of fonts with the same design characteristics.

typedef SInt16 FMFontFamily;
Discussion

The font family reference replaces the QuickDraw font ID and can be used with all QuickDraw functions including GetFontName and TextFont. Unlike the QuickDraw font identifier, the font family reference cannot be passed to the Resource Manager to access information from a 'FOND' resource. A font family reference does not imply a script system, nor is the character encoding of a font family determined by an arithmetic mapping of the font family reference.

The fonts associated with a font family consist of individual outline fonts that may be used with the font access functions of the Font Manager and ATSUI.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

FMFontFamilyCallbackFilterUPP

Defines a universal procedure pointer to a font family filter callback.

typedef FMFontFamilyCallbackFilterProcPtr FMFontFamilyCallbackFilter;
Discussion

For more information, see the description of the FMFontFamilyCallbackFilterProcPtr callback function.

FMFontFamilyInstance

Contains a font family reference and a QuickDraw style.

struct FMFontFamilyInstance {
   FMFontFamily fontFamily;
   FMFontStyle fontStyle;
};
typedef struct FMFontFamilyInstance FMFontFamilyInstance;
Fields
fontFamily

A font family reference.

fontStyle

A QuickDraw font style.

Discussion

Each font object can map to one or more font family instance. This mapping is equivalent to the information stored in the font association table of the 'FOND' resource, except the font family instance does not contain a point size descriptor. Since a font object represents the entire array of point sizes for a given font, only the font family reference and style are required to specify fully any given font object.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

FMFontFamilyInstanceIterator

An opaque structure used to enumerate font family instances.

struct FMFontFamilyInstanceIterator {
   UInt32 reserved[16];
};
typedef struct FMFontFamilyInstanceIterator FMFontFamilyInstanceIterator;
Fields
reserved

Reserved for Apple’s use.

Discussion

You initialize a structure of type FMFontFamilyInstanceIterator by calling the function FMCreateFontFamilyInstanceIterator. You should not attempt to modify the contents of a font family instance iterator.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

FMFontFamilyIterator

An opaque structure used to enumerate font families.

struct FMFontFamilyIterator {
   UInt32 reserved[16];
};
typedef struct FMFontFamilyIterator FMFontFamilyIterator;
Fields
reserved

Reserved for Apple’s use.

Discussion

You initialize a structure of type FMFontFamilyIterator by calling the function FMCreateFontFamilyIterator. You should not attempt to modify the contents of a font family iterator.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

FMFontIterator

An opaque structure used to enumerate fonts.

struct FMFontIterator {
   UInt32 reserved[16];
};
typedef struct FMFontIterator FMFontIterator;
Fields
reserved

Reserved for Apple’s use.

Discussion

You initialize a structure of type FMFontIterator by calling the function FMCreateFontIterator. You should not attempt to modify the contents of a font iterator.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

FMFontSize

Represents a font size.

typedef SInt16 FMFontSize;
Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

FMFontStyle

Represents a font style.

typedef SInt16 FMFontStyle;
Discussion

The low 8 bits of a Font Manager font style correspond to a QuickDraw style.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

FMGeneration

Keeps track of any operation that adds, deletes, or modifies one or more fonts or font family objects.

typedef UInt32 FMGeneration;
Discussion

Any operation that adds, deletes, or modifies one or more fonts or font family objects triggers an update of a global generation seed value. Each font and font family modified during a transaction is tagged with a copy of the generation seed.

You can use the function FMGetGeneration to get the current value of the generation seed. Then you can use this information in conjunction with the functions FMGetFontGeneration and FMGetFontFamilyGeneration to identify any changes in the font database.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

ATSUI Data Types

The data types in this section are used by Apple Type Services for Unicode Imaging (ATSUI).

ATSGlyph

Represents a glyph code.

typedef UInt16 ATSGlyph;

ATSGlyphIdealMetrics

Contains ideal (resolution-independent) metrics for a glyph.

struct ATSGlyphIdealMetrics {
   Float32Point advance;
   Float32Point sideBearing;
   Float32Point otherSideBearing;
};
typedef struct ATSGlyphIdealMetrics ATSGlyphIdealMetrics;
Fields
advance

The amount by which the pen is advanced after drawing the glyph.

sideBearing

The offset from the glyph origin to the beginning of the glyph image.

otherSideBearing

The offset from the end of the glyph image to the end of the glyph advance.

Discussion

This data structure is passed as a parameter to the ATSUI function ATSUGlyphGetIdealMetrics. For more information, see Inside Mac OS X: ATSUI Reference.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

ATSGlyphRef

Represents a glyph reference.

typedef UInt16 ATSGlyphRef;
Discussion

This data type is used in the ATSUI data structure ATSLayoutRecord. For information, see Inside Mac OS X: ATSUI Reference.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

ATSGlyphScreenMetrics

Contains device-adjusted font metric information for glyphs in a font.

struct ATSGlyphScreenMetrics {
   Float32Point deviceAdvance;
   Float32Point topLeft;
   UInt32 height;
   UInt32 width;
   Float32Point sideBearing;
   Float32Point otherSideBearing;
};
typedef struct ATSGlyphScreenMetrics ATSGlyphScreenMetrics;
Fields
deviceAdvance

The number of pixels of the advance for the glyph as actually drawn on the screen.

topLeft

The top-left point of the glyph in device coordinates.

height

The height of the glyph, in pixels. The glyph specified by this value may overlap with other glyphs when drawn.

width

The width of the glyph, in pixels. The glyph specified by this value may overlap with other glyphs when drawn.

sideBearing

The origin-side bearing, in pixels.

otherSideBearinge

The trailing-side bearing, in pixels.

Discussion

The ATSGlyphScreenMetrics data structure contains metrics for where glyphs should be drawn on the screen. The metrics include any adjustments needed to display the glyphs properly on the current screen. The structure is returned by the ATSUI function ATSUGlyphGetScreenMetrics. Many of the metrics in this structure are Float32Point data types so the metrics can integrate with Quartz functions, which all require Float32Point data types.

For information on the ATSUI function ATSUGlyphGetScreenMetrics, see Inside Mac OS X: ATSUI Reference.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

ATSUCurvePath

Contains curve information for a glyph path.

struct ATSUCurvePath {
   UInt32 vectors;
   UInt32 controlBits[1];
   Float32Point vector[1];
};
typedef struct ATSUCurvePath ATSUCurvePath;
Fields
vectors

The number of values in each of the controlBits and vector arrays.

controlBits

An array of control bit values that, together with the values in the vector array, define one cubic curve in a glyph.

vector

An array of vector values that, together with the values in the controlBits array, define one cubic curve in a glyph.

Discussion

This data structure is used in the ATSUCurvePaths data structure. The ATSUCurvePaths data structure is passed as a parameter to the ATSUI function ATSUGlyphGetCurvePaths. For more information, see Inside Mac OS X: ATSUI Reference.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

ATSUCurvePaths

Contains curve information for an array of glyph paths.

struct ATSUCurvePaths {
   UInt32 contours;
   ATSUCurvePath contour[1];
};
typedef struct ATSUCurvePaths ATSUCurvePaths;
Fields
contours

The number of cubic curves contained in the contour array.

contour

An array of cubic curves that define the outline of a glyph.

Discussion

The ATSUCurvePaths data structure is passed as a parameter to the ATSUI function ATSUGlyphGetCurvePaths. For more information, see Inside Mac OS X: ATSUI Reference.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

GlyphID

Represents a reference to a glyph.

typedef ATSGlyphRef GlyphID;
Discussion

The GlyphID data type is used by ATSUI. For more information, see Inside Mac OS X: ATSUI Reference.

Availability
  • Available in OS X v10.0 and later.
Declared In
ATSTypes.h

Constants

ATS Constants

Assorted Options

Specify assorted options.

enum {
   kATSOptionFlagsDefault = kNilOptions,
   kATSOptionFlagsComposeFontPostScriptName = 1 << 0,
   kATSOptionFlagsUseDataForkAsResourceFork = 1 << 8,
   kATSOptionFlagsUseResourceFork = 2 << 8,
   kATSOptionFlagsUseDataFork = 3 << 8
};
Constants
kATSOptionFlagsDefault

Specifies to use the default setting.

Available in OS X v10.0 and later.

Declared in ATSFont.h.

kATSOptionFlagsComposeFontPostScriptName

Specifies the composed PostScript name of a font.

Available in OS X v10.0 and later.

Declared in ATSFont.h.

kATSOptionFlagsUseDataForkAsResourceFork

Specifies to use the data fork of a font as a resource fork. You can pass this option in the iOptions parameter for the function ATSFontActivateFromFileSpecification.

Available in OS X v10.0 and later.

Declared in ATSFont.h.

kATSOptionFlagsUseResourceFork

Specifies to use the resource fork of a font.

Available in OS X v10.0 and later.

Declared in ATSFont.h.

kATSOptionFlagsUseDataFork

Specifies to use the data fork of a font.

Available in OS X v10.0 and later.

Declared in ATSFont.h.

Automatic Activation Settings

Values for automatic activation settings.

enum {
   kATSFontAutoActivationDefault = 0,
   kATSFontAutoActivationDisabled = 1,
   kATSFontAutoActivationEnabled = 2,
   kATSFontAutoActivationAsk     = 4
}
typedef UInt32  ATSFontAutoActivationSetting;
Constants
kATSFontAutoActivationDefault

Resets the setting the the default state. For application settings this clears the setting. For the global setting, it reverts to the initial system setting, kATSFontAutoActivationEnabled.

Available in OS X v10.5 and later.

Declared in ATSFont.h.

kATSFontAutoActivationAsk

Asks the user before automatically activating fonts requested by the application.

Available in OS X v10.5 and later.

Declared in ATSFont.h.

kATSFontAutoActivationEnabled

Enables automatic activation of fonts.

Available in OS X v10.5 and later.

Declared in ATSFont.h.

kATSFontAutoActivationDisabled

Disables automatic activation of fonts.

Available in OS X v10.5 and later.

Declared in ATSFont.h.

Declared In
ATSFont.h

Context Options

Specify a context to use when enumerating, activating, or deactivating fonts and font families.

typedef UInt32 ATSFontContext;
enum {
   kATSFontContextUnspecified = 0,
   kATSFontContextGlobal = 1,
   kATSFontContextLocal = 2
};
Constants
kATSFontContextUnspecified

Indicates a context is not specified. This option has the same result as providing the option kATSFontContextLocal.

Available in OS X v10.0 and later.

Declared in ATSFont.h.

kATSFontContextGlobal

Specifies to use a global context. Fonts with a global context are available to all applications on the system.

Available in OS X v10.0 and later.

Declared in ATSFont.h.

kATSFontContextLocal

Specifies to use a local context. Fonts with a local context are available to your application.

Available in OS X v10.1 and later.

Declared in ATSFont.h.

Discussion

Context refers to the font’s availability and can be local or global. You provide a context as an option to such functions as ATSFontActivateFromFileSpecification, ATSFontActivateFromMemory, ATSFontFamilyIteratorCreate, ATSFontFamilyIteratorReset. ATSFontIteratorCreate, and ATSFontIteratorReset.

Data Not Specified Constants

Indicate data that is not specified.

enum {
   kATSGenerationUnspecified = 0,
   kATSFontContainerRefUnspecified = 0,
   kATSFontFamilyRefUnspecified = 0,
   kATSFontRefUnspecified = 0
};
Constants
kATSGenerationUnspecified

Indicates the generation is not specified.

Available in OS X v10.0 and later.

Declared in ATSTypes.h.

kATSFontContainerRefUnspecified

Indicates the font container reference is not specified.

Available in OS X v10.0 and later.

Declared in ATSTypes.h.

kATSFontFamilyRefUnspecified

Indicates the font family reference is not specified.

Available in OS X v10.0 and later.

Declared in ATSTypes.h.

kATSFontRefUnspecified

Indicates the font reference is not specified.

Available in OS X v10.0 and later.

Declared in ATSTypes.h.

Discussion

You can pass these constants to functions when you either don’t know the appropriate value or do not care to obtain the associated information. These constants can also be returned to you to indicate an error.

Font Filter Selectors

Specify the type of criteria to use when limiting an iteration.

enum ATSFontFilterSelector {
   kATSFontFilterSelectorUnspecified = 0,
   kATSFontFilterSelectorGeneration = 3,
   kATSFontFilterSelectorFontFamily = 7,
   kATSFontFilterSelectorFontFamilyApplierFunction = 8,
   kATSFontFilterSelectorFontApplierFunction = 9
};
typedef enum ATSFontFilterSelector ATSFontFilterSelector;
Constants
kATSFontFilterSelectorUnspecified

Specifies to limit an iteration based on unspecified criteria. In this case, the default is used, which is to iterate using a local context with an unrestricted scope.

Available in OS X v10.0 and later.

Declared in ATSFont.h.

kATSFontFilterSelectorGeneration

Specifies to limit an iteration based on generation criteria.

Available in OS X v10.0 and later.

Declared in ATSFont.h.

kATSFontFilterSelectorFontFamily

Specifies to limit an iteration based on font family criteria.

Available in OS X v10.0 and later.

Declared in ATSFont.h.

kATSFontFilterSelectorFontFamilyApplierFunction

Specifies to limit an iteration based on criteria defined by a font family applier function.

Available in OS X v10.0 and later.

Declared in ATSFont.h.

kATSFontFilterSelectorFontApplierFunction

Specifies to limit an iteration based on criteria defined by a font applier function.

Available in OS X v10.0 and later.

Declared in ATSFont.h.

Discussion

You use these constants in the data structure ATSFontFilter to specify the type of data in the filter union.

Font Filter Versions

Specify the version of a font filter.

typedef UInt32 ATSFontFormat;
enum {
   kATSFontFilterCurrentVersion = 0
};
Constants
kATSFontFilterCurrentVersion

Specifies to use the current version of a font filter.

Available in OS X v10.0 and later.

Declared in ATSFont.h.

Discussion

There is currently only one constant in this enumeration. You can assign this constant to the version field in the ATSFontFilter data structure.

Font Formats

Specify a font format.

enum {
   kATSFontFormatUnspecified = 0
};
Constants
kATSFontFormatUnspecified

Indicates the font format is not specified. You can pass this in the iFormat parameter of the function ATSFontActivateFromFileSpecification.

Available in OS X v10.0 and later.

Declared in ATSTypes.h.

Discussion

There are no other font formats currently defined for this enumeration.

Font Request Query Keys

Represent keys in a font request query dictionary.

#define kATSQueryClientPID                                               CFSTR("ATS client
pid")
#define kATSQueryQDFamilyName               CFSTR("font family
name")
#define kATSQueryFontName               CFSTR("font name")
#define kATSQueryFontPostScriptName     CFSTR("font PS name")
#define kATSQueryFontNameTableEntries   CFSTR("font name table
entries")
#define kATSFontNameTableCode           CFSTR("font name code")
#define kATSFontNameTablePlatform       CFSTR("font platform
code")
#define kATSFontNameTableScript         CFSTR("font script
code")
#define kATSFontNameTableLanguage       CFSTR("font language
code")
#define kATSFontNameTableBytes                                              CFSTR("font
name table bytes")
Constants
kATSQueryClientPID

Specifies a process ID. The value associated with this key is a CFNumberRef value that refers to a the process ID (pid_t) of the application making the query.

kATSQueryQDFamilyName

Specifies a QuickDraw family name. The value associated with this key is a CFStringRef value that refers to the QuickDraw family name of the requested font. For example, the name passed to the function GetFNum.

kATSQueryFontName

Specifies a font name. The value associated with this key is a CFStringRef value that refers to the full name of the requested font. You can use this font name as an argument to the function ATSFontFindFromName.

kATSQueryFontPostScriptName

Specifies the PostScript name of a font. The value associated with this key is a CFStringRef value that refers to either the PostScript name derived from the font's FOND resource or from the font’s 'sfnt' name table, with preference given to the FOND PostScript name. You can use this font name as an argument to the function ATSFontFindFromPostScriptName.

kATSQueryFontNameTableEntries

Specifies the descriptor for 'sfnt' name table entries. The value associated with this key an array (CFArrayRef ) of CFDictionaryRef values that describe entries in a name table. A font must have all of the specified entries to be considered a match.

kATSFontNameTableCode

Specifies the font name's name code. The value associated with this key is a CFNumberRef. If no value is specified, the value kFontNoNameCode is used.

kATSFontNameTablePlatform

Specifies the font name's platform code. The value associated with this key is a CFNumberRef. If no value is specified, the value kFontNoPlatformCode is used.

kATSFontNameTableScript

Specifies the font name's script code. The value associated with this key is a CFNumberRef. If no value is specified, the value kFontNoScriptCode is used.

kATSFontNameTableLanguage

Specifies the font name's language code. The value associated with this key is a CFNumberRef. If no value is specified, the value kFontNoLanguageCode is used.

kATSFontNameTableBytes

Specifies the raw bytes of the font name. The value associated with this key is a CFDataRef value that refers to the raw name bytes for the font.

Discussion

Font request query keys appear in the dictionary passed to, and returned by, your ATSFontQueryCallback callback function. The keys comprise a property list (CFPropertyList) that defines the query sent to your callback. On return, you supply a property list that specifies your response to the query.

Font Query Message ID

Specifies a message ID for a font request query.

enum ATSFontQueryMessageID {
   kATSQueryActivateFontMessage = 'atsa'
};
typedef enum ATSFontQueryMessageID ATSFontQueryMessageID;
Constants
kATSQueryActivateFontMessage

Specifies to activate a font message. The data associated with this message ID is a flattened CFDictionaryRef. The CFDictionary contains on or more of the keys described in “Font Request Query Keys.”

Available in OS X v10.2 and later.

Declared in ATSFont.h.

Discussion

There is currently only one constant in this enumeration. You use a constant of this type when you create an ATSFontQueryCallback callback function.

Iteration Precedence Options

Specify the order of an iteration.

enum {
   kATSOptionFlagsIterateByPrecedenceMask = 0x00000001 <<  5
};
Constants
kATSOptionFlagsIterateByPrecedenceMask

Specifies to iterate fonts in the order dictated by a precedence mask.

Available in OS X v10.1 and later.

Declared in ATSFont.h.

Notification Actions

Specify a notification action.

enum ATSFontNotifyAction {
   kATSFontNotifyActionFontsChanged = 1,
   kATSFontNotifyActionDirectoriesChanged = 2
};
typedef enum ATSFontNotifyAction ATSFontNotifyAction;
Constants
kATSFontNotifyActionFontsChanged

Specifies that your application has activated or deactivated fonts. Typically you call the functions ATSFontActivateFromFileSpecification or ATSFontDeactivate multiple times to activate and deactivate fonts. In each call, you set the iOptions parameter to kATSOptionFlagsDoNotNotify set. When you are done activating and deactivating fonts you can call the function ATSFontNotify with the action parameter set to kATSFontNotifyActionFontsChanged. Then ATS notifies all applications who subscribe to notifications of the changes you made.

Available in OS X v10.2 and later.

Declared in ATSFont.h.

kATSFontNotifyActionDirectoriesChanged

Specifies that your application has made changes to one or more of the font directories. When you are making changes to font directories, you can call the function ATSFontNotify with the action parameter set to kATSFontNotifyActionDirectoriesChanged. Then ATS scans these directories and notifies all applications who subscribe to notifications of the changes you made.

Available in OS X v10.2 and later.

Declared in ATSFont.h.

Discussion

You can use these options with the function ATSFontNotify.

Notification Options

Specify when ATS should notify your application of changes in the font database.

enum ATSFontNotifyOption {
   kATSFontNotifyOptionDefault = 0,
   kATSFontNotifyOptionReceiveWhileSuspended = 1L << 0
};
typedef enum ATSFontNotifyOption ATSFontNotifyOption;
Constants
kATSFontNotifyOptionDefault

Specifies to use the default behavior of the function ATSFontNotificationSubscribe.

Available in OS X v10.2 and later.

Declared in ATSFont.h.

kATSFontNotifyOptionReceiveWhileSuspended

Specifies to receive notifications even if the application is in the background. Setting this option can degrade performance; you should set this option if your application is a faceless process or a tool that performs font management functions and requires immediate notification when fonts change.

Available in OS X v10.2 and later.

Declared in ATSFont.h.

Discussion

You use notification options when you call the function ATSFontNotificationSubscribe. The default behavior is for applications to receive ATS notifications only when the application runs in the foreground. By default, if the application is suspended, the notification is delivered when the application comes to the foreground.

Scoping Options

Specify the scope to which an operation should apply or a notification schedule.

enum {
   kATSOptionFlagsDoNotNotify = 0x00000001 << 8,
   kATSOptionFlagsIterationScopeMask = 0x00000007 << 12,
   kATSOptionFlagsDefaultScope = 0x00000000 << 12,
   kATSOptionFlagsUnRestrictedScope = 0x00000001 << 12,
   kATSOptionFlagsRestrictedScope = 0x00000002 << 12,
   kATSOptionFlagsProcessSubdirectories = 0x00000001 << 6
};
Constants
kATSOptionFlagsDoNotNotify

Specifies not to send a notification after a font is activated or deactivated globally. You can set the iOptions parameter of the functions ATSFontActivateFromFileSpecification or ATSFontDeactivate to this constant. When you are done activating and deactivating fonts you can call the function ATSFontNotify with the action parameter set to kATSFontNotifyActionFontsChanged. Then ATS notifies all applications who subscribe to notifications of the changes you made.

Available in OS X v10.2 and later.

Declared in ATSFont.h.

kATSOptionFlagsIterationScopeMask

Specifies mask option bits 12-14 for iteration scopes.

Available in OS X v10.1 and later.

Declared in ATSFont.h.

kATSOptionFlagsDefaultScope

Specifies to use the default scope, which is equivalent to kATSOptionFlagsUnRestrictedScope. You can pass this as a parameter to the functions ATSFontFamilyIteratorCreate, ATSFontFamilyIteratorReset, ATSFontIteratorCreate and ATSFontIteratorReset.

Available in OS X v10.1 and later.

Declared in ATSFont.h.

kATSOptionFlagsUnRestrictedScope

Specifies to use an unrestricted scope. You can pass this as a parameter to the functions ATSFontFamilyIteratorCreate, ATSFontFamilyIteratorReset, ATSFontIteratorCreate and ATSFontIteratorReset.

Available in OS X v10.1 and later.

Declared in ATSFont.h.

kATSOptionFlagsRestrictedScope

Specifies to use a restricted scope. You can pass this as a parameter to the functions ATSFontFamilyIteratorCreate, ATSFontFamilyIteratorReset, ATSFontIteratorCreate and ATSFontIteratorReset.

Available in OS X v10.1 and later.

Declared in ATSFont.h.

kATSOptionFlagsProcessSubdirectories

Specifies to process the font directories within a font directory. You can pass this as a parameter to the function ATSFontActivateFromFileSpecification.

Available in OS X v10.2 and later.

Declared in ATSFont.h.

Discussion

Scope refers to whether a font’s use is restricted or unrestricted. Fonts with a restricted scope can be used only by your application whereas fonts with an unrestricted scope cay be used by all applications.

Font Manager Constants

FM Filter Format

Specifies a filter format.

enum {
   kFMCurrentFilterFormat = 0
};
Constants
kFMCurrentFilterFormat

Specifies the current filter format. You can use this to set the format field when you initialize the FMFilter data type for use in creating an iterator object with the functions FMCreateFontFamilyIterator or FMCreateFontIterator. Currently, this is the only format you can specify.

Available in OS X v10.0 and later.

Declared in ATSTypes.h.

FM Filter Selectors

Specifies a filter type.

typedef UInt32 FMFilterSelector;
enum {
   kFMFontTechnologyFilterSelector = 1,
   kFMFontContainerFilterSelector = 2,
   kFMGenerationFilterSelector = 3,
   kFMFontFamilyCallbackFilterSelector = 4,
   kFMFontCallbackFilterSelector = 5,
   kFMFontDirectoryFilterSelector = 6
};
Constants
kFMFontTechnologyFilterSelector

Selects font technology filter. You can use this filter only with a font iterator.

Available in OS X v10.0 and later.

Declared in ATSTypes.h.

kFMFontContainerFilterSelector

Selects font container filter. You can use this filter only with a font iterator.

Available in OS X v10.0 and later.

Declared in ATSTypes.h.

kFMGenerationFilterSelector

Selects generation filter. You can use this filter only with a font family iterator.

Available in OS X v10.0 and later.

Declared in ATSTypes.h.

kFMFontFamilyCallbackFilterSelector

Indicates a custom filter to be used only with a font family iterator.

Available in OS X v10.0 and later.

Declared in ATSTypes.h.

kFMFontCallbackFilterSelector

Indicates a custom filter to be used only with a font iterator.

Available in OS X v10.0 and later.

Declared in ATSTypes.h.

Discussion

You use these constants to specify a filter type in the FMFilter data structure used by many Font Manager functions.

FM Font Technologies

Specify a font technology.

enum {
   kFMTrueTypeFontTechnology = 'true',
   kFMPostScriptFontTechnology = 'typ1'
};
Constants
kFMTrueTypeFontTechnology

Indicates True Type font technology.

Available in OS X v10.0 and later.

Declared in ATSTypes.h.

kFMPostScriptFontTechnology

Indicates Post Script font technology.

Available in OS X v10.0 and later.

Declared in ATSTypes.h.

Invalid Values

Specify an invalid value.

enum {
   kInvalidGeneration = 0,
   kInvalidFontFamily = -1,
   kInvalidFont = 0
};
Constants
kInvalidGeneration

Indicates an invalid generation value.

Available in OS X v10.0 and later.

Declared in ATSTypes.h.

kInvalidFontFamily

Indicates the font family reference is invalid.

Available in OS X v10.0 and later.

Declared in ATSTypes.h.

kInvalidFont

Indicates the font reference is invalid.

Available in OS X v10.0 and later.

Declared in ATSTypes.h.

Discussion

The kInvalidGeneration, kInvalidFontFamily, and kInvalidFont constants may be used to indicate invalid values for generation count, font family, and font data types.

ATSUI Constants

Convenience Constants

Represent numerical values that are commonly used in font calculations.

enum {
   kATSItalicQDSkew = (1 << 16) / 4,
   kATSBoldQDStretch = (1 << 16) * 3 / 2,
   kATSRadiansFactor = 1144
};
Constants
kATSItalicQDSkew

A Fixed value of 0.25 that represents the skew used by QuickDraw to draw italicized glyphs.

Available in OS X v10.0 and later.

Declared in ATSTypes.h.

kATSBoldQDStretch

A Fixed value that represents the stretch-factor used by QuickDraw to draw bold-faced glyphs.

Available in OS X v10.0 and later.

Declared in ATSTypes.h.

kATSRadiansFactor

A Fixed value of approximately pi/180(0.0174560546875) that represents an angle of 1 radian. This is a convenience constant you can use when you draw rotated text.

Available in OS X v10.0 and later.

Declared in ATSTypes.h.

Discussion

These constants are provided for convenience. Your application can use them when it needs to perform font calculations.

Version Notes

Available beginning with ATSUI 1.0.

Curve Types

Specify a curve type used to draw a font.

typedef UInt16 ATSCurveType;
enum {
   kATSCubicCurveType = 0x0001,
   kATSQuadCurveType = 0x0002,
   kATSOtherCurveType = 0x0003
};
Constants
kATSCubicCurveType

Specifies a cubic curve.

Available in OS X v10.0 and later.

Declared in ATSTypes.h.

kATSQuadCurveType

Specifies a quadratic curve.

Available in OS X v10.0 and later.

Declared in ATSTypes.h.

kATSOtherCurveType

Specifies a curve other than cubic or quadratic.

Available in OS X v10.0 and later.

Declared in ATSTypes.h.

Discussion

These are used in the ATSUI function ATSUGetNativeCurveType. See Inside Mac OS X: ATSUI Reference for more information.

Deleted Glyph Code

Specifies that a glyph is deleted.

enum {
   kATSDeletedGlyphcode = 0xFFFF
};
Constants
kATSDeletedGlyphcode

Indicates that a glyph is deleted. That is, the glyph is set to no longer appear in a text layout.

Available in OS X v10.2 and later.

Declared in ATSTypes.h.

Discussion

This constant is used by ATSUI. When a glyph is deleted, ATSUI sets the corresponding ATSGlyphRef to kATSDeletedGlyphcode. For more information, see Inside Mac OS X: ATSUI Reference.

Result Codes

The most common result codes returned by Apple Type Services for Fonts are listed below.

Result CodeValueDescription
kATSIterationCompleted -980L

The iteration is complete.

Available in OS X v10.0 and later.

kATSInvalidFontFamilyAccess -981L

Your application tried to access an invalid font family.

Available in OS X v10.0 and later.

kATSInvalidFontAccess -982L

Your application tried to access an invalid font.

Available in OS X v10.0 and later.

kATSIterationScopeModified -983L

The font database changed during an iteration.

Available in OS X v10.0 and later.

kATSInvalidFontTableAccess -984L

Your application tried to access an invalid font table.

Available in OS X v10.0 and later.

kATSInvalidFontContainerAccess -985L

Your application tried to access an invalid font container.

Available in OS X v10.0 and later.