Open CASCADE Technology  6.9.0
Public Member Functions

OpenGl_TextFormatter Class Reference

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

#include <OpenGl_TextFormatter.hxx>

Inheritance diagram for OpenGl_TextFormatter:
Inheritance graph
[legend]

Public Member Functions

 OpenGl_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 Handle< OpenGl_Context > &theCtx, const NCollection_String &theString, OpenGl_Font &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...
 
void Result (NCollection_Vector< GLuint > &theTextures, NCollection_Vector< NCollection_Handle< NCollection_Vector< OpenGl_Vec2 > > > &theVertsPerTexture, NCollection_Vector< NCollection_Handle< NCollection_Vector< OpenGl_Vec2 > > > &theTCrdsPerTexture) const
 Retrieve formatting results. More...
 
void Result (const Handle< OpenGl_Context > &theCtx, NCollection_Vector< GLuint > &theTextures, NCollection_Vector< Handle< OpenGl_VertexBuffer >> &theVertsPerTexture, NCollection_Vector< Handle< OpenGl_VertexBuffer >> &theTCrdsPerTexture) const
 Retrieve formatting results. More...
 
Standard_ShortReal ResultWidth () const
 
Standard_ShortReal ResultHeight () const
 
void BndBox (Font_FTFont::Rect &theBndBox) const
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor. More...
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing. More...
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter. More...
 
virtual ~Standard_Transient ()
 Destructor must be virtual. More...
 
virtual void Delete () const
 Memory deallocator for transient classes. More...
 
virtual const
Handle_Standard_Type & 
DynamicType () const
 Returns a type information object about this object. More...
 
Standard_Boolean IsInstance (const Handle_Standard_Type &theType) const
 Returns a true value if this is an instance of Type. More...
 
Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName. More...
 
Standard_Boolean IsKind (const Handle_Standard_Type &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More...
 
Standard_Boolean IsKind (const Standard_CString theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More...
 
virtual Handle_Standard_Transient This () const
 Returns a Handle which references this object. Must never be called to objects created in stack. More...
 
Standard_Integer GetRefCount () const
 Get the reference counter of this object. More...
 

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...
 
OpenGl_Vec2 myPen
 current pen position More...
 
NCollection_Vector
< OpenGl_Font::Tile
myRects
 glyphs rectangles More...
 
Standard_Integer myRectsNb
 rectangles number More...
 
NCollection_Vector
< Standard_ShortReal
myNewLines
 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...
 
OpenGl_VertexBufferEditor
< OpenGl_Vec2
myVboEditor
 currently rendered text 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 myLineLeft
 left x position of first glyph on line before formatting applied More...
 
Standard_ShortReal myLineTail
 overall (new)lines number (including splitting by width limit) 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...
 
OpenGl_Vec2 myMoveVec
 local variable More...
 

Detailed Description

This class intended to prepare formatted text.

Constructor & Destructor Documentation

OpenGl_TextFormatter::OpenGl_TextFormatter ( )

Default constructor.

Member Function Documentation

void OpenGl_TextFormatter::Append ( const Handle< OpenGl_Context > &  theCtx,
const NCollection_String theString,
OpenGl_Font theFont 
)

Render specified text to inner buffer.

void OpenGl_TextFormatter::BndBox ( Font_FTFont::Rect theBndBox) const
inline
Parameters
boundingbox.
void OpenGl_TextFormatter::Format ( )

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

void OpenGl_TextFormatter::newLine ( const Standard_Integer  theLastRect)
protected

Move glyphs on the current line to correct position.

void OpenGl_TextFormatter::Reset ( )

Reset current progress.

void OpenGl_TextFormatter::Result ( NCollection_Vector< GLuint > &  theTextures,
NCollection_Vector< NCollection_Handle< NCollection_Vector< OpenGl_Vec2 > > > &  theVertsPerTexture,
NCollection_Vector< NCollection_Handle< NCollection_Vector< OpenGl_Vec2 > > > &  theTCrdsPerTexture 
) const

Retrieve formatting results.

void OpenGl_TextFormatter::Result ( const Handle< OpenGl_Context > &  theCtx,
NCollection_Vector< GLuint > &  theTextures,
NCollection_Vector< Handle< OpenGl_VertexBuffer >> &  theVertsPerTexture,
NCollection_Vector< Handle< OpenGl_VertexBuffer >> &  theTCrdsPerTexture 
) const

Retrieve formatting results.

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

Setup alignment style.

Field Documentation

Graphic3d_HorizontalTextAlignment OpenGl_TextFormatter::myAlignX
protected

horizontal alignment style

Graphic3d_VerticalTextAlignment OpenGl_TextFormatter::myAlignY
protected

vertical alignment style

Standard_ShortReal OpenGl_TextFormatter::myAscender
protected

currently rendered text

Standard_ShortReal OpenGl_TextFormatter::myBndTop
protected

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

Standard_ShortReal OpenGl_TextFormatter::myBndWidth
protected

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

bool OpenGl_TextFormatter::myIsFormatted
protected

formatting state

Standard_ShortReal OpenGl_TextFormatter::myLineLeft
protected

left x position of first glyph on line before formatting applied

Standard_Integer OpenGl_TextFormatter::myLinesNb
protected

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

Standard_ShortReal OpenGl_TextFormatter::myLineSpacing
protected

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

Standard_ShortReal OpenGl_TextFormatter::myLineTail
protected

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

OpenGl_Vec2 OpenGl_TextFormatter::myMoveVec
protected

local variable

Standard_Integer OpenGl_TextFormatter::myNewLineNb
protected

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

NCollection_Vector<Standard_ShortReal> OpenGl_TextFormatter::myNewLines
protected

position at LF

OpenGl_Vec2 OpenGl_TextFormatter::myPen
protected

current pen position

Standard_ShortReal OpenGl_TextFormatter::myPenCurrLine
protected

current baseline position

Standard_Integer OpenGl_TextFormatter::myRectLineStart
protected

id of first rectangle on the current line

NCollection_Vector<OpenGl_Font::Tile> OpenGl_TextFormatter::myRects
protected

glyphs rectangles

Standard_Integer OpenGl_TextFormatter::myRectsNb
protected

rectangles number

Standard_Integer OpenGl_TextFormatter::myRectWordStart
protected

id of first rectangle in the current word

NCollection_String OpenGl_TextFormatter::myString
protected

currently rendered text

Standard_Integer OpenGl_TextFormatter::myTabSize
protected

horizontal tabulation width (number of space symbols)

OpenGl_VertexBufferEditor<OpenGl_Vec2> OpenGl_TextFormatter::myVboEditor
mutableprotected

currently rendered text


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