Important: FontSync is deprecated in Mac OS X v10.6 and later. There is no exact replacement technology. Please use the font facilities in the Cocoa text system and Core Text instead.
| Framework | ApplicationServices/ApplicationServices.h |
| Declared in | FontSync.h |
Important: FontSync is deprecated in Mac OS X v10.6 and later. There is no exact replacement technology. Please use the font facilities in the Cocoa text system and Core Text instead.
FontSync is an API that provides a way for your application to identify fonts based upon the content of the font, rather than just the font name. Your application can use FontSync to compare fonts that are available on different computers. This document is relevant for anyone who is writing a text-intensive application that must minimize font mismatch errors when a file is moved from one computer to another. To use this document, you should understand the basics of fonts and be familiar with FontSync references and profiles.
Carbon supports FontSync. However, in Mac OS X, Apple recommends that you use FontSync only in OS X version 10.1 and later.
FNSEnabled Deprecated in Mac OS X v10.5
FNSMatchDefaultsGet Deprecated in Mac OS X v10.5
FNSSysInfoGet Deprecated in Mac OS X v10.5
FNSReferenceCountNames Deprecated in Mac OS X v10.5
FNSReferenceFindName Deprecated in Mac OS X v10.5
FNSReferenceGetFamilyInfo Deprecated in Mac OS X v10.5
FNSReferenceGetIndName Deprecated in Mac OS X v10.5
FNSProfileMatchReference Deprecated in Mac OS X v10.5
FNSReferenceMatchFamilies Deprecated in Mac OS X v10.5
FNSReferenceMatchFonts Deprecated in Mac OS X v10.5
FNSProfileCompact
FNSProfileAddReference Deprecated in Mac OS X v10.5
FNSProfileClear Deprecated in Mac OS X v10.5
FNSProfileClose Deprecated in Mac OS X v10.5
FNSProfileCountReferences Deprecated in Mac OS X v10.5
FNSProfileCreate Deprecated in Mac OS X v10.5
FNSProfileCreateWithFSRef Deprecated in Mac OS X v10.5
FNSProfileGetIndReference Deprecated in Mac OS X v10.5
FNSProfileGetVersion Deprecated in Mac OS X v10.5
FNSProfileOpen Deprecated in Mac OS X v10.5
FNSProfileOpenWithFSRef Deprecated in Mac OS X v10.5
FNSProfileRemoveIndReference Deprecated in Mac OS X v10.5
FNSProfileRemoveReference Deprecated in Mac OS X v10.5
FNSReferenceCreate Deprecated in Mac OS X v10.5
FNSReferenceCreateFromFamily Deprecated in Mac OS X v10.5
FNSReferenceDispose Deprecated in Mac OS X v10.5
FNSReferenceFlatten Deprecated in Mac OS X v10.5
FNSReferenceFlattenedSize Deprecated in Mac OS X v10.5
FNSReferenceGetVersion Deprecated in Mac OS X v10.5
FNSReferenceMatch Deprecated in Mac OS X v10.5
FNSReferenceUnflatten Deprecated in Mac OS X v10.5
Compacts a font profile.
OSStatus FNSProfileCompact ( FNSFontProfile iProfile );
A font profile reference. Pass a reference to the font profile you wish to compact. The profile must be editable (that is, opened with read/write access).
A result
code. See “FontSync Result Codes.” The result code kFNSBadProfileVersionErr indicates
that a font profile has an unsupported format version. This may
indicate that the profile is valid, but created by a later version
of FontSync, or that the profile is truly invalid. The result code kFNSInvalidProfileErr indicates
that a profile does not have a valid structure. FNSProfileCompact may
return File Manager errors.
The FNSProfileCompact function
eliminates excess space created when creating a font profile (that
is, the space you designate for not-yet-existent font references).
This space is necessary to minimize growing the file and shuffling
data. If a profile has not been opened for read/write access, FNSProfileCompact simply
returns without doing anything.
You should call FNSProfileCompact before
closing a profile that has been edited.
Available beginning with FontSync 1.0.
FontSync.hRepresents a mask that you can use to determine available FontSync features.
typedef UInt32 FNSFeatureFlags;
The FNSFeatureFlags type
defines a bit mask your application can use to determine available
FontSync features. The function FNSSysInfoGet passes
back a mask of this type in the oFeatures field
of the FNSSysInfo structure
in the ioInfo parameter.
You can use this mask to determine available FontSync features.
Available beginning with FontSync 1.0. In FontSync 1.0, the value is 0, since no feature flags are defined.
FontSync.hRepresents a reference to a font profile.
typedef struct OpaqueFNSFontProfile * FNSFontProfile;
The FNSFontProfile type
is a reference to an opaque structure containing a collection of font
references. It defines a set of fonts on the user’s system. Although
you do not need to use font profiles to iterate, identify, and match
fonts on the user’s system, they are necessary in building font
menus and other font selection human interface elements.
You pass a font profile to FontSync functions that manipulate font profiles. A font reference is passed back by functions that create font profiles. For a description of these functions, see “Working With FontSync Profiles.”
Available beginning with FontSync 1.0.
FontSync.hRepresents a reference to a font reference.
typedef struct OpaqueFNSFontReference * FNSFontReference;
The FNSFontReference type
is a reference to an opaque structure containing information about
a font. Some of the data contained in a font reference includes
the QuickDraw font family name, ATSUI-visible font name, type of
font, font version, checksums of the data, and information from
the font name table.
You pass a font reference to FontSync functions that manipulate font references. A font reference is passed back by functions that create font references. For a description of these functions, see “Working With FontSync References.”
Available beginning with FontSync 1.0.
FontSync.hContains FontSync version and feature information.
struct FNSSysInfo {
FNSObjectVersion iSysInfoVersion;
FNSFeatureFlags oFeatures;
FNSObjectVersion oCurRefVersion;
FNSObjectVersion oMinRefVersion;
FNSObjectVersion oCurProfileVersion;
FNSObjectVersion oMinProfileVersion;
UInt16 oFontSyncVersion;
};
typedef struct FNSSysInfo FNSSysInfo;
iSysInfoVersionOn input, the version of this parameter block
structure. In FontSync 1.0, the version number of this structure
is 1. Pass the constant kFNSCurSysInfoVersion,
described in “Version Constants.” For more information, see the discussion.
oFeaturesOn output, the FontSync features that are available. In FontSync 1.0, no feature flags are defined.
oCurRefVersionOn output, the current font reference format version supported by the FontSync library.
oMinRefVersionOn output, the oldest font reference format version supported by the FontSync library.
oCurProfileVersionOn output, the current font profile format version supported by the FontSync library.
oMinProfileVersionOn output, the oldest font profile format version supported by the FontSync library.
oFontSyncVersionOn output, a binary-coded decimal value indicating the version of FontSync currently running. The high-order 8 bits give the major version, the next four give the minor version, and the last four give the revision. For example, version 1.0 would be encoded as 0x0100.
Before calling the function FNSSysInfoGet, you should fill in the iSysInfoVersion field
of this structure with the version of this structure. Pass the constant kFNSCurSysInfoVersion, described
in “Version Constants,”
to represent the current version. FNSSysInfoGet fills in the remaining
fields and passes back the structure in the ioInfo parameter.
The information it provides includes the version of FontSync running
in the current context and available features, as well as the current
and oldest font reference and profile format versions supported
by the FontSync library.
New fields may be added to the end of the structure in future
versions of FontSync. FontSync uses the iSysInfoVersion field
to determine which version of the structure you are using. The value
of the current version constant kFNSCurSysInfoVersion will
change accordingly.
Available beginning with FontSync 1.0. In FontSync 1.0, the
value of the iSysInfoVersion field
is 1. The value of the oFeatures field
is 0, since no feature flags are defined.
FontSync.hRepresent a mask that you can use to set and determine default match options.
typedef UInt32 FNSMatchOptions;
enum {
kFNSMatchNames = 0x00000001,
kFNSMatchTechnology = 0x00000002,
kFNSMatchGlyphs = 0x00000004,
kFNSMatchEncodings = 0x00000008,
kFNSMatchQDMetrics = 0x00000010,
kFNSMatchATSUMetrics = 0x00000020,
kFNSMatchKerning = 0x00000040,
kFNSMatchWSLayout = 0x00000080,
kFNSMatchAATLayout = 0x00000100,
kFNSMatchPrintEncoding = 0x00000200,
kFNSMissingDataNoMatch = 0x80000000,
kFNSMatchAll = 0xFFFFFFFF,
kFNSMatchDefaults = 0
};
kFNSMatchNamesIf the bit specified by this mask is set, all significant font names must match. This includes the QuickDraw Text family, ATSUI, unique, full, manufacturer, and version names. Note that the PostScript names are also examined as part of the kFNSMatchPrintEncoding option.
Available in Mac OS X v10.0 and later.
Declared in FontSync.h.
kFNSMatchTechnologyIf the bit specified by this mask is set, scaler technologies must match. It is possible to match other parts of the font across different technologies, but this is not supported by FontSync 1.0. As a result, even if this bit is not set, fonts of different technologies will probably not match under any other criteria.
Available in Mac OS X v10.0 and later.
Declared in FontSync.h.
kFNSMatchGlyphsIf the bit specified by this mask is set, glyph repertoires and outline/bitmap data must match.
Available in Mac OS X v10.0 and later.
Declared in FontSync.h.
kFNSMatchEncodingsIf the bit specified by this mask is set, the 'cmap' tables must match. If the order of the 'cmap' tables is different, although the tables are the same, this may be considered a mismatch, since it can cause QuickDraw Text to use a different 'cmap'table.
Available in Mac OS X v10.0 and later.
Declared in FontSync.h.
kFNSMatchQDMetricsIf the bit specified by this mask is set, metrics used by QuickDraw Text must match. This includes the effect of fractEnable and any metric information in the 'FOND' resource.
Available in Mac OS X v10.0 and later.
Declared in FontSync.h.
kFNSMatchATSUMetricsIf the bit specified by this mask is set, metrics used by ATSUI must match. This includes both horizontal and vertical metrics.
Available in Mac OS X v10.0 and later.
Declared in FontSync.h.
kFNSMatchKerningIf the bit specified by this mask is set, kerning data must match.
Available in Mac OS X v10.0 and later.
Declared in FontSync.h.
kFNSMatchWSLayoutIf the bit specified by this mask is set, layout information given by an 'itl5' table, whether attached directly to the font or the one provided in the script bundle, must match.
Available in Mac OS X v10.0 and later.
Declared in FontSync.h.
kFNSMatchAATLayoutIf the bit specified by this mask is set, advanced layout information such as that used by ATSUI, must match. This includes such things as ligature and morphing tables. OpenType-style layout information is included in this option.
Available in Mac OS X v10.0 and later.
Declared in FontSync.h.
kFNSMatchPrintEncodingIf the bit specified by this mask is set, PostScript names and 'FOND' re-encoding vectors must match. Note that it is an error for a font’s internal PostScript name to be different from the one in the 'FOND', but FontSync will record both and consider them separately.
Available in Mac OS X v10.0 and later.
Declared in FontSync.h.
kFNSMissingDataNoMatchIf the bit specified by this mask is set, FontSync will report font reference mismatches when both fonts are missing data needed by a selected option. This is useful, since some older fonts may not have all the data needed for matching newer fonts. This makes the mask constant kFNSMatchAll specify the most stringent possible match criteria.
Available in Mac OS X v10.0 and later.
Declared in FontSync.h.
kFNSMatchAllIf the bit specified by this mask is set, all of the match options must match. In this case, the bit specified by the mask constant kFNSMissingDataNoMatch is also set, asserting the most stringent possible match criteria.
Available in Mac OS X v10.0 and later.
Declared in FontSync.h.
kFNSMatchDefaultsIf this constant is specified, the global default match criteria established by the API are used (that is, use all of the options described above in the match). If the user changes the FontSync Control Panel settings, that becomes the new default. This constant basically says to use whatever the user has set.
Available in Mac OS X v10.0 and later.
Declared in FontSync.h.
The FNSMatchOptions enumeration defines masks your application can use to set or test match option bits. You can use this mask with the functions FNSReferenceMatch, FNSProfileMatchReference, FNSReferenceMatchFonts, and FNSReferenceMatchFamilies to set the match options used during font comparison. If you wish, your application can specify options that are different from the user’s preferences via this mask. You can use this mask to test the match option bits produced by the function FNSMatchDefaultsGet, thereby obtaining the default match options to use in a font comparison. You can also use this mask to test the match option bits produced by the function FNSReferenceMatch, thereby determining the match options under consideration that did not match.
At least one of the match options must be set. Having all of these bits clear is equivalent to saying “don’t look at anything,” which would allow any font to match. Since having all flags clear is nonsensical, the value of the mask constant kFNSMatchDefaults is 0. Setting undefined bits does not generate an error and provides backward compatibility.
Available beginning with FontSync 1.0.
Represent the file type and default creator code of a font profile.
enum {
kFNSCreatorDefault = 0,
kFNSProfileFileType = 'fnsp'
};
kFNSCreatorDefaultAssigns a file creator code instead of using one of your own. Pass this constant in the iCreator parameter of the function FNSProfileCreate.
Available in Mac OS X v10.0 and later.
Declared in FontSync.h.
kFNSProfileFileTypeThe file type of a profile. It is not used in the API, but is provided for convenience. For example, you can use it to put up a Navigation Services dialog box to select a profile.
Available in Mac OS X v10.0 and later.
Declared in FontSync.h.
Available beginning with FontSync 1.0. In FontSync 1.0, if you specify the constant kFNSCreatorDefault in the iCreator parameter of the function FNSProfileCreate, FontSync assigns the creator code 'fns'.
Represents version information.
typedef UInt32 FNSObjectVersion;
enum {
kFNSVersionDontCare = 0,
kFNSCurSysInfoVersion = 1
};
kFNSVersionDontCareSpecifies the most recent font reference or font profile version supported by the FontSync library, regardless of version number. In FontSync 1.0, the most recent version for both font references and profiles is version 1. You pass this constant in the iDesiredVersion parameter of the functions FNSSysInfo, FNSSysInfoGet, and FNSProfileCreate.
Available in Mac OS X v10.0 and later.
Declared in FontSync.h.
kFNSCurSysInfoVersionIdentifies the current version of the parameter block structure FNSSysInfo returned by the function FNSSysInfoGet. You pass this constant in the iSysInfoVersion field of the system information structure. The version of the structure used by FontSync 1.0 is version 1.
Available in Mac OS X v10.0 and later.
Declared in FontSync.h.
You can pass the kFNSVersionDontCare constant in the iDesiredVersion parameter of the functions FNSReferenceCreate, FNSReferenceCreateFromFamily, and FNSProfileCreate, to specify the most recent font reference or font profile version supported by the FontSync library. You can use the kFNSCurSysInfoVersion constant in the iSysInfoVersion field of the structure FNSSysInfo to indicate the current version of the structure.
The most common result codes returned by FontSync are listed below.
| Result Code | Value | Description |
|---|---|---|
kFNSInvalidReferenceErr |
-29580 | Returned by FontSync functions that operate
on font references to indicate that the specified font reference
is invalid. This can also be returned by the function Available in Mac OS X v10.0 and later. |
kFNSBadReferenceVersionErr |
-29581 | Returned by FontSync functions that operate on font references to indicate that the reference has an unsupported version number. This may indicate that the reference is valid, but created by a later version of FontSync, or that the reference is truly invalid This is also be returned by font reference creation functions if an unsupported reference version was requested. Available in Mac OS X v10.0 and later. |
kFNSInvalidProfileErr |
-29582 | Returned by FontSync functions that operate on font profiles to indicate that the profile does not have a valid structure. Available in Mac OS X v10.0 and later. |
kFNSBadProfileVersionErr |
-29583 | Returned by FontSync functions that operate on font profiles to indicate that the profile has an unsupported version number. This may indicate that the profile is valid, but created by a later version of FontSync, or that the profile is truly invalid. This is also be returned by font profile creation functions if an unsupported profile version was requested. Available in Mac OS X v10.0 and later. |
kFNSDuplicateReferenceErr |
-29584 | Returned by the function Available in Mac OS X v10.0 and later. |
kFNSMismatchErr |
-29585 | Indicates that either a reference did not match, the reference you wish to remove is not in the profile, or that no font names were recorded in the reference. Available in Mac OS X v10.0 and later. |
kFNSInsufficientDataErr |
-29586 | Returned by the functions Available in Mac OS X v10.0 and later. |
kFNSBadFlattenedSizeErr |
-29587 | Returned by the function Available in Mac OS X v10.0 and later. |
kFNSNameNotFoundErr |
-29589 | Returned by the function Available in Mac OS X v10.0 and later. |
Last updated: 2008-10-01