InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IFontFamily Class Referenceabstract

#include <IFontFamily.h>

Inheritance diagram for IFontFamily:
IPMUnknown

Classes

struct  FontFaceMappingInfo
 

Public Types

enum  { kDefaultIID = IID_IFONTFAMILY }
 

Public Member Functions

virtual void SetFamilyName (const PMString &familyName, const PMString &familyNameNative, bool16 missing, const FontEntry *fontEntry=nil)=0
 
virtual PMString GetFamilyName () const =0
 
virtual PMString GetFamilyNameNative () const =0
 
virtual int32 GetWritingScript () const =0
 
virtual bool16 UpdateFontState (IUsedFontList *docFontList)=0
 
virtual int32 CountFontFaces (bool16 getForDysfunctional=kFalse) const =0
 
virtual void AppendFontName (int32 i, PMString &s) const =0
 
virtual void AppendFullName (int32 i, PMString &s) const =0
 
virtual void AppendStyleName (int32 i, PMString &s) const =0
 
virtual void AppendStyleNameNative (int32 i, PMString &s) const =0
 
virtual void AppendFullNameNative (int32 i, PMString &s) const =0
 
virtual int32 CorrectVariantIndex (const PMString &face) const =0
 
virtual IPMFontQueryFace (const PMString &face, IFontMgr::FontStyleBits style=IFontMgr::kNormal, PMReal smallcapscale=0.7)=0
 
virtual bool16 AttemptAutoActivation (const PMString &face, IFontMgr::FontStyleBits style=IFontMgr::kNormal, PMReal smallcapscale=0.7)=0
 
virtual bool16 IsFaceAvailable (const PMString &face, IFontMgr::FontStyleBits style=IFontMgr::kNormal, PMReal smallcapscale=0.7, int32 *oldTech=nil, int32 *newTech=nil, bool16 resetTechnology=kFalse)=0
 
virtual bool16 IsDysfunctional () const =0
 
virtual PMString GetFacePostscriptName (const PMString &face, bool16 getOnlyRealPSName=kFalse) const =0
 
virtual PMString ToggleBoldItalic (const PMString &face, IFontMgr::FontStyleBits toggle)=0
 
virtual PMString GetFaceNativeName (const PMString &face, IFontMgr::FontStyleBits style=IFontMgr::kNormal, PMReal smallcapscale=0.7)=0
 
virtual PMString GetDisplayFullName (const PMString &faceName, PMString &fontString)=0
 
virtual void SetFontFaceMappingInfo (FontFaceMappingInfo &FontFaceMappingInfo)=0
 
virtual const FontFaceMappingInfoGetFontFaceMappingInfo (const PMString &faceName) const =0
 
virtual bool16 FontFaceMappingInfoIsSet (const PMString &faceName) const =0
 
virtual UID GetDependentFamily () const =0
 
virtual bool16 IsFlattened () const =0
 
virtual IFontGroupIdQueryFontGroupUniqueID () const =0
 
virtual void SetFamilyWithFontGroupID (const IFontGroupId *fontGroupIDPtr)=0
 
virtual bool16 IsBadFont (const PMString &styleName, PMString &badFontPath) const =0
 
virtual const PMString GetDisplayFamilyName () const =0
 
virtual IPMFont::FontType GetFontType (const PMString &styleName) const =0
 
virtual int32 GetDefaultStyleIndex () const =0
 
virtual WideString GetFontVersion (const PMString &styleName) const =0
 
virtual void UpdateFontVersions ()=0
 
virtual int32 GetVariantIndex (const PMString &face) const =0
 
virtual void AddMissingFontEntry (const FontEntry &fontEntry)=0
 
virtual bool16 IsTypekitFont (const PMString &styleName) const =0
 
virtual PMString GetTypekitFontID (const PMString &styleName) const =0
 
virtual PMString GetStyleNameFromDesignAxes (const Fixed *designAxes, int32 numAxes, PMString parentStyleName)=0
 
virtual Fixed * GetDesignAxesFromStyleName (const PMString &styleName, int32 &numAxes)=0
 
virtual bool16 IsVariableFont ()=0
 
virtual bool16 IsCustomVariableFont (const PMString &variant)=0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

This plus the style name is used to identify an IPMFont in the document. IFontFamily plus style name are saved as attributes in the document.

Member Function Documentation

virtual void IFontFamily::AddMissingFontEntry (const FontEntryfontEntry)
pure virtual

This is to be used only by internal font management code.

Parameters
&fontEntry
virtual void IFontFamily::AppendFontName (int32 i,
PMStrings 
) const
pure virtual

