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

#include <ICompositionUtils.h>

Inheritance diagram for ICompositionUtils:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_ICOMPOSITIONUTILS }
 

Public Member Functions

virtual ICalculatedTextResultNewCalculatedText (const ITextModel *model, TextIndex position, UTF32TextChar c, const IDrawingStyle *style=nil)=0
 
virtual ICalculatedTextResultNewCalculatedText (const UIDRef &forFrame, UTF32TextChar c, const IDrawingStyle *style, TextIndex position)=0
 
virtual ErrorCode GetCalculatedTextString (const ITextModel *model, TextIndex position, UTF32TextChar c, const IDrawingStyle *style, WideString *calcText)=0
 
virtual ErrorCode GetCalculatedTextString (const UIDRef &forFrame, UTF32TextChar c, const IDrawingStyle *style, WideString *calcText, TextIndex position)=0
 
virtual
ICalculatedTextResult::CalculatedStringContent 
ScanStringContents (const PMString &s) const =0
 
virtual bool16 RemapCharactersIfNecessary (const IDrawingStyle *style, const PMString &original, WideString &calcString) const =0
 
virtual ICalculatedTextResultInitializeCalcResult (const PMString &str, const IDrawingStyle *baseDrawStyle)=0
 
virtual PMReal CalcLeadingModelYPosAdjustment (PMReal lineHeight, Text::LeadingModel prevLeadingModel, PMReal prevLeading, PMReal prevLeadingModelOffset, Text::LeadingModel leadingModel, PMReal leading, PMReal leadingModelOffset)=0
 
virtual void PregenerateWaxRuns (const IWaxIterator *waxIter, TextIndex startPos, TextIndex endPos)=0
 
virtual OpenTypeFeatureList GetCalculatedOTFeaturesList (const IDrawingStyle *draw, bool japanese=false, bool vertical=false, bool isTCY=false)=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 related to text composition. e.g.

Utils<ICompositionUtils>()->NewCalculatedText( ... ) ;

Member Function Documentation

virtual PMReal ICompositionUtils::CalcLeadingModelYPosAdjustment (PMReal lineHeight,
Text::LeadingModel prevLeadingModel,
PMReal prevLeading,
PMReal prevLeadingModelOffset,
Text::LeadingModel leadingModel,
PMReal leading,
PMReal leadingModelOffset 
)
pure virtual

Given the leading information for a previous WaxLine, calculates an adjustment which, when added to the previous WaxLine's YPosition, determines the initial starting YPosition for the following WaxLine. Although the values returned may be negative, it will never exceed the lineHeight. This prevents the YPosition of the next line from being above the previous line's YPosition.

virtual OpenTypeFeatureList ICompositionUtils::GetCalculatedOTFeaturesList (const IDrawingStyledraw,
bool japanese = false,
bool vertical = false,
bool isTCY = false 
)
pure virtual

This method will return a list of substitution opentype features that are applied to the style. There are some GPOS features that are included, and some that will be left out (mostly kern & some japanese width features). There are also some heuristics related to justification that aren't in play in this routine because justification data is not here.

Parameters
drawis the style in question.
japanesedenotes whether to use some japanese specific logic around discretionary ligatures. specifies if the text in question is vertical specifies if the vertical text in question is actually "horizontal in vertical"
Returns
the list of opentype features that may be applied by the composer for this style.
virtual ErrorCode ICompositionUtils::GetCalculatedTextString (const ITextModelmodel,
TextIndex position,
UTF32TextChar c,
const IDrawingStylestyle,
WideStringcalcText 
)
pure virtual

Same as NewCalculatedText, except it returns just the string.

Returns
kSuccess when the calculated text string is correctly set. @ see NewCalculatedText
virtual ErrorCode ICompositionUtils::GetCalculatedTextString (const UIDRefforFrame,
UTF32TextChar c,
const IDrawingStylestyle,
WideStringcalcText,
TextIndex position 
)
pure virtual

Same as NewCalculatedText, except it returns just the string.

Returns
kSuccess when the calculated text string is correctly set. @ see NewCalculatedText
virtual ICalculatedTextResult* ICompositionUtils::InitializeCalcResult (const PMStringstr,
const IDrawingStylebaseDrawStyle 
)
pure virtual

Helper function used to generate necessary data for calculated text. May remap characters, change styles, etc.

Parameters
strIN the resulting string to use.
baseDrawStyleIN the style applied to the calculated text.
overrideDrawStyleIN the style locally applied to the calculated text. Can be nil.
Returns
the completed object containing the wide string and other relevant stuff.
virtual ICalculatedTextResult* ICompositionUtils::NewCalculatedText (const ITextModelmodel,
TextIndex position,
UTF32TextChar c,
const IDrawingStylestyle = nil 
)
pure virtual

Calculates the string based on the character and position passed in. Returns an object containing that string and other relevant stuff.

Parameters
modelIN the text model that contains the calculated text.
positionIN the location of the calculated text in question within the text model.
cIN the text char of the calculated text in question within the text model and the given position.
styleIN the text attributes applied to the calculated text, if nil it will be calculated
setMeOUT the object containing the calculated text and associated stuff.
returnkSuccess when the calculated text string is correctly set.
Returns
an object containing that string and other relevant stuff.
Note
This method is typically used for OwnedItem based calculated text (e.g. footnotes)
virtual ICalculatedTextResult* ICompositionUtils::NewCalculatedText (const UIDRefforFrame,
UTF32TextChar c,
const IDrawingStylestyle,
TextIndex position 
)
pure virtual

Calculates the string based on the character and text frame passed in.

Parameters
forFrameIN the text frame that contains the section name.
cIN the text char of the calculated text in question within the text model and the given position.
styleIN the text attributes applied to the calculated text, should not be nil
setMeOUT the object containing the calculated text and associated stuff.
Returns
an object containing that string and other relevant stuff.
Note
This method is typically used for non-OwnedItem based calculated text (e.g. page numbers)
virtual void ICompositionUtils::PregenerateWaxRuns (const IWaxIteratorwaxIter,
TextIndex startPos,
TextIndex endPos 
)
pure virtual

Experimental routine that will try to use multiple threads to generate the runs for multiple lines in parallel.

virtual bool16 ICompositionUtils::RemapCharactersIfNecessary (const IDrawingStylestyle,
const PMStringoriginal,
WideStringcalcString 
) const
pure virtual
Some fonts use custom use area characters (not unicode - e.g. Bembo Expert numbers)  - this method remaps them to the right unicode (via platform encoding).

Parameters
stylethe drawing style associated with this string
originalthe incoming string to be scanned/remapped
calcStringthe resulting string with remappings in place, if any
Returns
whether any remapping was done
virtual ICalculatedTextResult::CalculatedStringContent ICompositionUtils::ScanStringContents (const PMStrings) const
pure virtual
Scan the incoming string and return the characteristics of the contained characters

See Also
CalculatedStringContent