mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
0026361: Visualization - move OpenGl_TextFormatter to Font_TextFormatter
for usage without OpenGL. Split OpenGl_TextFormatter into Font_TextFormatter and OpenGl_TextBuilder. Font_TextFormatter can format a text independetly of OpenGl now. OpenGl_TextBuilder generates primitive array required for rendering text using OpenGl_Font instance.
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
|
||||
#include <Font_FTFont.hxx>
|
||||
#include <Font_FontMgr.hxx>
|
||||
#include <Font_TextFormatter.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
@@ -255,3 +257,25 @@ float Font_FTFont::AdvanceY (const Standard_Utf32Char theUCharNext)
|
||||
}
|
||||
return fromFTPoints<float> (myKernAdvance.y + myFTFace->glyph->advance.y);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : BoundingBox
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Font_FTFont::Rect Font_FTFont::BoundingBox (const NCollection_String& theString,
|
||||
const Graphic3d_HorizontalTextAlignment theAlignX,
|
||||
const Graphic3d_VerticalTextAlignment theAlignY)
|
||||
{
|
||||
Font_TextFormatter aFormatter;
|
||||
aFormatter.SetupAlignment (theAlignX, theAlignY);
|
||||
aFormatter.Reset();
|
||||
|
||||
aFormatter.Append (theString, *this);
|
||||
aFormatter.Format();
|
||||
|
||||
Rect aBndBox;
|
||||
|
||||
aFormatter.BndBox (aBndBox);
|
||||
|
||||
return aBndBox;
|
||||
}
|
||||
|
Reference in New Issue
Block a user