Appends the postscript name to string

Parameters
iIndex into font family. From 0 to < CountFontFaces
sString to append name to.
virtual void IFontFamily::AppendFullName (int32 i,
PMStrings 
) const
pure virtual

Appends the full font name to string. Full name can be family name plus style name but it is not always.

Parameters
iIndex into font family. From 0 to < CountFontFaces
sString to append name to.
virtual void IFontFamily::AppendFullNameNative (int32 i,
PMStrings 
) const
pure virtual

Appends the native full font name to string. Full name can be family name plus style name but it is not always. This is the full font name for the writing script. So if the font is Japanese writing script the Native name will be Japanese.

Parameters
iIndex into font family. From 0 to < CountFontFaces
sString to append name to. Be careful. s may have a different script than the writingscript of the font and the Append will not work correctly
virtual void IFontFamily::AppendStyleName (int32 i,
PMStrings 
) const
pure virtual

Appends the roman font style name to string

Parameters
iIndex into font family. From 0 to < CountFontFaces
sString to append name to.
virtual void IFontFamily::AppendStyleNameNative (int32 i,
PMStrings 
) const
pure virtual

Appends the native font style name to string. This is the style name for the writing script. So if the font is Japanese writing script the Native name will be Japanese.

Parameters
iIndex into font family. From 0 to < CountFontFaces
sString to append name to. Be careful. s may have a different script than the writingscript of the font and the Append will not work correctly
virtual bool16 IFontFamily::AttemptAutoActivation (const PMStringface,
IFontMgr::FontStyleBits style = IFontMgr::kNormal,
PMReal smallcapscale = 0.7 
)
pure virtual

Attempt to auto activate the font. If a font is missing you can call this to see if the font can be activated.

Parameters
facename of the font style. only works for non native style names
stylefont style bits
smallcapscaleused when style bits are set to kSmallCaps to set small cap scale
Returns
bool16 kTrue if font is now available
virtual int32 IFontFamily::CorrectVariantIndex (const PMStringface) const
pure virtual

This will give you an index into the font family for the face given. If you want only the plain or regular style and to fail otherwise call CorrectVariantIndex with "Regular". You will then get -1 if no regular style. Regular style is either - "R", "Roman", "Regular", "Book", "Plain", "Normal". Likewise if you want Italic style call with face = "Italic", for bold face = "Bold" for bold italic face = "Bold Italic". These will match against other names for italic, bold and bold italic. Then call AppendStyleName with index to find the actual name the family uses for italic, bold or bold italic.

WARNING: In the face of Document-installed fonts, the index returned is problematic and deprecated. The face may be available yet this function may still return -1.

Parameters
faceFace to find. Do not pass native style names as they will not be found. -1 is returned if face name is not found.
Returns
int32 Index into the font family.
virtual int32 IFontFamily::CountFontFaces (bool16 getForDysfunctional = kFalse) const
pure virtual

Count number of font styles in this font family WARNING: The count returned may not reflect all available faces. It merely returns one beyond the highest index usable in functions taking an index.

Parameters
getForDysfunctionalif true return count of faces in dysfunctional family if false return -1 for dysfunctional family
Returns
int32
virtual bool16 IFontFamily::FontFaceMappingInfoIsSet (const PMStringfaceName) const
pure virtual

Only used by dysfunctional fonts

Parameters
faceName
Returns
bool16
virtual int32 IFontFamily::GetDefaultStyleIndex () const
pure virtual

This will give you an index into the font family for the default style. This will be the plain or regular style when available. If no plain or regular style it will be the first style. Regular style is either - "R", "Roman", "Regular", "Book", "Plain", "Normal". If you want only the plain or regular style and to fail otherwise call CorrectVariantIndex with "Regular". You will then get -1 if no regular style.

Returns
int32 Index into the font family for default style.
virtual UID IFontFamily::GetDependentFamily () const
pure virtual

Only used by codependent fonts. All other return kInvalidUID

Returns
UID UID of font family this family is related to
virtual Fixed* IFontFamily::GetDesignAxesFromStyleName (const PMStringstyleName,
int32 & numAxes 
)
pure virtual

Get design axes of font instance, given style name. To be called only for custom instances of variable fonts having single dict.

Returns
Fixed* Design Axes of font instance.
virtual const PMString IFontFamily::GetDisplayFamilyName () const
pure virtual

Get the name of the family to display in the ui. For families that have the same name as another family the font type is added. Ex. (TT) for TrueType

Returns
PMString& display name for the family
virtual PMString IFontFamily::GetDisplayFullName (const PMStringfaceName,
PMStringfontString 
)
pure virtual

