Open CASCADE Technology  7.2.0
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::Font_TextFormatter ( )

Default constructor.

Member Function Documentation

◆ Append()

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

Render specified text to inner buffer.

◆ BndBox()

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

◆ Format()

void Font_TextFormatter::Format ( )

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

◆ newLine()

void Font_TextFormatter::newLine ( const Standard_Integer  theLastRect)
protected

Move glyphs on the current line to correct position.

◆ Reset()

void Font_TextFormatter::Reset ( )

Reset current progress.

◆ ResultHeight()

Standard_ShortReal Font_TextFormatter::ResultHeight ( ) const
inline
Returns
height of formatted text.

◆ ResultWidth()

Standard_ShortReal Font_TextFormatter::ResultWidth ( ) const
inline
Returns
width of formatted text.

◆ SetupAlignment()

void Font_TextFormatter::SetupAlignment ( const Graphic3d_HorizontalTextAlignment  theAlignX,
const Graphic3d_VerticalTextAlignment  theAlignY 
)

Setup alignment style.

◆ String()

const NCollection_String& Font_TextFormatter::String ( ) const
inline

Returns current rendering string.

◆ TabSize()

Standard_Integer Font_TextFormatter::TabSize ( ) const
inline

Returns tab size.

◆ TopLeft()

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

Returns specific glyph rectangle.

Field Documentation

◆ myAlignX

Graphic3d_HorizontalTextAlignment Font_TextFormatter::myAlignX
protected

horizontal alignment style

◆ myAlignY

Graphic3d_VerticalTextAlignment Font_TextFormatter::myAlignY
protected

vertical alignment style

◆ myAscender

Standard_ShortReal Font_TextFormatter::myAscender
protected

currently rendered text

◆ myBndTop

Standard_ShortReal Font_TextFormatter::myBndTop
protected

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

◆ myBndWidth

Standard_ShortReal Font_TextFormatter::myBndWidth
protected

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

◆ myCorners

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

The top left corners of a formatted rectangles.

◆ myIsFormatted

bool Font_TextFormatter::myIsFormatted
protected

formatting state

◆ myLinesNb

Standard_Integer Font_TextFormatter::myLinesNb
protected

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

◆ myLineSpacing

Standard_ShortReal Font_TextFormatter::myLineSpacing
protected

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

◆ myMoveVec

NCollection_Vec2<Standard_ShortReal> Font_TextFormatter::myMoveVec
protected

local variable

◆ myNewLineNb

Standard_Integer Font_TextFormatter::myNewLineNb
protected

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

◆ myNewLines

NCollection_Vector<Standard_ShortReal> Font_TextFormatter::myNewLines
protected

position at LF

◆ myPen

NCollection_Vec2<Standard_ShortReal> Font_TextFormatter::myPen
protected

current pen position

◆ myPenCurrLine

Standard_ShortReal Font_TextFormatter::myPenCurrLine
protected

current baseline position

◆ myRectLineStart

Standard_Integer Font_TextFormatter::myRectLineStart
protected

id of first rectangle on the current line

◆ myRectsNb

Standard_Integer Font_TextFormatter::myRectsNb
protected

rectangles number

◆ myRectWordStart

Standard_Integer Font_TextFormatter::myRectWordStart
protected

id of first rectangle in the current word

◆ myString

NCollection_String Font_TextFormatter::myString
protected

currently rendered text

◆ myTabSize

Standard_Integer Font_TextFormatter::myTabSize
protected

horizontal tabulation width (number of space symbols)


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