Open CASCADE Technology  7.1.0.beta
Public Member Functions

Font_TextFormatter Class Reference

This class intended to prepare formatted text. More...

#include <Font_TextFormatter.hxx>

Public Member Functions

 Font_TextFormatter ()
 Default constructor. More...
 
void SetupAlignment (const Graphic3d_HorizontalTextAlignment theAlignX, const Graphic3d_VerticalTextAlignment theAlignY)
 Setup alignment style. More...
 
void Reset ()
 Reset current progress. More...
 
void Append (const NCollection_String &theString, Font_FTFont &theFont)
 Render specified text to inner buffer. More...
 
void Format ()
 Perform formatting on the buffered text. Should not be called more than once after initialization! More...
 
const NCollection_Vec2< Standard_ShortReal > & TopLeft (const Standard_Integer theIndex) const
 Returns specific glyph rectangle. More...
 
const NCollection_StringString () const
 Returns current rendering string. More...
 
Standard_Integer TabSize () const
 Returns tab size. More...
 
Standard_ShortReal ResultWidth () const
 
Standard_ShortReal ResultHeight () const
 
void BndBox (Font_Rect &theBndBox) const
 

Protected Member Functions

class auxiliary methods
void newLine (const Standard_Integer theLastRect)
 Move glyphs on the current line to correct position. More...
 

Protected Attributes

configuration
Graphic3d_HorizontalTextAlignment myAlignX
 horizontal alignment style More...
 
Graphic3d_VerticalTextAlignment myAlignY
 vertical alignment style More...
 
Standard_Integer myTabSize
 horizontal tabulation width (number of space symbols) More...
 
input data
NCollection_String myString
 currently rendered text More...
 
NCollection_Vec2< Standard_ShortRealmyPen
 current pen position More...
 
NCollection_Vector< NCollection_Vec2< Standard_ShortReal > > myCorners
 The top left corners of a formatted rectangles. More...
 
Standard_Integer myRectsNb
 rectangles number More...
 
NCollection_Vector< Standard_ShortRealmyNewLines
 position at LF More...
 
Standard_ShortReal myLineSpacing
 line spacing (computed as maximum of all fonts involved in text formatting) More...
 
Standard_ShortReal myAscender
 currently rendered text More...
 
bool myIsFormatted
 formatting state More...
 
temporary variables for formatting routines
Standard_Integer myLinesNb
 overall (new)lines number (including splitting by width limit) More...
 
Standard_Integer myRectLineStart
 id of first rectangle on the current line More...
 
Standard_Integer myRectWordStart
 id of first rectangle in the current word More...
 
Standard_Integer myNewLineNb
 overall (new)lines number (including splitting by width limit) More...
 
Standard_ShortReal myPenCurrLine
 current baseline position More...
 
Standard_ShortReal myBndTop
 overall (new)lines number (including splitting by width limit) More...
 
Standard_ShortReal myBndWidth
 overall (new)lines number (including splitting by width limit) More...
 
NCollection_Vec2< Standard_ShortRealmyMoveVec
 local variable More...
 

Detailed Description

This class intended to prepare formatted text.

Constructor & Destructor Documentation

Font_TextFormatter::Font_TextFormatter ( )

Default constructor.

Member Function Documentation

void Font_TextFormatter::Append ( const NCollection_String theString,
Font_FTFont theFont 
)

Render specified text to inner buffer.

void Font_TextFormatter::BndBox ( Font_Rect theBndBox) const
inline
Parameters
boundingbox.
void Font_TextFormatter::Format ( )

Perform formatting on the buffered text. Should not be called more than once after initialization!

void Font_TextFormatter::newLine ( const Standard_Integer  theLastRect)
protected

Move glyphs on the current line to correct position.

void Font_TextFormatter::Reset ( )

Reset current progress.

Standard_ShortReal Font_TextFormatter::ResultHeight ( ) const
inline
Returns
height of formatted text.
Standard_ShortReal Font_TextFormatter::ResultWidth ( ) const
inline
Returns
width of formatted text.
void Font_TextFormatter::SetupAlignment ( const Graphic3d_HorizontalTextAlignment  theAlignX,
const Graphic3d_VerticalTextAlignment  theAlignY 
)

Setup alignment style.

const NCollection_String& Font_TextFormatter::String ( ) const
inline

Returns current rendering string.

Standard_Integer Font_TextFormatter::TabSize ( ) const
inline

Returns tab size.

const NCollection_Vec2<Standard_ShortReal>& Font_TextFormatter::TopLeft ( const Standard_Integer  theIndex) const
inline

Returns specific glyph rectangle.

Field Documentation

Graphic3d_HorizontalTextAlignment Font_TextFormatter::myAlignX
protected

horizontal alignment style

Graphic3d_VerticalTextAlignment Font_TextFormatter::myAlignY
protected

vertical alignment style

Standard_ShortReal Font_TextFormatter::myAscender
protected

currently rendered text

Standard_ShortReal Font_TextFormatter::myBndTop
protected

overall (new)lines number (including splitting by width limit)

Standard_ShortReal Font_TextFormatter::myBndWidth
protected

overall (new)lines number (including splitting by width limit)

NCollection_Vector< NCollection_Vec2<Standard_ShortReal> > Font_TextFormatter::myCorners
protected

The top left corners of a formatted rectangles.

bool Font_TextFormatter::myIsFormatted
protected

formatting state

Standard_Integer Font_TextFormatter::myLinesNb
protected

overall (new)lines number (including splitting by width limit)

Standard_ShortReal Font_TextFormatter::myLineSpacing
protected

line spacing (computed as maximum of all fonts involved in text formatting)

NCollection_Vec2<Standard_ShortReal> Font_TextFormatter::myMoveVec
protected

local variable

Standard_Integer Font_TextFormatter::myNewLineNb
protected

overall (new)lines number (including splitting by width limit)

NCollection_Vector<Standard_ShortReal> Font_TextFormatter::myNewLines
protected

position at LF

NCollection_Vec2<Standard_ShortReal> Font_TextFormatter::myPen
protected

current pen position

Standard_ShortReal Font_TextFormatter::myPenCurrLine
protected

current baseline position

Standard_Integer Font_TextFormatter::myRectLineStart
protected

id of first rectangle on the current line

Standard_Integer Font_TextFormatter::myRectsNb
protected

rectangles number

Standard_Integer Font_TextFormatter::myRectWordStart
protected

id of first rectangle in the current word

NCollection_String Font_TextFormatter::myString
protected

currently rendered text

Standard_Integer Font_TextFormatter::myTabSize
protected

horizontal tabulation width (number of space symbols)


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