sets the best full name to fontString, returns fontString, sets translation and script; called i.e. by DocumentFontUsage and MissingFontsController.

Parameters
faceName
&fontString
Returns
const
virtual PMString IFontFamily::GetFaceNativeName (const PMStringface,
IFontMgr::FontStyleBits style = IFontMgr::kNormal,
PMReal smallcapscale = 0.7 
)
pure virtual

Gets the native font style name

Parameters
facename of the font style. only works for non native style names
stylefont style bits
smallcapscaleused when style bits are set to kSmallCaps to set small cap scale
Returns
PMString& native font style name
virtual PMString IFontFamily::GetFacePostscriptName (const PMStringface,
bool16 getOnlyRealPSName = kFalse 
) const
pure virtual

Get postscript font name for this font style name.

Parameters
facename of the font style. only works for non native style names
getOnlyRealPSNameif true only real name returned if not available kNullString is returned. false will return either the default postscript font name(for the family) or if that is not available(as in dysfunctional fonts) it returns the fontfamily name.
Returns
PMString& postscript name of the font.
virtual PMString IFontFamily::GetFamilyName () const
pure virtual

Gets the roman family name

Returns
PMString& Family Name
virtual PMString IFontFamily::GetFamilyNameNative () const
pure virtual

Gets the native family name. This is the full font name for the writing script. So if the font is Japanese writing script the Native name will be Japanese.

Returns
PMString& Native family name
virtual const FontFaceMappingInfo& IFontFamily::GetFontFaceMappingInfo (const PMStringfaceName) const
pure virtual

Only used by dysfunctional fonts

Parameters
faceName
Returns
FontFaceMappingInfo&
virtual IPMFont::FontType IFontFamily::GetFontType (const PMStringstyleName) const
pure virtual

Get font type for index in family. dysfuntional and codependent will always return kUnknownFontType. This will return values for missing families for the font that used to be installed

Parameters
styleNamestyle name of font.
Returns
IPMFont::FontType font type
virtual WideString IFontFamily::GetFontVersion (const PMStringstyleName) const
pure virtual

Get font version for index in family. dysfuntional and codependent will always return empty string. This will return values for missing families for the font that used to be installed

Parameters
styleNamestyle name of font.
Returns
WideString font version
virtual PMString IFontFamily::GetStyleNameFromDesignAxes (const Fixed * designAxes,
int32 numAxes,
PMString parentStyleName 
)
pure virtual

Get Style name, given design axes of font instance. To be called only for custom instances of variable fonts having single dict.

Returns
PMString Style name of font instance.
virtual PMString IFontFamily::GetTypekitFontID (const PMStringstyleName) const
pure virtual

Get the typekit ID of the font

Returns
PMString typekit font id, if it is a typekit subscribed font, else empty string.
virtual int32 IFontFamily::GetVariantIndex (const PMStringface) const
pure virtual

This will give you an index into the font family for the face given. Regular style is either - "R", "Roman", "Regular", "Book", "Plain", "Normal". Likewise if you want Italic style call with face = "Italic", for bold face = "Bold" for bold italic face = "Bold Italic". These will match against other names for italic, bold and bold italic. Then call AppendStyleName with index to find the actual name the family uses for italic, bold or bold italic.

This function differs from CorrectVariantIndex in that it returns an index even when the font is missing.

WARNING: In the face of Document-installed fonts, the index returned is problematic and deprecated. The face may be available yet this function may still return -1.

Parameters
faceFace to find. Do not pass native style names as they will not be found. -1 is returned if face name is not found.
Returns
int32 Index into the font family.
virtual int32 IFontFamily::GetWritingScript () const
pure virtual

Call GetWritingScript if a font is missing and you want to find the writingScript from the family. To get the writing script of a font your first choice should be to call IPMFont::GetWritingScript.

Returns
int32 writing script. kCTRomanScript is returned for roman scripts.
virtual bool16 IFontFamily::IsBadFont (const PMStringstyleName,
PMStringbadFontPath 
) const
pure virtual

Given a style name reports if that font is bad and what is the file path to the bad font

Parameters
styleNamefont to evaluate
badFontPathOUT if font is bad the file path is returned. Trying to QueryFont and using IPMFont->GetFullPath will not return the correct path for bad fonts.
Returns
bool16 kTrue if font is bad
virtual bool16 IFontFamily::IsCustomVariableFont (const PMStringvariant)
pure virtual

Checks whether a given variant is a Named Instance or Custom Instance of variable font family. If called for non-variable font families, it always returns kFalse.

