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

#include <IFontMgr.h>

Inheritance diagram for IFontMgr:
IPMUnknownILocalFontManager

Classes

struct  FontNameInfo
 

Public Types

enum  { kDefaultIID = IID_IFONTMGR }
 
enum  FontStyleBits {
  kNormal = 0x00, kItalic = 0x01, kBold = 0x02, kBoldItalic = 0x03,
  kSmallCaps = 0x04, kCapStyles = 0x04
}
 
enum  WritingDirection { kWD_LeftToRight = 0, kWD_RightToLeft, kWD_TopToBottom }
 
enum  InternalFake { kInternalFake_Not = 0x0000, kInternal_Substitution = 0x0001, kInternalFake_Smallcap = 0x0004 }
 
enum  OriginalOS { kOriginalMacOS, kOriginalWinOS, kOriginalUnknownOS }
 

Public Member Functions

virtual int32 CurrentFontSystemSeed (bool16 fullCheck=kFalse, bool16 cooltypeSeedOnly=kFalse) const =0
 
virtual void CoolTypeShuttingDown ()=0
 
virtual const PMStringGetDefaultFontName ()=0
 
virtual void SetDefaultFontName (const PMString &s)=0
 
virtual bool16 IsFontAvailable (const PMString &fontname, int32 writingscript=kDontKnowScript)=0
 
virtual bool16 IsSuitableUIFont (IPMFont *pmFont)=0
 
virtual IPMFontQueryFont (const std::string &fontName, FontStyleBits style=kNormal, int32 writingscript=kDontKnowScript, PMReal smallcapscale=0.7, InternalFake fake=kInternalFake_Not)=0
 
virtual IPMFontQueryFont (const PMString &fontName, FontStyleBits style=kNormal, int32 writingscript=kDontKnowScript, PMReal smallcapscale=0.7, InternalFake fake=kInternalFake_Not)=0
 
virtual IPMFontQueryFont (const IFontGroup *fontGroup, int32 index, FontStyleBits style=kNormal, PMReal smallcapscale=0.7, InternalFake fake=kInternalFake_Not)=0
 
virtual IPMFontQueryFont (const CTFontDict *rawFont, InternalFake fake=kInternalFake_Not, int32 index=-1, bool16 bIsEPSFont=kFalse, bool16 bIsEmbeddedFont=kFalse, CCTEncoding *encoding=nil)=0
 
virtual IPMFontQueryFont (const CTFontDict *rawFont, Fixed *designAxes, InternalFake fake=kInternalFake_Not, bool16 bIsEPSFont=kFalse, bool16 bIsEmbeddedFont=kFalse, CCTEncoding *encoding=nil)=0
 
virtual IPMFontQueryFontPlatform (const PMString &fontName, FontStyleBits style, int32 ctScript=kDontKnowScript, OriginalOS os=kOriginalUnknownOS, FontNameInfo *outNameInfo=nil)=0
 
virtual IFontInstanceQueryFontInstance (const PMString &fontName, const PMMatrix &matrix, int32 writingscript=kDontKnowScript, WritingDirection dir=kWD_LeftToRight, FontStyleBits style=kNormal, Fixed *designV=nil, PMReal smallcapscale=0.7)=0
 
virtual IFontInstanceQueryFontInstance (const IPMFont *font, const PMMatrix &matrix, WritingDirection dir=kWD_LeftToRight)=0
 
virtual IFontGroupQueryFontGroup (const PMString &groupName)=0
 
virtual IFontGroupQueryFontGroup (int32 groupIndex)=0
 
virtual int32 GetNumFontGroups ()=0
 
virtual void IterateFontGroups (FontGroupIteratorCallBack *callBack)=0
 
virtual void ForceUpdateFontSystem ()=0
 
virtual IPMFontFindVariant (IPMFont *basefont, FontStyleBits stylebits, PMReal smallCapScale, int32 technology)=0
 
virtual void MarkBadFont (CTFontDict *badFontDict)=0
 
virtual IPMFontQueryFontFromDisplayName (const PMString &displayFamilyName, PMString &fontStyle)=0
 
virtual void AddFont (CTFontDict *dict)=0
 
virtual void DeleteFont (CTFontDict *dict)=0
 
virtual std::string GetDefaultFontPSName (int32 script=kDontKnowScript)=0
 
virtual IWRFontContext * GetWRFontContext () const =0
 
virtual void AllowPurge ()=0
 
virtual void DisallowPurge ()=0
 
virtual void AddDirectory (IDFile fontsPath)=0
 
virtual void RemoveUnusedFontsFromCache ()=0
 
virtual ActionID IterateTypeQuestFonts (const ActionID lastLocalActionID, IFontMenuData *fontMenuData)=0
 
