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

#include <IGlyphUtils.h>

Inheritance diagram for IGlyphUtils:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_IGLYPHUTILS }
 

Public Member Functions

virtual UTF32TextChar GlyphToCharacter (IPMFont *font, Text::GlyphID id, UTF32TextChar *userArea=nil)=0
 
virtual UTF32TextChar GetUnicodeForGlyphID (IPMFont *font, const Text::GlyphID &glyphID) const =0
 
virtual PMString GetUnicodeName (const UTF32TextChar &c)=0
 
virtual void InsertTheCharacter (ISelectionManager *selMgr, IPMFont *font, const GlyphEntry *baseGlyphEntry, const GlyphEntry *alternateGlyphEntry, bool16 selectChar=kFalse, bool16 setFont=kFalse)=0
 
virtual int32 GetSelectionGlyphSet (IPMFont *font, IFontInstance *fontInstance, const WideString &chars, Text::GlyphID glyph, GlyphSet *glyphSet, GlyphSet::GlyphSortOrder sortOrder=GlyphSet::kNoOrder)=0
 
virtual int32 GetGlyphListGlyphSet (IPMFont *font, IFontInstance *fontInstance, Text::GlyphID *glyphs, int32 numGlyphs, GlyphSet *glyphSet, GlyphSet::GlyphSortOrder sortOrder=GlyphSet::kNoOrder)=0
 
virtual bool16 GetGlyphHasAlternate (IPMFont *font, Text::GlyphID glyph, const char *tag=nil)=0
 
virtual unsigned GetGlyphAlternateCount (IPMFont *font, Text::GlyphID glyph, const char *tag=nil)=0
 
virtual int32 GetEntireFont (IPMFont *font, GlyphSet *glyphSet, GlyphSet::GlyphSortOrder sortOrder=GlyphSet::kNoOrder)=0
 
virtual int32 GetFilteredGlyphs (IPMFont *font, GlyphSet *glyphSet, GlyphFilterProcList &includeFilterProcList, GlyphFilterProcList &excludeFilterProcList, GlyphSet::GlyphSortOrder sortOrder=GlyphSet::kNoOrder)=0
 
virtual int32 GetOTFFeatureGlyphSet (const char *tags, int32 numTags, IPMFont *font, GlyphSet *glyphSet, GlyphSet::GlyphSortOrder sortOrder=GlyphSet::kNoOrder)=0
 
virtual bool16 GetOTFFeature (IPMFont *font, IFontInstance *fontInstance, const GlyphEntry *baseGlyph, const GlyphEntry *alternate, char *tagBuffer, int32 &choice)=0
 
virtual int32 GetGlyphsForFeatureAccessInfo (const char *tags, int32 numTags, IPMFont *font, GlyphSet *glyphSet)=0
 
virtual int32 GetGlyphAccessInfo (Text::GlyphID glyphID, IPMFont *font, GlyphAccessData *glyphAccessData)=0
 
virtual bool16 TestFeatureSubstitution (IFontInstance *fontInstance, const WideString &textString, char *tags, int32 *choices, int32 numFeatures, Text::GlyphID testGlyphID)=0
 
virtual void GetOTFAttribute (char *tags, int32 choice, AttributeBossList *attrBossList, OpenTypeFeatureList &featureList, int32 &form, IFontInstance *fontInstance, const WideString &stringToApply, Text::GlyphID g)=0
 
virtual bool GlyphFormIsKnown (ITextAttrGlyphForm::GlyphForm feature) const =0
 
virtual bool IsGlyphFormFeature (int32 feature) const =0
 
virtual bool IsGlyphFormFeature (const char *feature) const =0
 
virtual
ITextAttrGlyphForm::GlyphForm 
GlyphFormFromFeature (int32 feature) const =0
 
virtual
ITextAttrGlyphForm::GlyphForm 
GlyphFormFromFeature (const char *feature) const =0
 
virtual int32 GlyphFormToFeatureInt (ITextAttrGlyphForm::GlyphForm feature) const =0
 
virtual const char * GlyphFormToFeatureChars (ITextAttrGlyphForm::GlyphForm feature) const =0
 
virtual const char * GlyphFormDescriptiveString (ITextAttrGlyphForm::GlyphForm feature) const =0
 
