GG
Public Types | Public Member Functions | Public Attributes | List of all members
GG::Font::TextElement Struct Reference

#include <Font.h>

Inheritance diagram for GG::Font::TextElement:
GG::Font::FormattingTag

Public Types

enum  TextElementType {
  OPEN_TAG,
  CLOSE_TAG,
  TEXT,
  WHITESPACE,
  NEWLINE
}
 

Public Member Functions

 TextElement (bool ws, bool nl)
 
virtual ~TextElement ()
 
virtual TextElementType Type () const
 
X Width () const
 
CPSize CodePointSize () const
 

Public Attributes

Substring text
 
std::vector< Xwidths
 
const bool whitespace
 
const bool newline
 

Detailed Description

Used to encapsulate a token-like piece of text to be rendered using GG::Font.

Definition at line 180 of file Font.h.

Member Enumeration Documentation

The types of token-like entities that can be represented by a TextElement.

Enumerator
OPEN_TAG 

An opening text formatting tag (e.g. "<rgba 0 0 0 255>").

CLOSE_TAG 

A closing text formatting tag (e.g. "</rgba>").

TEXT 

Some non-whitespace text (e.g. "The").

WHITESPACE 

Some whitespace text (e.g. " \n").

NEWLINE 

A newline. Newline TextElements represent the newline code point when it is encountered in a rendered string, though they do not contain the actual newline character – their text members are always "").

Definition at line 184 of file Font.h.

Constructor & Destructor Documentation

GG::Font::TextElement::TextElement ( bool  ws,
bool  nl 
)

Ctor. ws indicates that the element contains only whitespace; nl indicates that it is a newline element.

Member Function Documentation

virtual TextElementType GG::Font::TextElement::Type ( ) const
virtual

Returns the TextElementType of the element.

Reimplemented in GG::Font::FormattingTag.

X GG::Font::TextElement::Width ( ) const

Returns the width of the element.

CPSize GG::Font::TextElement::CodePointSize ( ) const

Returns the number of code points in the original string that the element represents.

Member Data Documentation

Substring GG::Font::TextElement::text

The text from the original string represented by the element.

Definition at line 218 of file Font.h.


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