InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
SLCTextGlyphNode Class Reference

#include <SLCTextGlyphNode.h>

Inheritance diagram for SLCTextGlyphNode:
SLCGlyphNode

Public Member Functions

 SLCTextGlyphNode (IComposeScanner *composeScanner, IDrawingStyle *drawingStyle, TextIndex startingIndex, const PMReal &xOffset)
 
virtual ~SLCTextGlyphNode (void)
 
virtual SLComposerStatusCode GetGlyph (const UTF32TextChar &character, Text::GlyphID &glyphID, PMReal &glyphWidth)
 
virtual SLComposerStatusCode BufferGlyph (const UTF32TextChar &character, const Text::GlyphID &glyphID, const PMReal &glyphWidth)
 
virtual PMReal GetWidth (void) const
 
virtual SLComposerStatusCode FindTextBreak (void)
 
virtual bool16 GetTrailingWhiteSpaceWidth (PMReal &width) const
 
virtual bool16 FitTrailingWhiteSpace (const PMReal &widthScaleFactor)
 
virtual SLComposerStatusCode CreateWax (const IWaxLine *waxLine) const
 
virtual IWaxRunCreateWaxRun (void) const
 
- Public Member Functions inherited from SLCGlyphNode
 SLCGlyphNode (IComposeScanner *composeScanner, IDrawingStyle *drawingStyle, TextIndex startingIndex, const PMReal &xOffset, GlyphNodeType glyphNodeType)
 
virtual SLComposerStatusCode GetStatus () const
 
virtual ~SLCGlyphNode ()
 
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 Member Functions

const PMRealGetPointSize (void) const
 
SLComposerStatusCode GrowBuffers (void)
 
void CalculateFixedToPMRealEmDashWidthRoundingError (void)
 
const PMRealGetFixedToPMRealEmDashWidthRoundingError (void) const
 
const PMRealGetEmDashWidth (void) const
 
virtual Text::GlyphID DetermineGlyphID (const UTF32TextChar &character) const
 
virtual PMReal DetermineGlyphWidth (const Text::GlyphID &glyphID) const
 
virtual K2Vector< Text::GlyphID > GetGlyphIDs (void)
 
virtual K2Vector< PMRealGetGlyphWidths (void)
 
virtual SLComposerStatusCode ApplyTextBreakRules (void)
 
virtual SLComposerStatusCode GetCharacter (int32 glyphNodeIndex, UTF32TextChar &character) const
 
virtual SLComposerStatusCode PushOut (UTF32TextChar &lastCharacter)
 

Additional Inherited Members

- Public Types inherited from SLCGlyphNode
enum  GlyphNodeType { kGNTText = 0, kGNTInlineGraphic }
 
- Protected Attributes inherited from SLCGlyphNode
SLComposerStatusCode fStatus
 
IComposeScannerfComposeScanner
 
IDrawingStylefDrawingStyle
 
PMReal fXOffset
 
TextIndex fTextIndex
 
PMReal fLeading
 
PMReal fAscent
 
PMReal fCapHeight
 
PMReal fXHeight
 
int32 fTextSpan
 
const GlyphNodeType fGlyphNodeType
 

Detailed Description

Represents a run of styled text and generates its wax run object(kWaxTextRunBoss).

This class uses the style and font APIs (IDrawingStyle, IPMFont and IFontInstance) to discover essential metrics such as leading, ascent etc. It maps a character code into its corresponding GlyphID and stores it in a buffer along with its width. It understands how to locate points where Roman text can be broken across lines or tile.

Constructor & Destructor Documentation

SLCTextGlyphNode::SLCTextGlyphNode (IComposeScannercomposeScanner,
IDrawingStyledrawingStyle,
TextIndex startingIndex,
const PMRealxOffset 
)

Caches the font and font metrics for the text.

SLCTextGlyphNode::~SLCTextGlyphNode (void )
virtual

Releases references and memory.

Member Function Documentation

SLComposerStatusCode SLCTextGlyphNode::ApplyTextBreakRules (void )
protectedvirtual

Applies rules to find where Roman text can be broken.

Returns
kCompSuccess if the text in this buffer can be broken.
SLComposerStatusCode SLCTextGlyphNode::BufferGlyph (const UTF32TextCharcharacter,
const Text::GlyphID & glyphID,
const PMRealglyphWidth 
)
virtual

See SLCGlyphNode.

Implements SLCGlyphNode.

void SLCTextGlyphNode::CalculateFixedToPMRealEmDashWidthRoundingError (void )
protected

Calculate the width rounding error introduced by fixed-point math for an em-dash character in the current IFontInstance.

