CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::TextLayoutManager Class Reference

An object that coordinates the layout and display of text characters. More...

#include <CeresEngine/Text/TextLayoutManager.hpp>

Public Member Functions

const TextStoragegetTextStorage () const
 The text storage object containing the content to be laid out.
 
void setTextStorage (const TextStorage &textStorage)
 The text storage object containing the content to be laid out.
 
const Vector< TextContainer > & getTextContainers () const
 The current text containers of the layout manager.
 
void setTextContainers (const Vector< TextContainer > &containers)
 The current text containers of the layout manager.
 
void setTextContainer (const TextContainer &container)
 Defines a new single text container on the layout manager.
 
void addTextContainer (const TextContainer &aTextContainer)
 Appends the given text container to the series of text containers where the layout manager arranges.
 
void insertTextContainer (const TextContainer &aTextContainer, UInt32 index)
 Inserts a text container at the specified index in the list of text containers.
 
void removeTextContainer (UInt32 index)
 Removes the text container at the specified index and invalidates the layout as needed.
 
const TextContainergetTextContainerForGlyph (UInt32 glyphIndex)
 Returns the text container that manages the layout for the specified glyph, causing layout to happen as needed.
 
bool getShowsInvisibleCharacters () const
 A Boolean value that indicates whether to substitute visible glyphs for white space and other typically invisible characters.
 
void setShowsInvisibleCharacters (const bool showsInvisibleCharacters)
 A Boolean value that indicates whether to substitute visible glyphs for white space and other typically invisible characters.
 
bool getShowsControlCharacters () const
 A Boolean value indicating whether the layout manager substitutes visible glyphs for control characters in layout.
 
void setShowsControlCharacters (const bool showsControlCharacters)
 A Boolean value indicating whether the layout manager substitutes visible glyphs for control characters in layout.
 
bool getUsesFontLeading () const
 A Boolean value indicating whether the layout manager uses the leading provided in the font.
 
void setUsesFontLeading (const bool usesFontLeading)
 A Boolean value indicating whether the layout manager uses the leading provided in the font.
 
bool getUsesDefaultHyphenation () const
 A Boolean value indicating whether the layout manager uses the default hyphenation rules to wrap lines.
 
void setUsesDefaultHyphenation (const bool usesDefaultHyphenation)
 A Boolean value indicating whether the layout manager uses the default hyphenation rules to wrap lines.
 
bool getNeedsLayout () const
 A Boolean value indicating whether the text needs a layout pass before it can be drawn.
 
void setNeedsLayout ()
 A Boolean value indicating whether the text needs a layout pass before it can be drawn.
 
void setNeedsLayout (bool state)
 A Boolean value indicating whether the text needs a layout pass before it can be drawn.
 
void layout ()
 Perform text layout.
 
void layoutIfNeeded ()
 Perform text layout if needed.
 
const Vector< TextLayout > & getLayout () const
 Get the final text layout as it should be rendered.
 
SPtr< TexturecreateTexture ()
 

Private Attributes

TextStorage mStorage
 The text storage object containing the content to be laid out.
 
Vector< TextContainermContainers
 The current text containers of the layout manager.
 
Vector< TextLayoutmLayouts
 A vector of already layout text.
 
TextLayoutManagerStateFlags mFlags
 The layout manager state flags.
 

Detailed Description

An object that coordinates the layout and display of text characters.

TextLayoutManager maps Unicode character codes to glyphs, sets the glyphs in a series of TextContainer objects, and displays them in a series of GUITextView objects. In addition to its core function of laying out text, a layout manager object coordinates its text view objects, and handles the layout and display of text attributes not inherent in glyphs (such as underline or strikethrough). You can create a subclass of TextLayoutManager to handle additional text attributes, whether inherent or not.

Antialiasing

TextLayoutManager provides the threshold for text antialiasing. If the font size is smaller than or equal to this threshold size, the text is rendered aliased by TextLayoutManager.

Safety of <tt>TextLayoutManager</tt>

Generally speaking, a given layout manager (and associated objects) should not be used in more than one block, operation, or thread at a time. Most layout managers are used on the main thread, since it is the main thread on which their text views are displayed, and since background layout occurs on the main thread.

If you want to use a layout manager on a background thread, first make sure that text views associated with that layout manager (if any) are not displayed while the layout manager is being used on the background thread, and, second, turn off background layout for that layout manager while it is being used on the background thread. The most effective way to ensure that no text view is displayed, without knowing deep implementation, is just not to connect a text view to the layout manager.

Member Function Documentation

◆ addTextContainer()

void CeresEngine::TextLayoutManager::addTextContainer ( const TextContainer aTextContainer)

Appends the given text container to the series of text containers where the layout manager arranges.

Invalidates glyphs and layout as needed, but doesn't perform glyph generation or layout.

Parameters
aTextContainerThe text container to append.

◆ createTexture()

SPtr< Texture > CeresEngine::TextLayoutManager::createTexture ( )

◆ getLayout()

const Vector< TextLayout > & CeresEngine::TextLayoutManager::getLayout ( ) const
inline

Get the final text layout as it should be rendered.

◆ getNeedsLayout()

bool CeresEngine::TextLayoutManager::getNeedsLayout ( ) const

