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

#include <SLCGlyphNode.h>

Inheritance diagram for SLCGlyphNode:
SLCInlineGraphicGlyphNodeSLCTextGlyphNode

Public Types

enum  GlyphNodeType { kGNTText = 0, kGNTInlineGraphic }
 

Public Member Functions

 SLCGlyphNode (IComposeScanner *composeScanner, IDrawingStyle *drawingStyle, TextIndex startingIndex, const PMReal &xOffset, GlyphNodeType glyphNodeType)
 
virtual SLComposerStatusCode GetStatus () const
 
virtual ~SLCGlyphNode ()
 
virtual SLComposerStatusCode GetGlyph (const UTF32TextChar &character, Text::GlyphID &glyphID, PMReal &glyphWidth)=0
 
virtual SLComposerStatusCode BufferGlyph (const UTF32TextChar &character, const Text::GlyphID &glyphID, const PMReal &glyphWidth)=0
 
virtual PMReal GetWidth () const =0
 
virtual SLComposerStatusCode FindTextBreak ()=0
 
virtual bool16 GetTrailingWhiteSpaceWidth (PMReal &width) const =0
 
virtual bool16 FitTrailingWhiteSpace (const PMReal &widthScaleFactor)=0
 
virtual SLComposerStatusCode CreateWax (const IWaxLine *waxLine) const =0
 
virtual IWaxRunCreateWaxRun () const =0
 
virtual IDrawingStyleGetDrawingStyle () const
 
virtual const int32 & GetTextSpan () const
 
const PMRealGetLeading () const
 
const PMRealGetAscent () const
 
const PMRealGetCapHeight () const
 
const PMRealGetXHeight () const
 
const TextIndex & GetTextIndex () const
 
bool16 IsTrailingWhiteSpace (const UTF32TextChar &character) const
 
virtual void Dump (const char *msg) const
 
void SetTextSpan (int32 count)
 

Protected Attributes

SLComposerStatusCode fStatus
 
IComposeScannerfComposeScanner
 
IDrawingStylefDrawingStyle
 
PMReal fXOffset
 
TextIndex fTextIndex
 
PMReal fLeading
 
PMReal fAscent
 
PMReal fCapHeight
 
PMReal fXHeight
 
int32 fTextSpan
 
const GlyphNodeType fGlyphNodeType
 

Detailed Description

Base class for a glyph node, the intermediate representation of a run of text used by this implementation during composition. The role of a glyph node is to maintain the information required to compose and ultimately generate a wax run(IWaxRun).

This class is specialised and completed to handle text(SLCTextGlyphNode) or inline graphics(SLCInlineGraphicGlyphNode) each of which have a distinct wax run boss class. A full composer implementation might have further sub-classes capable of creating other types of wax run(see IWaxRun).

See Also
IWaxRun
SLCTextGlyphNode
SLCInlineGraphicGlyphNode

Member Enumeration Documentation

Each sub-class should add an enum to identify the type wax run it represents.

Constructor & Destructor Documentation

SLCGlyphNode::SLCGlyphNode (IComposeScannercomposeScanner,
IDrawingStyledrawingStyle,
TextIndex startingIndex,
const PMRealxOffset,
GlyphNodeType glyphNodeType 
)

Initialises the common state required to compose the any text.

Parameters
composeScannerIN for the story.
drawingStyleIN for the run of text.
startingIndexIN into the text model of the first character in the run.
xOffsetIN relative to the left edge of the wax line.
glyphNodeTypeIN
Postcondition
check for successful construction by calling GetStatus.
SLCGlyphNode::~SLCGlyphNode ()
virtual

Tidies up.

Member Function Documentation

virtual SLComposerStatusCode SLCGlyphNode::BufferGlyph (const UTF32TextCharcharacter,
const Text::GlyphID & glyphID,
const PMRealglyphWidth 
)
pure virtual

Store glyph information for this character.

Parameters
character
glyphID
glyphWidth
Returns
kCompSuccess on success, kCompEndOfLine if character is line end or soft line, kCompIncompatibleCharacter if this node can't handle the character. kCompOutOfMemory if there's no memory available, other status otherwise.

Implemented in SLCInlineGraphicGlyphNode, and SLCTextGlyphNode.

virtual SLComposerStatusCode SLCGlyphNode::CreateWax (const IWaxLinewaxLine) const
pure virtual

Create a wax run and add it to the given line.

Parameters
waxLineto which run should be added.
Returns
kCompSuccess on success, other status otherwise.

Implemented in SLCInlineGraphicGlyphNode, and SLCTextGlyphNode.