virtual HarfbuzzCooltype * GetHarfbuzzFontAccess ()=0
 
virtual bool16 AddCustomOTVarInstance (IFontGroup *fontGroup, const Fixed *designAxis)=0
 
virtual bool16 HasExtraDefaultVariableFont (CTFontDict *dict) const =0
 
virtual void GetDefaultVariableFontName (PMString &fontName, CTFontDict *dict) const =0
 
virtual IPMFontQueryVariableFont (const IFontGroup *fontGroup, const PMString &styleName) const =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

Manager for fonts. CoolType is for Adobe Internal use only. All PMStrings used in IFontMgr are expected to not be translatable. If you create a PMString to pass to IFontMgr you sould set it to no translate.

Member Enumeration Documentation

Types for what kind of font to get from QueryFont
Enumerator
kInternalFake_Not 

Get the installed font if available

kInternal_Substitution 

Create the font as missing even if installed

kInternalFake_Smallcap 

Gets a fake small cap font

Member Function Documentation

virtual void IFontMgr::AddFont (CTFontDict * dict)
pure virtual

Adds a font to the font set that this FontMgr manages. Each document has its own FontMgr now.

virtual void IFontMgr::AllowPurge ()
pure virtual

Internal Use only

virtual void IFontMgr::CoolTypeShuttingDown ()
pure virtual

Called on application quit to clean up.

virtual int32 IFontMgr::CurrentFontSystemSeed (bool16 fullCheck = kFalse,
bool16 cooltypeSeedOnly = kFalse 
) const
pure virtual

returns current seed – use this to detect changes

Parameters
fullCheckcauses cooltype to check the system for font changes.
cooltypeSeedOnlyreturns only cooltype seed. cooltype seed only changes when the font list has changed. The other seed changes when opening a document with missing fonts that are now present.
Returns
int32 new seed
virtual IPMFont* IFontMgr::FindVariant (IPMFontbasefont,
FontStyleBits stylebits,
PMReal smallCapScale,
int32 technology 
)
pure virtual

Given a base font, find a styled variant.

Parameters
basefontfont to find variant of
stylebitsstyle bits
smallcapscaleused when style bits are set to kSmallCaps to set small cap scale
technologyuse -1 for any technology
Returns
IPMFont* variant font
virtual void IFontMgr::ForceUpdateFontSystem ()
pure virtual

Forces an update and re-initializes the Font Manager

virtual const PMString& IFontMgr::GetDefaultFontName ()
pure virtual

Gets postscript name of default font

Returns
PMString& postscript name of default font
virtual std::string IFontMgr::GetDefaultFontPSName (int32 script = kDontKnowScript)
pure virtual

Gets postscript name of default font.

Parameters
ctScriptCan be any of the writing scripts. If kDontKnowScript is given, the default script for the current locale is used. values for script can be found in SDKDef.h
Returns
std::string postscript name of default font
virtual void IFontMgr::GetDefaultVariableFontName (PMStringfontName,
CTFontDict * dict 
) const
pure virtual

Internal Use only Given a variable font dict, returns the font name of the default font instance in fontName.

virtual int32 IFontMgr::GetNumFontGroups ()
pure virtual

Returns the number of font groups installed

Returns
int32 number of font groups installed
virtual IWRFontContext* IFontMgr::GetWRFontContext () const
pure virtual

Gets world ready font context

Returns
IWRFontContext* world ready font context
virtual bool16 IFontMgr::HasExtraDefaultVariableFont (CTFontDict * dict) const
pure virtual

Internal Use only Returns True if a variable font dictionary has a default font instance, that is not the same as one of the named instances. For non-variable fonts, always returns False.

virtual bool16 IFontMgr::IsFontAvailable (const PMStringfontname,
int32 writingscript = kDontKnowScript 
)
pure virtual

Returns whether a postscript font name is installed. checks that FontStatus() == IPMFont::kFontInstalled

Parameters
fontnamepostscript font name to check
writingscripthere for completeness and is passed into QueryFont but I think it has no purpose. Recommend to use default parameter of kDontKnowScript.
Returns
bool16 kTrue if font with postscript name is installed. kFalse if not.
virtual bool16 IFontMgr::IsSuitableUIFont (IPMFontpmFont)
pure virtual

Returns whether an IPMFont is installed and suitable for general content display.

Parameters
pmFontfont instance to check
Returns
bool16 kTrue if font is installed and suitable for general content display. kFalse if font is not installed or if it carries a truncated or otherwise unsuitable glyph complement.
virtual void IFontMgr::IterateFontGroups (FontGroupIteratorCallBackcallBack)
pure virtual