This rounding error is used to compensate for the fact that fixed-point math in AGM is only fully accurate to the 4th decimal place.

The internal units used by composition is Points. The measure used in Roman fonts is points so rounding error is not significant for Roman composition. However other measures such as Japanese Q units need more accuracy to round trip to the internal measure.

In AGM a fixed-point number is 32 bits long. The low-order 16 bits contain the fractional part of the number and the high-order 16 bits contain the integer part of the number. Note 1/32767 ~ 0.0000305.

The adjustment calculated here for an em-dash is applied proportionally to each fixed-point glyph width.

Postcondition
GetFixedToPMRealEmDashWidthRoundingError can be called.
See Also
DetermineGlyphWidth
SLComposerStatusCode SLCTextGlyphNode::CreateWax (const IWaxLinewaxLine) const
virtual

See SLCGlyphNode.

Implements SLCGlyphNode.

IWaxRun * SLCTextGlyphNode::CreateWaxRun (void ) const
virtual

Creates a kWaxTextRunBoss object (see SLCGlyphNode for other info).

Implements SLCGlyphNode.

Text::GlyphID SLCTextGlyphNode::DetermineGlyphID (const UTF32TextCharcharacter) const
protectedvirtual

Determine the GlyphID for a given character from the IFontInstance for this run. Handles kTextChar_SpecialGlyph character used to describe glyphs that have no corresponding Unicode character code. Such characters have text attribute kTextAttrSpecialGlyphBoss applied which is used to map in the desired GlyphID from the font. The mapping is obtained via a method on IDrawingStyle.

Parameters
character
Returns
GlyphID associated with the given character.
PMReal SLCTextGlyphNode::DetermineGlyphWidth (const Text::GlyphID & glyphID) const
protectedvirtual

Determine the width of the given glyph.

Parameters
glyphID
Returns
width in points.
SLComposerStatusCode SLCTextGlyphNode::FindTextBreak (void )
virtual

See SLCGlyphNode.

Implements SLCGlyphNode.

bool16 SLCTextGlyphNode::FitTrailingWhiteSpace (const PMRealwidthScaleFactor)
virtual

See SLCGlyphNode.

Implements SLCGlyphNode.

SLComposerStatusCode SLCTextGlyphNode::GetCharacter (int32 glyphNodeIndex,
UTF32TextCharcharacter 
) const
protectedvirtual

Get the character code corresponding to the glyph at the given index in this object.

Parameters
glyphNodeIndex
characterat the given index
Returns
kCompSuccess on success, other status otherwise.
const PMReal& SLCTextGlyphNode::GetEmDashWidth (void ) const
inlineprotected
Returns
the width of an em-dash character in fixed point.
const PMReal& SLCTextGlyphNode::GetFixedToPMRealEmDashWidthRoundingError (void ) const
inlineprotected
Returns
the width rounding error for an em-dash character.
SLComposerStatusCode SLCTextGlyphNode::GetGlyph (const UTF32TextCharcharacter,
Text::GlyphID & glyphID,
PMRealglyphWidth 
)
virtual

See SLCGlyphNode.

Implements SLCGlyphNode.

virtual K2Vector<Text::GlyphID> SLCTextGlyphNode::GetGlyphIDs (void )
inlineprotectedvirtual
Returns
a pointer to the array of GlyphID's buffered in this object.
virtual K2Vector<PMReal> SLCTextGlyphNode::GetGlyphWidths (void )
inlineprotectedvirtual
Returns
a pointer to the array of glyph widths that correspond to the GlyphID's returned by {GetGlyphIDs}.
const PMReal& SLCTextGlyphNode::GetPointSize (void ) const
inlineprotected
Returns
the point size of the text in this object.
bool16 SLCTextGlyphNode::GetTrailingWhiteSpaceWidth (PMRealwidth) const
virtual

See SLCGlyphNode.

Implements SLCGlyphNode.

PMReal SLCTextGlyphNode::GetWidth (void ) const
virtual

See SLCGlyphNode.

Implements SLCGlyphNode.

SLComposerStatusCode SLCTextGlyphNode::GrowBuffers (void )
protected

Check if the dynamic buffers in this object can take another glyph and grow them if necessary.

Returns
kCompSuccess on success, kCompOutOfMemory otherwise.
SLComposerStatusCode SLCTextGlyphNode::PushOut (UTF32TextCharlastCharacter)
protectedvirtual

Remove the last glyph in this object from the buffer.

Parameters
lastCharacterOUT the character associated with what is now the last glyph in this object.
Returns
kCompSuccess on success, other status otherwide.