virtual
ITextAttrGlyphForm::GlyphForm 
GlyphFormIncrement (ITextAttrGlyphForm::GlyphForm &) const =0
 
virtual
ITextAttrGlyphForm::GlyphForm 
GlyphFormDecrement (ITextAttrGlyphForm::GlyphForm &) 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

Utilities for dealing with glyphs.

Member Function Documentation

virtual int32 IGlyphUtils::GetEntireFont (IPMFontfont,
GlyphSetglyphSet,
GlyphSet::GlyphSortOrder sortOrder = GlyphSet::kNoOrder 
)
pure virtual

Get all glyphs in font

Parameters
fontfont to get glyphs in
glyphSetOUT all glyphs in font
sortOrderhow the returned glyph set should be sorted
Returns
int32 number of glyphs in glyphSet
virtual int32 IGlyphUtils::GetFilteredGlyphs (IPMFontfont,
GlyphSetglyphSet,
GlyphFilterProcListincludeFilterProcList,
GlyphFilterProcListexcludeFilterProcList,
GlyphSet::GlyphSortOrder sortOrder = GlyphSet::kNoOrder 
)
pure virtual

Get all glyphs in a font that satisfy the given filter function (typically from UnicodeClass).

Parameters
fontfont to get glyphs for
glyphSetOUT filtered glyphs in font meeting the filter function(s) condition(s).
includeFilterProcLista list of function pointers to use to filter "in" the glyphs in the font, typically from UnicodeClass.h. GlyphFilterProcList filterArray; filterArray.push_back(&UnicodeClass::IsPunctuationOpen()); filterArray.push_back(&UnicodeClass::IsPunctuationClose());
excludeFilterProcLista list of function pointers to use to further filter "out" the glyphs in the font captured by the includeFilterProcList, typically from UnicodeClass.h.
sortOrderhow the returned glyph set should be sorted
Returns
int32 number of glyphs in glyphSet
See Also
UnicodeClass.h for type definitions for filter procs.
virtual int32 IGlyphUtils::GetGlyphAccessInfo (Text::GlyphID glyphID,
IPMFontfont,
GlyphAccessDataglyphAccessData 
)
pure virtual

Sets glyphAccessData->fDesiredTag to global gDesiredTag. Calls IPMFont::GetOTGlyphAccess. External code should not use this and call IPMFont::GetOTGlyphAccess instead.

Parameters
glyphIDglyph id to get access for
fontfont glyph id is in
glyphAccessDataaccess data
Returns
int32 0 if success. 1 if failure.
virtual unsigned IGlyphUtils::GetGlyphAlternateCount (IPMFontfont,
Text::GlyphID glyph,
const char * tag = nil 
)
pure virtual

Determine how many alternate with a given OpenType feature tag the glyph has.

Parameters
fontfont to look for alternate glyph in
glyphglyph to look for alternate
tagOpenType feature tag to look for. 'aalt' if set to nil.
Returns
uint16 the number of alternates with the OpenType feature tag.
virtual bool16 IGlyphUtils::GetGlyphHasAlternate (IPMFontfont,
Text::GlyphID glyph,
const char * tag = nil 
)
pure virtual

Determine if glyph has alternate with a given OpenType feature tag.

Parameters
fontfont to look for alternate glyph in
glyphglyph to look for alternate
tagOpenType feature tag to look for. 'aalt' if set to nil.
Returns
bool16 kTrue if there is an alternate with OpenType feature tag.
virtual int32 IGlyphUtils::GetGlyphListGlyphSet (IPMFontfont,
IFontInstancefontInstance,
Text::GlyphID * glyphs,
int32 numGlyphs,
GlyphSetglyphSet,
GlyphSet::GlyphSortOrder sortOrder = GlyphSet::kNoOrder 
)
pure virtual

Get alternates for glyphs

Parameters
fontfont to get glyph alternates in
fontInstancefont instance to get glyph alternates in. needs to be an instance of font
glyphsglyphs to find alternates for
numGlyphsnumber of glyphs. must be < 20 (kMaxStrikes).
glyphSetOUT set of glyph alternates.
sortOrderhow the returned glyph set should be sorted
Returns
int32 returns length of glyphset. returns 0 if numGlyphs was >=20.
virtual int32 IGlyphUtils::GetGlyphsForFeatureAccessInfo (const char * tags,
int32 numTags,
IPMFontfont,
GlyphSetglyphSet 
)
pure virtual

