Kanzi  3.9.6
Kanzi Engine API
kanzi::ItypeTextShaper Class Reference

TextShaper implementation using Monotype's WTShaper library. More...

#include <kanzi/plugins/itype/itype_text_shaper.hpp>

Inheritance diagram for kanzi::ItypeTextShaper:
[legend]

Classes

struct  FontData
 Runtime data for text layouting to be passed to WTShaper. More...
 

Public Member Functions

virtual void adjustPositions (TextLayouter::IntermediateLayout *layout, const TextLayouter::LineInfo &line) const override
 Iterates all layouted glyphs on the line and adjusts their positions based on the shaping results. More...
 
virtual void appendTerminator (unsigned int newSize, const TextLayouter::IntermediateLayout *terminator, unsigned int terminatorPosition) override
 Updates the internal shaper structures to accommodate a terminator string, which replaces a part of the original text. More...
 
void cleanup () override
 Cleans up the data that this text shaper used for shaping a specific text run. More...
 
void insertText (unsigned int location, const TextLayouter::IntermediateLayout *text) override
 Updates the internal shaper structures to accommodate another string, which Kanzi inserts in the original text. More...
 
 ItypeTextShaper (const FontRuntime &font)
 Constructor. More...
 
 ItypeTextShaper (const FontRuntime &font, ItypeThaiDictionarySharedPtr thaiDictionary)
 Constructor that constructs the shaper object to use with the Thai dictionary. More...
 
vector< TextLayouter::CharacterInfomarkBidiAndShape (const vector< char32_t > &unicodeText) override
 Use this function to: More...
 
void removeText (unsigned int location, unsigned int length) override
 TextShaper::removeText() implementation. More...
 
virtual void reorderLine (TextLayouter::IntermediateLayout *layout, const TextLayouter::LineInfo &line) override
 Reorders the text line for text written right-to-left. More...
 
virtual ~ItypeTextShaper ()
 Destructor. More...
 
- Public Member Functions inherited from kanzi::TextShaper
uint8_t getBaseBiDiLevel () const
 Gets the base bidi-level of the text. More...
 
virtual void prepareLines (TextLayouter::IntermediateLayout *layout)
 Prepares the internal data structures after line breaking. More...
 
void setBaseBiDiLevel (uint8_t baseBiDiLevel)
 Sets the base bidi-level of the text. More...
 
 TextShaper (const FontRuntime &font)
 Constructor. More...
 
virtual ~TextShaper ()
 Destructor. More...
 

Additional Inherited Members

- Protected Member Functions inherited from kanzi::TextShaper
FontFilegetFontFile (const FontRuntime &font) const
 Gets the font file that the passed font is currently using. More...
 
- Protected Attributes inherited from kanzi::TextShaper
uint8_t m_baseBiDiLevel
 The base bidi-level. More...
 
const FontRuntimem_font
 Font object used for shaping. More...
 

Detailed Description

TextShaper implementation using Monotype's WTShaper library.

Constructor & Destructor Documentation

◆ ItypeTextShaper() [1/2]

kanzi::ItypeTextShaper::ItypeTextShaper ( const FontRuntime font)
explicit

Constructor.

Parameters
fontFont object used for shaping.

◆ ItypeTextShaper() [2/2]

kanzi::ItypeTextShaper::ItypeTextShaper ( const FontRuntime font,
ItypeThaiDictionarySharedPtr  thaiDictionary 
)
explicit

Constructor that constructs the shaper object to use with the Thai dictionary.

Parameters
fontFont object to use for shaping.
thaiDictionaryThai dictionary object.
Since
Kanzi 3.9.4

◆ ~ItypeTextShaper()

virtual kanzi::ItypeTextShaper::~ItypeTextShaper ( )
virtual

Destructor.

Member Function Documentation

◆ markBidiAndShape()

vector<TextLayouter::CharacterInfo> kanzi::ItypeTextShaper::markBidiAndShape ( const vector< char32_t > &  unicodeText)
overridevirtual

Use this function to:

  • Create tags to indicate which parts of the text must be written left-to-right and which right-to-left.
  • Mirror specific character for the text written right-to-left.
  • Shape text.
    Parameters
    unicodeTextText to shape and mirror.
    Returns
    Layouting information for each character.

Reimplemented from kanzi::TextShaper.

◆ appendTerminator()

virtual void kanzi::ItypeTextShaper::appendTerminator ( unsigned int  newSize,
const TextLayouter::IntermediateLayout terminator,
unsigned int  terminatorPosition 
)
overridevirtual

Updates the internal shaper structures to accommodate a terminator string, which replaces a part of the original text.

Parameters
newSizeSize of the text including the terminator.
terminatorPointer to the intermediate layout containing the terminator.
terminatorPositionThe position in the text buffer at which the terminator would be appended. This is needed for RTL text. For LTR text, the terminator position is always at the right-end of the text.

Reimplemented from kanzi::TextShaper.

◆ insertText()

void kanzi::ItypeTextShaper::insertText ( unsigned int  location,
const TextLayouter::IntermediateLayout text 
)
overridevirtual

Updates the internal shaper structures to accommodate another string, which Kanzi inserts in the original text.

For example, a hyphen.

Parameters
locationPosition where the string is inserted.
textPointer to the intermediate layout containing the text.

Reimplemented from kanzi::TextShaper.

◆ removeText()

void kanzi::ItypeTextShaper::removeText ( unsigned int  location,
unsigned int  length 
)
overridevirtual

TextShaper::removeText() implementation.

Since
Kanzi 3.9.6

Reimplemented from kanzi::TextShaper.

◆ reorderLine()

virtual void kanzi::ItypeTextShaper::reorderLine ( TextLayouter::IntermediateLayout layout,
const TextLayouter::LineInfo line 
)
overridevirtual

Reorders the text line for text written right-to-left.

Parameters
layoutPointer to the intermediate layout containing the text.
lineInformation defining the currently processed line.

Reimplemented from kanzi::TextShaper.

◆ adjustPositions()

virtual void kanzi::ItypeTextShaper::adjustPositions ( TextLayouter::IntermediateLayout layout,
const TextLayouter::LineInfo line 
) const
overridevirtual

Iterates all layouted glyphs on the line and adjusts their positions based on the shaping results.

Parameters
layoutPointer to intermediate layout containing the text.
lineInformation defining the currently processed line.

Reimplemented from kanzi::TextShaper.

◆ cleanup()

void kanzi::ItypeTextShaper::cleanup ( )
overridevirtual

Cleans up the data that this text shaper used for shaping a specific text run.

You must call this function at the end of every text shaping run.

Reimplemented from kanzi::TextShaper.


The documentation for this class was generated from the following file: