![]() | InDesign SDK 20.5 |
#include <IFontInstance.h>

Public Types | |
| enum | { kNormalOutlines = 0, kHintedOutlines = 1, kVerticalOutlines = 2, kVerticalGlyphs = 4 } |
| enum | FeatureInfoFlags { kApplyGlyphSub = 1 << 0, kApplyGlyphPos = 1 << 1, kApplyGlyphSubAndPos = kApplyGlyphSub | kApplyGlyphPos, kRightToLeft = 1<<3, kCTFlagsBitMask = 0x0F, kModifyWidthsInPlace = 1 << 5 } |
| enum | { kNoChange = 0, kLigatureApplied = 1<<4, kGlyphDeleted = 1<<5 } |
Public Member Functions | |
| virtual Text::GlyphID | GetGlyphID (UTF32TextChar charCode) const =0 |
| virtual void | GetGlyphIDs (const WideString &textString, K2Vector< Text::GlyphID > &glyphIDs) const =0 |
| virtual void | AppendGlyphIDs (const UTF16TextChar *buffer, int32 bufSize, K2Vector< Text::GlyphID > &glyphIDs) const =0 |
| virtual int32 | FillOutGlyphIDs (PMRealGlyphPoint *glyphPoints, int32 numGlyphs, const UTF16TextChar *textchars, int32 bufSize) const =0 |
| virtual Text::GlyphID | GetNotDefinedGlyph () const =0 |
| virtual PMReal | GetGlyphWidth (Text::GlyphID glyphID) const =0 |
| virtual void | GetWidths (PMRealGlyphPoint *glyphPoints, int32 numGlyphs) const =0 |
| virtual PMRect | GetGlyphBBox (Text::GlyphID glyphID) const =0 |
| virtual void | MeasureWText (const UTF16TextChar *text, int32 utf16BufferLength, PMReal &xWidth, PMReal *yHeight=nil) const =0 |
| virtual void | MeasureWText (const WideString &string, PMReal &xWidth, PMReal *yHeight=nil) const =0 |
| virtual void | MeasureWText (const PMString &string, PMReal &xWidth, PMReal *yHeight=nil) const =0 |
| virtual bool16 | HasKerningTable () const =0 |
| virtual void | GetKerns (PMRealGlyphPoint *glyphPoints, int32 numGlyphs, bool16 vertical=kFalse, const char *scriptTag=nil, const char *langTag=nil) const =0 |
| virtual void | GetOutlineInfo (IOutlineInfo *callBack, Text::GlyphID glyphID, PMReal xOffset, PMReal yOffset, int32 flags=kNormalOutlines) const =0 |
| virtual PMReal | GetAscent () const =0 |
| virtual PMReal | GetDescent () const =0 |
| virtual PMReal | GetCapHeight () const =0 |
| virtual PMReal | GetXHeight () const =0 |
| virtual PMReal | GetEmBoxHeight () const =0 |
| virtual void | GetICFBoxInsets (PMReal *fromEmTop, PMReal *fromEmBottom) const =0 |
| virtual PMReal | GetHorizEmBoxDepth () const =0 |
| virtual PMReal | GetHorizICFBoxDepth () const =0 |
| virtual CTFontInst * | GetCTFontInst () const =0 |
| virtual CTFontDict * | GetParentCTFontDict () const =0 |
| virtual void | GetDesignVector (PMReal *designVec, size_t &designVecLen) const =0 |
| virtual size_t | GetNumDesignAxes () const =0 |
| virtual const PMMatrix & | GetPMMatrix () const =0 |
| virtual IFontMgr::WritingDirection | GetWritingDirection () const =0 |
| virtual bool16 | ApplyFeatures (PMRealGlyphPoint *glyphPoints, size_t &numGlyphPoints, size_t &numGlyphPointsAvail, int32 numFeatures, const char *features, const int32 *choiceIndices, const size_t *featureRanges, char *changeAttrib, FeatureInfoFlags flags, PMReal *penPos=nil, PMReal *caretPositions=nil, const char *scriptTag=nil, const char *langTag=nil) const =0 |
| virtual CTFontInstance * | GetCTFontInstance () const =0 |
| virtual bool16 | GermanLocaleDropsLigatures () const =0 |
Public Member Functions inherited from grRefCountedObj | |
| grRefCountedObj () | |
| virtual | ~grRefCountedObj ()=0 |
| virtual void | AddRef () const |
| virtual void | Release () const |
Additional Inherited Members | |
Protected Attributes inherited from grRefCountedObj | |
| int32 | fRefCount |
This is a shell over the CoolType API for FontInstances.
| anonymous enum |
Flags for outline iterators
kHintedOutlines If set, the outlines will be fetched with hints applied at the size specified by the font matrix. If not set, unhinted outlines will be fetched
kVerticalOutlines If set, CoolType will assume that the outlines are being set vertically and the origin will be shifted accordingly. This will approximate postscript's vmode=1 and will shift the outlines left and down
kVerticalGlyphs If set, the glyphs are assumed to be vertical glyphs but no wmode adjustment will be done. When set, the outlines for ATC font glyphs whose baseline is adjusted vertically will be adjusted horizontally instead. kVerticalOutlines and kVerticalGlyphs are mutually exclusive so both flags must not be set.
| anonymous enum |
Change attribute flags
FeatureInfoFlags
| pure virtual |
For a buffer of utf16 chars get the glyphIDs.
| buffer | IN Unicode values to get glyphids from. |
| bufSize | number of utf16 values in the string (not characters). |
| glyphIDs | OUT glyphIDs |
| pure virtual |
Applies features for a set of glyphs. In OpenType fonts, the order in which features are applied depends on the order of lookups in the 'GSUB' and 'GPOS' tables in the font, and not on the order in the features array of this API.
The featureRanges array, if non-NULL, must contain numFeatures*2 elements. Each feature specified in the features array will correspond, in order, to a range in the featureRanges array. A range is represented by two consecutive longs: the starting and ending indexes, respectively, into the glyphPoints array (which starts at index 0). A client need not bother "clamping" a range e.g. if there are 3 glyphPoints, then the range -1 .. 4 will be regarded as 0 .. 2.
| glyphPoints | Pointer to an array of PMRealGlyphPoint's with 'numGlyphPoints' valid entries and 'numGlyphPointsAvail' available entries (to allow room for possible expansion with 'GSUB'). The valid entries must have their glyphID's initialized but the x and y positions needn't be initialized. |
If expansion occurs, and the number of glyphPoints needed is greater than numGlyphPointsAvail, then the function will set numGlyphPointsAvail to that number and return false (the client can then re-size the array and call again); otherwise it will return true and set 'numGlyphPoints' to the actual valid number of glyphPoints if this increases or decreases with 'GSUB'.
If glyph positioning is requested (kApplyGlyphPos or kApplyGlyphSubAndPos), The xPosition and yPosition fields of the glyphPoints will be set to the deltas from the glyphs' default positions were no positioning features applied. So if the requested positioning layout features e.g. "kern" didn't affect the glyphs, the xPosition and yPositions would all be set to 0 on return.
The position of the glyphPoints is expressed in a coordinate system with the x axis horizontal, increasing in the direction of the run of text (i.e. increasing toward the right if rightToLeft is kFalse, increasing toward the left if rightToLeft is kTrue). The y axis is vertical, increasing from top to bottom.
| numGlyphPoints | number of glyphs in glyphPoints |
| numGlyphPointsAvail | glyphPoints allocated in glyphPoints variable |
| numFeatures | number of features in features variable |
| features | features to apply to glyphs |
| choiceIndices | array of choice for features. count is the same as numFeatures. use -1 for features without choice |
| featureRanges | length of size_t is 2*numFeatures. size_t pair indicates the range of glyphs to apply the feature to. 0,0 would apply only to the first glyph. One pair for each feature in the features array. This array is optional and may be NULL |
| changeAttrib | Array of flags. This array of bytes must be as long as 'numStrikes' if present. Set to NULL if functionality not needed. The array will be filled in with bitflags that will indicate what changes occurred in the* original* strike list. This may not match the resulting list but is intended to indicate what has changed to aid in cursor positioning, for instance. |
| flags@see | FeatureInfoFlags |
| penPos | If this optional parameter is non-NULL and glyph positioning is requested (kApplyGlyphPos or kApplyGlyphSubAndPos in the featureInfo's flags field), then this parameter must point to an array of 2 elements. |
On successful return, these elements (which needn't be initialized by the client) will be set to the x and y deltas, respectively, from the point to which the pen advances after the last resulting glyphPoint's default pen displacement. If glyph positioning is not requested, this parameter is not read and may be set to NULL
| caretPositions | The glyphs' positions for rasterizing will be maintained in the 'glyphPoints' array, but if the client wants precise caret positioning it must maintain its own parallel array for caret positions. Conceptually, before applying layout features, these two arrays coincide. |
If this parameter is non-NULL and glyph positioning is requested, (kApplyGlyphPos or kApplyGlyphSubAndPos in the featureInfo's flags field) then this parameter must point to an array of (n + 1) entries, where n is the input value of 'numGlyphPointsAvail'. On successful return, these entries (which needn't be initialized by the client) will be set to the increments in caret positions that resulted from applying the features.
If the writing direction of the font instance is left to right, the caret increments in the x direction are returned. If the writing direction is top to bottom, the caret increments in the y direction are returned.
The initial m entries (where m is the output value of 'numGlyphPoints') will correspond to the caret positions just before each of the glyphs in the resulting 'glyphPoints' array, and the next entry will correspond to the caret position just after the last glyph in the resulting 'glyphPoints' array. Caret positions within a ligature glyph are not provided.
| scriptTag | 4-character OpenType script tag. The 'script' and 'language' parameters identify the language system to be used. If 'script' is NULL, a language system in the font based on the font's writing script is used; the 'language' parameter is ignored. 'script' and 'language' are ignored for non-OpenType fonts. |
| langTag | 4-character OpenType language tag. See 'script' parameter above. |
| pure virtual |
For a buffer of utf16 chars get the glyphIDs.
| glyphPoints | OUT resulting glyphs are stored here. |
| numGlyphs | IN number of glyphPoints available in the buffer. |
| textchars | IN Unicode values to get glyphids from. |
| bufSize | number of utf16 values in the string (not characters). |
| pure virtual |
GermanLocaleDropsLigatures In some earlier versions of Adobe OpenType fonts, the German locale would not do ligatures. However, earlier versions of InDesign would do ligatures because the locale was not considered. After passing in the locale, we want to continue to do ligatures anyway in the fonts with this behavior.
| pure virtual |
Get the font instance's ascent. Height of the lower case 'd'.
| pure virtual |
Height of a capital 'X' if outline of X is available. Otherwise, bbox height.
| pure virtual |
Returns CTFontInst pointer for this font instance
| pure virtual |
Private: GetCTFontInstance returns the underlying opaque font instance object.
| pure virtual |
Get the font's descent. Bottom of the lower case 'p'.
| pure virtual |
Returns design axes vector and length in case of variable font. 'designVec' must be an allocated array that is at least of length kCTMaxDesignElements. If designVec passed nil then, only designVecLen gets populated.
| designVec | pass memory allocated array of RMReal, which gets populated by API. |
| designVecLen | populated by API to get number of design axes. |
| pure virtual |
Returns height of em-box. In CJK fonts, this is the height of the ideographic embox, which is usually equal to the pointsize, unless the font uses a scaled embox.
In vertical font instances, this "height" is actually the width of the embox, since ideographs are drawn upright in the vertical line of text.
The font's embox is based on the left, top, right, and bottom edges (in horizontal writing mode) of the ideographic em-box of the font. This value will be defined for every font (including non-CJK fonts, where it can be used to em-box-align these fonts alongside CJK fonts).
The ideographic em-box of a font, also referred to as an ideographic font's design space, defines a standard monospaced escapement around the glyphs of the font, for both horizontal and vertical writing modes. This will be an em high and an em wide unless the vendor explicitly indicates otherwise in the font. The OpenType specification strongly recommends against this being other than an em wide, but there are legitimate reasons for having it be other than an em high: some fonts used in Japanese newspaper layout, for example, have a vertically compressed ideographic em-box.
See the 'ideo' Baseline tag in the OpenType tag registry for more information.
| pure virtual |
Get bounding box for glyphid.
| glyphID | glyphid to get bbox for |
| pure virtual |
For a Unicode value get the glyphID.
| charCode | IN Unicode value to get glyphids from |
| pure virtual |
For a widestring get the glyphIDs.
| textString | IN Unicode values to get glyphids from |
| glyphIDs | OUT glyphIDs |
| pure virtual |
Returns the default pen displacement
The default pen displacement is sometimes called escapement or advance width. This is a simple lookup function and does not take into account things like kerning. Note that the writing direction for 'this' will effect the values returned for this function. If the writing direction is kWD_LeftToRight, the horizontal advance width is returned. If the writing direction is kWD_TopToBottom, the vertical advance height is returned. This means that if the font instance contains a rotated matrix the width returned is 0, i.e., rotated matrices are not handled by this function and a debug alert message is displayed in this case. If the font instance contains a rotated matrix then the GetWidths() function should be called.
| glyphID | glyphid to get width for |
| pure virtual |
Returns the distance from the Roman baseline to the em-box bottom for the horizontal writing mode. This is used to calculate roman baseline offset for both horizontal and vertical text, since InDesign draws vertical text and horizontal text from the same location (the pen location is at the roman baseline).
| pure virtual |
Returns the distance from the Roman baseline to the ICF box bottom for the horizontal writing mode. This is used to calculate roman baseline offset for both horizontal and vertical text, since InDesign draws vertical text and horizontal text from the same location (the pen location is at the roman baseline).
| pure virtual |
Calculate inset of Ideographic Character Face (ICF) box from embox. In vertical font instances, this is the left inset and right inset.
The ICF box is the maximum bounding box of the ideographic portion of a CJK font, usually centered within the em-box. Note that this value is defined also for non-CJK fonts.
The ICF box is used to size character grids to approximate the ink boundaries of each character and of the outsides of a full-justified frame.
See the 'icfb' and 'icft' Baseline tags in the OpenType tag registry for more information.
| fromEmTop | distance of ICF top from embox top |
| fromEmBottom | distance of ICF bottom from embox bottom |
| pure virtual |
Get kerning values for glyphids.
| glyphPoints | contains glyphs to get kern values for and puts results in x and y fields |
| numGlyphs | number of glyphs in glyphPoints |
| vertical | vertical or horizontal kerning? (ie "kern" or "vkrn" opentype feature?) |
| scriptTag | script tag |
| langTag | language tag |
| pure virtual |
Glyph id for undefined glyph.
| pure virtual |
Returns number of design axes in case of variable font.
| pure virtual |
Allows the caller to get path information about a specific Glyph. IOutlineInfo is a call back class. The various methods of IOutlineInfo are called for each segment of the character path.
| callBack | callback class |
| glyphID | glyph for which path info is obtained |
| xOffset | x offset |
| yOffset | y offset |
| flags | outline iterator |
| pure virtual |
Returns CTFontDict pointer for this font instance
| pure virtual |
Returns PMMatrix for this font instance
| pure virtual |
Returns the default pen displacements for one or more glyphs
This function is a multiple glyph version of GetGlyphWidth with the important exception that font instances that contain rotated matrices are handled correctly, i.e., the PMRealGlyphPoint's xPosition and yPosition fields are set to the x and y components, respectively, of either the horizontal advance (if the writing direction is kWD_LeftToRight) or the vertical advance (if the writing direction is kWD_TopToBottom) of each glyph. It is a simple lookup function and does not take into account things like kerning.
| glyphPoints | contains glyphs to get width values for and puts results in x and y fields |
| numGlyphs | number of glyphs in glyphPoints |
| pure virtual |
Get WritingDirection for this font instance
| pure virtual |
Height of small 'x' if outline of x is available. Otherwise 2/3 of bbox height.
| pure virtual |
Returns whether font instance has kerning table. This is not an OpenType specific call. This call will return true if the font has kerning whether it is OpenType or not.
| pure virtual |
Measure text using this font instance. Finds width and maximum height.
| text | Unicode values to find dimensions of. |
| utf16BufferLength | Length of Unicode text. |
| xWidth | OUT width of Unicode values. |
| yWidth | OUT maximum height of Unicode values. |
| pure virtual |
Measure text using this font instance. Finds width and maximum height.
| string | Unicode values to find dimensions of. |
| xWidth | OUT width of Unicode values. |
| yWidth | OUT maximum height of Unicode values. |
| pure virtual |
Measure text using this font instance. Finds width and maximum height.
| string | Unicode values to find dimensions of. |
| xWidth | OUT width of Unicode values. |
| yWidth | OUT maximum height of Unicode values. |