openshot-audio  0.1.7
Classes | Public Member Functions | List of all members
TextLayout Class Reference

#include <juce_TextLayout.h>

Classes

class  Glyph
 
class  Line
 
class  Run
 

Public Member Functions

 TextLayout ()
 
 TextLayout (const TextLayout &)
 
TextLayoutoperator= (const TextLayout &)
 
 ~TextLayout ()
 
void createLayout (const AttributedString &, float maxWidth)
 
void createLayout (const AttributedString &, float maxWidth, float maxHeight)
 
void createLayoutWithBalancedLineLengths (const AttributedString &, float maxWidth)
 
void createLayoutWithBalancedLineLengths (const AttributedString &, float maxWidth, float maxHeight)
 
void draw (Graphics &, const Rectangle< float > &area) const
 
float getWidth () const noexcept
 
float getHeight () const noexcept
 
int getNumLines () const noexcept
 
LinegetLine (int index) const
 
void addLine (Line *)
 
void ensureStorageAllocated (int numLinesNeeded)
 

Detailed Description

A Pre-formatted piece of text, which may contain multiple fonts and colours.

A TextLayout is created from an AttributedString, and once created can be quickly drawn into a Graphics context.

See also
AttributedString

Constructor & Destructor Documentation

◆ TextLayout() [1/2]

TextLayout::TextLayout ( )

Creates an empty layout. Having created a TextLayout, you can populate it using createLayout() or createLayoutWithBalancedLineLengths().

◆ TextLayout() [2/2]

TextLayout::TextLayout ( const TextLayout other)

◆ ~TextLayout()

TextLayout::~TextLayout ( )

Destructor.

Member Function Documentation

◆ addLine()

void TextLayout::addLine ( Line line)

Adds a line to the layout. The layout will take ownership of this line object and will delete it when it is no longer needed.

◆ createLayout() [1/2]

void TextLayout::createLayout ( const AttributedString text,
float  maxWidth 
)

Creates a layout from the given attributed string. This will replace any data that is currently stored in the layout.

◆ createLayout() [2/2]

void TextLayout::createLayout ( const AttributedString text,
float  maxWidth,
float  maxHeight 
)

Creates a layout from the given attributed string, given some size constraints. This will replace any data that is currently stored in the layout.

◆ createLayoutWithBalancedLineLengths() [1/2]

void TextLayout::createLayoutWithBalancedLineLengths ( const AttributedString text,
float  maxWidth 
)

Creates a layout, attempting to choose a width which results in lines of a similar length.

This will be slower than the normal createLayout method, but produces a tidier result.

◆ createLayoutWithBalancedLineLengths() [2/2]

void TextLayout::createLayoutWithBalancedLineLengths ( const AttributedString text,
float  maxWidth,
float  maxHeight 
)

Creates a layout, attempting to choose a width which results in lines of a similar length.

This will be slower than the normal createLayout method, but produces a tidier result.

◆ draw()

void TextLayout::draw ( Graphics g,
const Rectangle< float > &  area 
) const

Draws the layout within the specified area. The position of the text within the rectangle is controlled by the justification flags set in the original AttributedString that was used to create this layout.

◆ ensureStorageAllocated()

void TextLayout::ensureStorageAllocated ( int  numLinesNeeded)

Pre-allocates space for the specified number of lines.

◆ getHeight()

float TextLayout::getHeight ( ) const
inlinenoexcept

Returns the maximum height of the content.

◆ getLine()

TextLayout::Line & TextLayout::getLine ( int  index) const

Returns one of the lines.

◆ getNumLines()

int TextLayout::getNumLines ( ) const
inlinenoexcept

Returns the number of lines in the layout.

◆ getWidth()

float TextLayout::getWidth ( ) const
inlinenoexcept

Returns the maximum width of the content.

◆ operator=()

TextLayout & TextLayout::operator= ( const TextLayout other)

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