Iterate over font groups, calling back into FontGroupIteratorCallBack...

Parameters
callBack
virtual void IFontMgr::MarkBadFont (CTFontDict * badFontDict)
pure virtual

Mark a font dict as bad. Most likely because font dict has errors and could crash

Parameters
badFontDictcooltype dictionary to mark bad
virtual IPMFont* IFontMgr::QueryFont (const std::string & fontName,
FontStyleBits style = kNormal,
int32 writingscript = kDontKnowScript,
PMReal smallcapscale = 0.7,
InternalFake fake = kInternalFake_Not 
)
pure virtual

Retrieve a font using a postscript name, may return nil for fonts not found

Parameters
fontNamepostscript font name
stylefont style bits
writingscriptwriting script will be used if font is not found to find an appropriate substitute. values for script can be found in SDKDef.h
smallcapscaleused when style bits are set to kSmallCaps to set small cap scale
fakepassing in kInternal_Substitution forces resulting IPMFont to be missing even if postscript name font is installed. Calling GetFontStatus on the IPMFont will return IPMFont::kFontSubstituted
Returns
IPMFont* font found. check for nil and FontStatus() == IPMFont::kFontInstalled to see if the font is installed.
virtual IPMFont* IFontMgr::QueryFont (const PMStringfontName,
FontStyleBits style = kNormal,
int32 writingscript = kDontKnowScript,
PMReal smallcapscale = 0.7,
InternalFake fake = kInternalFake_Not 
)
pure virtual

Retrieve a font using a postscript name, may return nil for fonts not found

Parameters
fontNamepostscript font name
stylefont style bits
writingscriptwriting script will be used if font is not found to find an appropriate substitute. values for script can be found in SDKDef.h
smallcapscaleused when style bits are set to kSmallCaps to set small cap scale
fakepassing in kInternal_Substitution forces resulting IPMFont to be missing even if postscript name font is installed. Calling GetFontStatus on the IPMFont will return IPMFont::kFontSubstituted
Returns
IPMFont* font found. check for nil and FontStatus() == IPMFont::kFontInstalled to see if the font is installed.
virtual IPMFont* IFontMgr::QueryFont (const IFontGroupfontGroup,
int32 index,
FontStyleBits style = kNormal,
PMReal smallcapscale = 0.7,
InternalFake fake = kInternalFake_Not 
)
pure virtual

Retrieve a font using IFontGroup and font style index, may return nil for fonts not found

Parameters
fontGroupfont group
indexfont style index
stylefont style bits
smallcapscaleused when style bits are set to kSmallCaps to set small cap scale
fakepassing in kInternal_Substitution forces resulting IPMFont to be missing even if postscript name font is installed. Calling GetFontStatus on the IPMFont will return IPMFont::kFontSubstituted
Returns
IPMFont* font found. check for nil and FontStatus() == IPMFont::kFontInstalled to see if the font is installed.
virtual IPMFont* IFontMgr::QueryFont (const CTFontDict * rawFont,
InternalFake fake = kInternalFake_Not,
int32 index = -1,
bool16 bIsEPSFont = kFalse,
bool16 bIsEmbeddedFont = kFalse,
CCTEncoding * encoding = nil 
)
pure virtual

this method useful for converting raw CoolType fonts into InDesign style fonts

Parameters
rawFontCoolType font dictionary
fakepassing in kInternal_Substitution forces resulting IPMFont to be missing even if postscript name font is installed. Calling GetFontStatus on the IPMFont will return IPMFont::kFontSubstituted
indexindex of font style (Named Instance of variable font dict) in dictionary. Used in case of variable fonts as in variable fonts single dictionary can contain multiple styles. otherwise use -1.
bIsEPSFont
bIsEmbeddedFont
encoding
Returns
IPMFont* font found. check for nil and FontStatus() == IPMFont::kFontInstalled to see if the font is installed.
virtual IPMFont* IFontMgr::QueryFont (const CTFontDict * rawFont,
Fixed * designAxes,
InternalFake fake = kInternalFake_Not,
bool16 bIsEPSFont = kFalse,
bool16 bIsEmbeddedFont = kFalse,
CCTEncoding * encoding = nil 
)
pure virtual

this method useful for converting raw CoolType fonts into InDesign style fonts

Parameters
rawFontCoolType font dictionary
designAxesdesign axis of required variable font in rawFont (CTFontDict). if nullptr passed then Default face of font is applied.
fakepassing in kInternal_Substitution forces resulting IPMFont to be missing even if postscript name font is installed. Calling GetFontStatus on the IPMFont will return IPMFont::kFontSubstituted
bIsEPSFont
bIsEmbeddedFont
encoding
Returns
IPMFont* font found. check for nil and FontStatus() == IPMFont::kFontInstalled to see if the font is installed. return font with given design axis, if given design axis is null then default font design axis used
virtual IPMFont* IFontMgr::QueryFontFromDisplayName (const PMStringdisplayFamilyName,
PMStringfontStyle 
)
pure virtual