virtual IWaxRun* SLCGlyphNode::CreateWaxRun () const
pure virtual

Create a wax run from the buffered glyph and style information.

Returns
wax run interface pointer, the caller must release the reference.

Implemented in SLCInlineGraphicGlyphNode, and SLCTextGlyphNode.

void SLCGlyphNode::Dump (const char * msg) const
virtual

Dump diagnostic info to Trace.

virtual SLComposerStatusCode SLCGlyphNode::FindTextBreak ()
pure virtual

Determine a point where the text in this object can be broken.

Returns
kCompSuccess if valid break point found, other status otherwise.
Postcondition
glyphs that lie after the break point are removed.

Implemented in SLCInlineGraphicGlyphNode, and SLCTextGlyphNode.

virtual bool16 SLCGlyphNode::FitTrailingWhiteSpace (const PMRealwidthScaleFactor)
pure virtual

Adjust the width of any trailing white space in the node by the given scale factor.

Parameters
widthScaleFactorIN Scaling factor of trailing white space. Must be between 0.0 and 1.0, non-inclusive.
Returns
kTrue node contains only trailing white space, kFalse otherwise.

Implemented in SLCInlineGraphicGlyphNode, and SLCTextGlyphNode.

const PMReal& SLCGlyphNode::GetAscent () const
inline
Returns
the ascent of the text in this object.
const PMReal& SLCGlyphNode::GetCapHeight () const
inline
Returns
the cap height of the text in this object.
virtual IDrawingStyle* SLCGlyphNode::GetDrawingStyle () const
inlinevirtual
Returns
the drawing style the glyphs are associated with.
virtual SLComposerStatusCode SLCGlyphNode::GetGlyph (const UTF32TextCharcharacter,
Text::GlyphID & glyphID,
PMRealglyphWidth 
)
pure virtual

Get glyph information for the given character.

Parameters
characterfor which glyph info is desired.
glyphIDthe character maps to in the font or kInvalidGlyphID if not in the font.
glyphWidthof the glyph in the style that applies to this run.
Returns
kCompSuccess on success, kCompIncompatibleCharacter if this node can't handle the character, other status otherwise.

Implemented in SLCInlineGraphicGlyphNode, and SLCTextGlyphNode.

const PMReal& SLCGlyphNode::GetLeading () const
inline
Returns
the leading of the text in this object.
virtual SLComposerStatusCode SLCGlyphNode::GetStatus () const
inlinevirtual

Get status of object (should be called after object construction).

Returns
kCompSuccess means object was successfully constructed, kCompFailure otherwise.
const TextIndex& SLCGlyphNode::GetTextIndex () const
inline
Returns
the index into the text model of the first character in this object.
virtual const int32& SLCGlyphNode::GetTextSpan () const
inlinevirtual
Returns
the number of glyphs buffered in this object.
virtual bool16 SLCGlyphNode::GetTrailingWhiteSpaceWidth (PMRealwidth) const
pure virtual

Get the width of trailing white space in the node.

Returns
kTrue node contains only trailing white space, kFalse otherwise.

Implemented in SLCInlineGraphicGlyphNode, and SLCTextGlyphNode.

virtual PMReal SLCGlyphNode::GetWidth () const
pure virtual
Returns
the overall width of the glyphs buffered in this object.

Implemented in SLCInlineGraphicGlyphNode, and SLCTextGlyphNode.

const PMReal& SLCGlyphNode::GetXHeight () const
inline
Returns
the x height of the text in this object (the height of a lowercase x in the IFontInstance of this object).
bool16 SLCGlyphNode::IsTrailingWhiteSpace (const UTF32TextCharcharacter) const

Determines if the character is a trailing white space character.

Parameters
characterIN Text char to test.
Returns
kTrue if character is a trailing white space character, kFalse otherwise.
void SLCGlyphNode::SetTextSpan (int32 count)
inline

Set the number of glyphs in this object.

Parameters
count

Member Data Documentation

IComposeScanner* SLCGlyphNode::fComposeScanner
protected

Scanner for the story.

IDrawingStyle* SLCGlyphNode::fDrawingStyle
protected

Drawing style for the glyphs in the run.

SLComposerStatusCode SLCGlyphNode::fStatus
protected

Object status, kCompSuccess means object successfully constructed.

TextIndex SLCGlyphNode::fTextIndex
protected

Index into the text model of the first character in the run.

int32 SLCGlyphNode::fTextSpan
protected

Number of glyphs in the node.

PMReal SLCGlyphNode::fXOffset
protected

x offset from left edge of the line to edge of first glyph.