Get glyphs for a OpenType feature

Parameters
tagsOpenType features to get glyphs for
numTagsnumber of OpenType features
fontfont to get glyphs in
glyphSetOUT glyphs with OpenType features
Returns
int32 1 if has alternates. 0 if no alternates.
virtual void IGlyphUtils::GetOTFAttribute (char * tags,
int32 choice,
AttributeBossListattrBossList,
OpenTypeFeatureListfeatureList,
int32 & form,
IFontInstancefontInstance,
const WideStringstringToApply,
Text::GlyphID g 
)
pure virtual

Get an attribute for an open type feature. Return if a suitable one was found.

Parameters
tagsOpenType feature to get attribute for
choicevalue of OTF feature chosen from tags array
attrBossListOUT attribute for the open type feature
featureListOUT
formOUT
fontInstancefont instance to get attribute for.
stringToApplystring to get OTF attribute for
gglyphID to get OTF attribute for
virtual bool16 IGlyphUtils::GetOTFFeature (IPMFontfont,
IFontInstancefontInstance,
const GlyphEntrybaseGlyph,
const GlyphEntryalternate,
char * tagBuffer,
int32 & choice 
)
pure virtual

Try and find an open type feature for the font/glyph combo. Return if a suitable one was found. Probably INTERNAL use only.

Parameters
fontfont glyph id is in
fontInstancefont instance to get OTF feature for. needs to be an instance of font
baseGlyphentry of base glyph
alternateentry of alternate glyph
tagsOpenType features to get glyphs for
choiceOUT return index value of OTF feature chosen from tags array.
Returns
bool16 whether the particular feature was found
virtual int32 IGlyphUtils::GetOTFFeatureGlyphSet (const char * tags,
int32 numTags,
IPMFontfont,
GlyphSetglyphSet,
GlyphSet::GlyphSortOrder sortOrder = GlyphSet::kNoOrder 
)
pure virtual

Get glyphs for a OpenType feature. Also sets global gDesiredTag that is used by GetGlyphAccessInfo for what OpenType feature to prefer.

Parameters
tagsOpenType features to get glyphs for
numTagsnumber of OpenType features
fontfont to get glyphs in
glyphSetOUT glyphs with OpenType features
sortOrderhow the returned glyph set should be sorted
Returns
int32 number of glyphs in glyphSet
virtual int32 IGlyphUtils::GetSelectionGlyphSet (IPMFontfont,
IFontInstancefontInstance,
const WideStringchars,
Text::GlyphID glyph,
GlyphSetglyphSet,
GlyphSet::GlyphSortOrder sortOrder = GlyphSet::kNoOrder 
)
pure virtual

Gets alternate glyph values for a given glyph.

Parameters
fontfont to get glyph alternates in
fontInstancefont instance to get glyph alternates in. needs to be an instance of font
charsunicode value(s) for glyph. multiple values only if glyph is a combination of unicode values like a ligature.
glyphglyph to get alternates for
glyphSetOUT set of glyph alternates.
sortOrderhow the returned glyph set should be sorted
Returns
int32 returns length of glyphset.
virtual UTF32TextChar IGlyphUtils::GetUnicodeForGlyphID (IPMFontfont,
const Text::GlyphID & glyphID 
) const
pure virtual

Gets a unicode character value for a glyph id. Uses GlyphToCharacter to get its work done. Will also get a unicode value for glyphs in OpenType features. Return first character for glyphs composed of multiple characters.

Parameters
*fontfont glyphid is from
glyphIDglyph id to get character value
Returns
unicode character value. Will return characters in private use area. May return 0.
virtual PMString IGlyphUtils::GetUnicodeName (const UTF32TextCharc)
pure virtual

Return a string for the name of the unicode character.

Parameters
cthe UTF32TextChar character to look up the name for
Returns
the Unicode name of the character. Maybe be missing for some characters, will return empty string in this case.
virtual const char* IGlyphUtils::GlyphFormDescriptiveString (ITextAttrGlyphForm::GlyphForm feature) const
pure virtual

GlyphFormDescriptiveString

Parameters
featureIN, the GlyphForm whose description string you want.
Returns
The descriptive string.
virtual ITextAttrGlyphForm::GlyphForm IGlyphUtils::GlyphFormFromFeature (int32 feature) const
pure virtual