Finds a font given a display family name and font style.

Parameters
displayFamilyNamefamily name as it shows in the menu
fontStylestyle of font to find
Returns
IPMFont* font found
virtual IFontGroup* IFontMgr::QueryFontGroup (const PMStringgroupName)
pure virtual

retrieve a font group

Parameters
groupNameknown as group name or family name. can be either native or non native. if more than one group with same name this returns the first one found. Calling IFontGroup->GetGroupsWithSameName will return other groups with same name.
Returns
IFontGroup* font group found. nil if none found
virtual IFontGroup* IFontMgr::QueryFontGroup (int32 groupIndex)
pure virtual

retrieve a font group

Parameters
groupIndexindex of group. must be less than GetNumFontGroups
Returns
IFontGroup* font group found. nil if not found
virtual IFontInstance* IFontMgr::QueryFontInstance (const PMStringfontName,
const PMMatrixmatrix,
int32 writingscript = kDontKnowScript,
WritingDirection dir = kWD_LeftToRight,
FontStyleBits style = kNormal,
Fixed * designV = nil,
PMReal smallcapscale = 0.7 
)
pure virtual

retrieve an instance of a font, will return nil for non-existant fonts

Parameters
fontNamepostscript font name
matrixThis matrix describes the user space to device space transformation for the characters. Note that: 1. Only the first 4 values of the matrix are used. The x and y translation are ignored (it is a 2 x 2 matrix). 2. The matrix is treated as the entire user space to device space matrix (it will not be concatenated with any "current transformation matrix" before being used). matrix(12.0, 0.0, 0.0, 12.0, 0.0, 0.0) is a 12 point font instance
writingscriptwriting script will be used if font is not found to find an appropriate substitute. values for script can be found in SDKDef.h
dirwriting direction
stylefont style bits
designVfor multiple master font. Same as IPMFont GetNumDesignAxes
smallcapscaleused when style bits are set to kSmallCaps to set small cap scale
Returns
IFontInstance* font instance for given parameters
virtual IFontInstance* IFontMgr::QueryFontInstance (const IPMFontfont,
const PMMatrixmatrix,
WritingDirection dir = kWD_LeftToRight 
)
pure virtual

retrieve an instance of a font, will return nil for non-existant fonts

Parameters
fontfont to get instance for
matrixThis matrix describes the user space to device space transformation for the characters. Note that: 1. Only the first 4 values of the matrix are used. The x and y translation are ignored (it is a 2 x 2 matrix). 2. The matrix is treated as the entire user space to device space matrix (it will not be concatenated with any "current transformation matrix" before being used). matrix(12.0, 0.0, 0.0, 12.0, 0.0, 0.0) is a 12 point font instance
dirwriting direction
Returns
IFontInstance* font instance for given parameters
virtual IPMFont* IFontMgr::QueryFontPlatform (const PMStringfontName,
FontStyleBits style,
int32 ctScript = kDontKnowScript,
OriginalOS os = kOriginalUnknownOS,
FontNameInfooutNameInfo = nil 
)
pure virtual

this method is for getting InDesign fonts from edge information. If nameInfo is non nil it will be filled with info on the font. In the case that the font is installed this info is obtained from the font. In the case that the font does not exist on the system then we try to obtain this info from the FontNames.db file. outNameInfo->fFontInfoSet is set to kTrue if this info was successfully filled out.

Parameters
fontNameplatform font name
stylefont style bits
ctScriptCan be any of the writing scripts. If kDontKnowScript is given, the first match for a given operating system is returned. values for script can be found in SDKDef.h
osoperating system the platform font name came from
outNameInfoOUT font information for the platform name
Returns
IPMFont* font found. check for nil and FontStatus() == IPMFont::kFontInstalled to see if the font is installed.
virtual IPMFont* IFontMgr::QueryVariableFont (const IFontGroupfontGroup,
const PMStringstyleName 
) const
pure virtual

Returns variable font based on Font Group and Style Name

Parameters
fontGroupfont group
styleStyle Name
Returns
IPMFont* Variable font based on fontGroup and parent Style name
virtual void IFontMgr::SetDefaultFontName (const PMStrings)
pure virtual

Sets default font name. This sets the text default font this font is used in many places. DO NOT CHANGE this unless you really know what you are doing. This code will only allow you to set a font that is available and not corrupt (a bad font).

Parameters
spostscript name of font to set as default