class
TextGeometry::Line
Represents a single line as a set of words.
Public
Methods
GetWidth
Returns width of the line in pixels.
GetHeight
Returns height of the line in pixels.
GetYOffset
Returns an offset used to separate two lines.
CalculateWidthWithChararacter
Calculates new width of the line if we were to add the provided character, without actually adding it.
- characterInformation
- Character description from the font.
Returns: Width of the line in pixels with the character appended to it.
FillBuffer
Fills the vertex/uv/index buffers for the specified page, with all the character data needed for rendering.
- page
- The page.
- outVertices
- Pre-allocated array where character vertices will be written.
- outUVs
- Pre-allocated array where character uv coordinates will be written.
- outIndices
- Pre-allocated array where character indices will be written.
- offset
- Offsets the location at which the method writes to the buffers. Counted as number of quads.
- size
- Total number of quads that can fit into the specified buffers.
Returns: Number of quads that were written.
IsAtWordBoundary
Checks are we at a word boundary (meaning the next added character will start a new word).
GetCharacterCount
Returns the total number of characters on this line.
HasNewlineChar
Query if this line was created explicitly due to a newline character.
As opposed to a line that was created because a word couldn't fit on the previous line.
Private
Methods
Add
Appends a new character to the line.
- characterIndex
- Sequential index of the character in the original string.
- characterInformation
- Character description from the font.
AddSpace
Appends a space to the line.
AddWord
Adds a new word to the line.
- wordIndex
- Sequential index of the word in the original string. Spaces are counted as words as well.
- word
- Description of the word.
Initialize
Initializes the line.
Must be called after construction.
Finalize
Finalizes the line.
Do not add new characters/words after a line has been finalized.
- hasNewlineChar
- Set to true if line was create due to an explicit newline char. As opposed to a line that was created because a word couldn't fit on the previous line.
IsEmpty
Returns true if the line contains no words.
RemoveLastWord
Removes last word from the line and returns its sequential index.
CalculateBounds
Calculates the line width and height in pixels.