A Boolean value indicating whether the text needs a layout pass before it can be drawn.

Returns
true if the text needs a layout pass, false otherwise.

◆ getShowsControlCharacters()

bool CeresEngine::TextLayoutManager::getShowsControlCharacters ( ) const
inline

A Boolean value indicating whether the layout manager substitutes visible glyphs for control characters in layout.

◆ getShowsInvisibleCharacters()

bool CeresEngine::TextLayoutManager::getShowsInvisibleCharacters ( ) const
inline

A Boolean value that indicates whether to substitute visible glyphs for white space and other typically invisible characters.

◆ getTextContainerForGlyph()

const TextContainer * CeresEngine::TextLayoutManager::getTextContainerForGlyph ( UInt32  glyphIndex)

Returns the text container that manages the layout for the specified glyph, causing layout to happen as needed.

This method causes glyph generation and layout for the line fragment containing the specified glyph.

Parameters
glyphIndexIndex of a glyph in the returned container.
Returns
The text container in which the glyph at glyphIndex is laid out.

◆ getTextContainers()

const Vector< TextContainer > & CeresEngine::TextLayoutManager::getTextContainers ( ) const
inline

The current text containers of the layout manager.

◆ getTextStorage()

const TextStorage & CeresEngine::TextLayoutManager::getTextStorage ( ) const
inline

The text storage object containing the content to be laid out.

◆ getUsesDefaultHyphenation()

bool CeresEngine::TextLayoutManager::getUsesDefaultHyphenation ( ) const
inline

A Boolean value indicating whether the layout manager uses the default hyphenation rules to wrap lines.

◆ getUsesFontLeading()

bool CeresEngine::TextLayoutManager::getUsesFontLeading ( ) const
inline

A Boolean value indicating whether the layout manager uses the leading provided in the font.

◆ insertTextContainer()

void CeresEngine::TextLayoutManager::insertTextContainer ( const TextContainer aTextContainer,
UInt32  index 
)

Inserts a text container at the specified index in the list of text containers.

This method invalidates layout for all subsequent TextContainer objects, and invalidates glyph information as needed.

Parameters
aTextContainerThe text container to insert.
indexThe index in the series of text containers at which to insert aTextContainer.

◆ layout()

void CeresEngine::TextLayoutManager::layout ( )

Perform text layout.

◆ layoutIfNeeded()

void CeresEngine::TextLayoutManager::layoutIfNeeded ( )

Perform text layout if needed.

◆ removeTextContainer()

void CeresEngine::TextLayoutManager::removeTextContainer ( UInt32  index)

Removes the text container at the specified index and invalidates the layout as needed.

This method invalidates glyph information as needed.

Parameters
indexThe index of the text container to remove.

◆ setNeedsLayout() [1/2]

void CeresEngine::TextLayoutManager::setNeedsLayout ( )

A Boolean value indicating whether the text needs a layout pass before it can be drawn.

Returns
true if the text needs a layout pass, false otherwise.

◆ setNeedsLayout() [2/2]

void CeresEngine::TextLayoutManager::setNeedsLayout ( bool  state)

A Boolean value indicating whether the text needs a layout pass before it can be drawn.

Returns
true if the text needs a layout pass, false otherwise.

◆ setShowsControlCharacters()

void CeresEngine::TextLayoutManager::setShowsControlCharacters ( const bool  showsControlCharacters)
inline

A Boolean value indicating whether the layout manager substitutes visible glyphs for control characters in layout.

◆ setShowsInvisibleCharacters()

void CeresEngine::TextLayoutManager::setShowsInvisibleCharacters ( const bool  showsInvisibleCharacters)
inline

A Boolean value that indicates whether to substitute visible glyphs for white space and other typically invisible characters.

◆ setTextContainer()

void CeresEngine::TextLayoutManager::setTextContainer ( const TextContainer container)

Defines a new single text container on the layout manager.

◆ setTextContainers()

void CeresEngine::TextLayoutManager::setTextContainers ( const Vector< TextContainer > &  containers)

The current text containers of the layout manager.

◆ setTextStorage()

void CeresEngine::TextLayoutManager::setTextStorage ( const TextStorage textStorage)

The text storage object containing the content to be laid out.

◆ setUsesDefaultHyphenation()

void CeresEngine::TextLayoutManager::setUsesDefaultHyphenation ( const bool  usesDefaultHyphenation)
inline

A Boolean value indicating whether the layout manager uses the default hyphenation rules to wrap lines.

◆ setUsesFontLeading()

void CeresEngine::TextLayoutManager::setUsesFontLeading ( const bool  usesFontLeading)
inline

A Boolean value indicating whether the layout manager uses the leading provided in the font.

Member Data Documentation

◆ mContainers

Vector<TextContainer> CeresEngine::TextLayoutManager::mContainers
private

The current text containers of the layout manager.

◆ mFlags

TextLayoutManagerStateFlags CeresEngine::TextLayoutManager::mFlags
private

The layout manager state flags.

◆ mLayouts

Vector<TextLayout> CeresEngine::TextLayoutManager::mLayouts
private

A vector of already layout text.

◆ mStorage

TextStorage CeresEngine::TextLayoutManager::mStorage
private

The text storage object containing the content to be laid out.


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