GlyphFormFromFeature

Parameters
featureIN, the 4-character OpenType feature tag, stuffed into a 32-bit integer. The integer is the platform result of treating the char pointer as an int32 pointer.
Returns
The GlyphForm corresponding to the feature, or kNoForm if !FeatureInPurview (feature)
virtual ITextAttrGlyphForm::GlyphForm IGlyphUtils::GlyphFormFromFeature (const char * feature) const
pure virtual

GlyphFormFromFeature

Parameters
featureIN, the 4-character OpenType feature tag.
Returns
The GlyphForm corresponding to the feature, or kNoForm if !FeatureInPurview (feature)
virtual bool IGlyphUtils::GlyphFormIsKnown (ITextAttrGlyphForm::GlyphForm feature) const
pure virtual

GlyphFormIsKnown

Parameters
featureIN, the feature whose value you want to confirm is a legal value.
Returns
true if the glyph form is known (< ITextAttrGlyphForm::kBeyondEndForm)
virtual const char* IGlyphUtils::GlyphFormToFeatureChars (ITextAttrGlyphForm::GlyphForm feature) const
pure virtual

GlyphFormToFeatureChars

Parameters
featureIN, the GlyphForm whose OpenType tag you want.
Returns
The OpenType feature tag corresponding to 'feature', represented as characters.
virtual int32 IGlyphUtils::GlyphFormToFeatureInt (ITextAttrGlyphForm::GlyphForm feature) const
pure virtual

GlyphFormToFeatureInt

Parameters
featureIN, the GlyphForm whose OpenType tag you want.
Returns
The OpenType feature tag corresponding to 'feature', with the characters stuffed into an int. The integer is the platform result of treating the char pointer as an int32 pointer.
virtual UTF32TextChar IGlyphUtils::GlyphToCharacter (IPMFontfont,
Text::GlyphID id,
UTF32TextCharuserArea = nil 
)
pure virtual

Gets a unicode character value for a glyph id

Parameters
*fontfont glyphid is from
idglyph id to get character value
*userAreaOUT if not nil and character value is in private use area 0 is returned and userArea contains the private use area unicode value.
Returns
unicode character value. 0 if in PUA area and userArea is not nil.
virtual void IGlyphUtils::InsertTheCharacter (ISelectionManagerselMgr,
IPMFontfont,
const GlyphEntrybaseGlyphEntry,
const GlyphEntryalternateGlyphEntry,
bool16 selectChar = kFalse,
bool16 setFont = kFalse 
)
pure virtual

Inserts a glyph into textmodel

Parameters
*setMgrselection manager
*fontfont of glyph.
*baseGlyphEntryentry of base glyph
*alternateGlyphEntryentry of alternate glyph
selectCharselect glyph inserted
setFontset font of glyph to font passed in. font is restored to previous font after insertion
Returns
unicode character value. 0 if in PUA area and userArea is not nil.
virtual bool IGlyphUtils::IsGlyphFormFeature (int32 feature) const
pure virtual

IsGlyphFormFeature

Parameters
featureIN, the 4-character OpenType feature tag, stuffed into a 32-bit integer. The integer is the platform result of treating the char pointer as an int32 pointer.
Returns
whether the supplied feature is one covered by this class (i.e., it's in GlyphForm.)
virtual bool IGlyphUtils::IsGlyphFormFeature (const char * feature) const
pure virtual

IsGlyphFormFeature

Parameters
featureIN, the 4-character OpenType feature tag.
Returns
whether the supplied feature is one covered by this class (i.e., it's in GlyphForm.)
virtual bool16 IGlyphUtils::TestFeatureSubstitution (IFontInstancefontInstance,
const WideStringtextString,
char * tags,
int32 * choices,
int32 numFeatures,
Text::GlyphID testGlyphID 
)
pure virtual

Description Probably INTERNAL use only.

Parameters
fontInstancefont instance to test out application of OTF features. needs to be an instance of font
textStringa string of length 1 to apply OTF the feature to
tagsOpenType features array
choicesarray of choice for features. count is the same as numFeatures.
numFeaturesnumber of features in features variable
testGlyphID
Returns
kTrue if feature can be applied, kFalse if not
See Also
IFontInstance.h, ApplyFeatures