Returns
bool16 kTrue if instance is a custom instance of variable font family, kFalse otherwise.
virtual bool16 IFontFamily::IsDysfunctional () const
pure virtual

Dysfunctional fonts are a special kind of missing font.

There are 2 reasons a family is dysfunctional.

  1. Family was converted from an old InDesign document and during conversion the family was missing so we mark the font as dysfunctional until the family is available.
  2. Family was created while importing a document. For example, PageMaker or Word document. During the import the family could not be found so the font is marked as dysfunctional.
Returns
bool16 kTrue if font is dysfunctional
virtual bool16 IFontFamily::IsFaceAvailable (const PMStringface,
IFontMgr::FontStyleBits style = IFontMgr::kNormal,
PMReal smallcapscale = 0.7,
int32 * oldTech = nil,
int32 * newTech = nil,
bool16 resetTechnology = kFalse 
)
pure virtual

Returns true if font face name is available in family. WARNING: A true result does NOT imply that GetVariantIndex or CorrectVariantIndex will return a non-negative integer. In the face of Document-installed fonts, such an index is problematic and deprecated.

Parameters
faceface check if available in family
stylestyle bits
smallcapscale
oldTechOBSOLETE. was used to change font type in family. Now family must always keep original font type.
newTechOBSOLETE. was used to change font type in family. Now family must always keep original font type.
resetTechnologyOBSOLETE. was used to change font type in family. Now family must always keep original font type.
Returns
bool16 kTrue if face is available in family. kFalse if it is not.
virtual bool16 IFontFamily::IsFlattened () const
pure virtual

Whether this font should be flattened in the font menu. This is true for non-OTF Japanese fonts.

Returns
bool16 Font Family should have all styles shown as separate groups in the font menu.
virtual bool16 IFontFamily::IsTypekitFont (const PMStringstyleName) const
pure virtual

Get the Typekit status of font for index in family. dysfuntional and codependent will always return kFalse. This will return values for missing families for the font that used to be installed

Parameters
styleNamestyle name of font.
Returns
bool16 whether from typekit or not
virtual bool16 IFontFamily::IsVariableFont ()
pure virtual
Checks whether a font family is variable font family or not

If called for fonts that are not available (missing, dysfunctional etc), returns kFalse.

Returns
kTrue if family is available and is a variable font family, kFalse otherwise
virtual IPMFont* IFontFamily::QueryFace (const PMStringface,
IFontMgr::FontStyleBits style = IFontMgr::kNormal,
PMReal smallcapscale = 0.7 
)
pure virtual

Retrieve a font from this family using a non native style name

Parameters
facename of the font style. only works for non native style names
stylefont style bits
smallcapscaleused when style bits are set to kSmallCaps to set small cap scale
Returns
IPMFont* font found. check for nil and FontStatus() == IPMFont::kFontInstalled to see if the font is installed.
virtual IFontGroupId* IFontFamily::QueryFontGroupUniqueID () const
pure virtual

Get a unique identifier for this font family

Returns
IFontGroupId
virtual void IFontFamily::SetFamilyName (const PMStringfamilyName,
const PMStringfamilyNameNative,
bool16 missing,
const FontEntryfontEntry = nil 
)
pure virtual

Shouldn't be called by anything but the font management system

Parameters
familyName
familyNameNative
missing
virtual void IFontFamily::SetFamilyWithFontGroupID (const IFontGroupIdfontGroupIDPtr)
pure virtual

Set a unique identifier for this font family

Parameters
fontGroupID
virtual void IFontFamily::SetFontFaceMappingInfo (FontFaceMappingInfoFontFaceMappingInfo)
pure virtual

Only used by dysfunctional fonts

Parameters
FontFaceMappingInfo
virtual PMString IFontFamily::ToggleBoldItalic (const PMStringface,
IFontMgr::FontStyleBits toggle 
)
pure virtual

Returns a string containing the non native font style name that is the opposite of the face passed in. So passing in "Bold" with Bold toggle gives you "Regular".

Parameters
facefont style to toggle
togglehow to toggle the font style
Returns
PMString result of font style toggle
virtual bool16 IFontFamily::UpdateFontState (IUsedFontListdocFontList)
pure virtual

This will throw away all the font data and get the information again. Only should be called by the font management system when the font system has changed.

Parameters
*docFontList
virtual void IFontFamily::UpdateFontVersions ()
pure virtual

Updates the font versions in family to currently installed fonts. These are the versions returned by GetFontVersion. We currently only update these when a font family is copied to a new database in ConvertReference. missing families will not be reset as there is no installed font to get a version from.