#include <lugre_ogrefonthelper.h>
Public Types | |
| enum | eAlignment { Align_Left, Align_Center, Align_Right } |
| aligning text for drawing, around 0 More... | |
| enum | { UNICODE_NEL = 0x0085, UNICODE_CR = 0x000D, UNICODE_LF = 0x000A, UNICODE_TAB = 0x0009, UNICODE_SPACE = 0x0020, UNICODE_ZERO = 0x0030 } |
| important control chars More... | |
| typedef Ogre::UTFString::unicode_char | unicode_char |
| typedef Ogre::UTFString::const_iterator | itor |
Public Member Functions | |
| cOgreFontHelper (Ogre::FontPtr mpFont, const float mfGlyphWidthFactor, const float mfCharHeight, const float mfSpaceWidth, const float mfWrapMaxW=0, eAlignment mAlign=Align_Left) | |
| float | GetCharWidth (unicode_char c) |
| float | CalcLineLen (itor i, const itor iEnd) |
| float | CalcWordLen (itor i, const itor iEnd) |
| can be used for autowrap | |
| bool | TestAutoWrap (itor i, const itor iEnd, const float x, const bool bKeepWords) |
| float | WriteChar_NoIndex (float *&pVert, unicode_char c, const float left, const float top, const float z) |
| void | GetTextBounds (const Ogre::UTFString &text, Ogre::Real &w, Ogre::Real &h) |
| void | GetGlyphBounds (const Ogre::UTFString &text, const int iCharIndex, Ogre::Real &l, Ogre::Real &t, Ogre::Real &r, Ogre::Real &b) |
| int | GetGlyphAtPos (const Ogre::UTFString &text, const float x, const float y) |
Static Public Member Functions | |
| static eAlignment | Alignment (Ogre::TextAreaOverlayElement::Alignment align) |
| translates alignment from TextAreaOverlayElement | |
| static eAlignment | Alignment (Ogre::GuiHorizontalAlignment align) |
| translates alignment from GuiHorizontalAlignment | |
| static bool | IsTab (unicode_char c) |
| static bool | IsSpace (unicode_char c) |
| static bool | IsNewLine (unicode_char c) |
| static bool | IsWhiteSpace (unicode_char c) |
| static bool | IsCRLF (unicode_char a, unicode_char b) |
| static bool | IsTab (itor i) |
| static bool | IsSpace (itor i) |
| static bool | IsNewLine (itor i) |
| static bool | IsWhiteSpace (itor i) |
| static void | WriteVertex (float *&pVert, const float x, const float y, const float z, const float u, const float v) |
Public Attributes | |
| Ogre::FontPtr | mpFont |
| eAlignment | mAlign |
| float | mfCharHeight |
| float | mfLineHeight |
| float | mfSpaceWidth |
| float | mfTabWidth |
| float | mfGlyphWidthFactor |
| float | mfWrapMaxW |
Classes | |
| class | cTextIterator |
| iterates over text and manages positioning (alignment and newlines) More... | |
Definition at line 37 of file lugre_ogrefonthelper.h.
| typedef Ogre::UTFString::unicode_char Lugre::cOgreFontHelper::unicode_char |
Definition at line 38 of file lugre_ogrefonthelper.h.
| typedef Ogre::UTFString::const_iterator Lugre::cOgreFontHelper::itor |
Definition at line 39 of file lugre_ogrefonthelper.h.
| anonymous enum |
| Lugre::cOgreFontHelper::cOgreFontHelper | ( | Ogre::FontPtr | mpFont, | |
| const float | mfGlyphWidthFactor, | |||
| const float | mfCharHeight, | |||
| const float | mfSpaceWidth, | |||
| const float | mfWrapMaxW = 0, |
|||
| eAlignment | mAlign = Align_Left | |||
| ) | [inline] |
mfGlyphWidthFactor is something like mCharHeight * 2.0 * mViewportAspectCoef for overlay elements mfCharHeight is the height of a character (same for all characters), may be negative depending on coordinate system
Definition at line 59 of file lugre_ogrefonthelper.h.
References mfTabWidth.
| static eAlignment Lugre::cOgreFontHelper::Alignment | ( | Ogre::TextAreaOverlayElement::Alignment | align | ) | [inline, static] |
translates alignment from TextAreaOverlayElement
Definition at line 67 of file lugre_ogrefonthelper.h.
References Align_Center, Align_Left, and Align_Right.
Referenced by Lugre::cColourClipTextOverlay::GetGlyphAtPos(), Lugre::cColourClipTextOverlay::GetGlyphBounds(), Lugre::cColourClipTextOverlay::GetTextBounds(), Lugre::cGfx3D::SetText(), and Lugre::cColourClipTextOverlay::updatePositionGeometry().
| static eAlignment Lugre::cOgreFontHelper::Alignment | ( | Ogre::GuiHorizontalAlignment | align | ) | [inline, static] |
translates alignment from GuiHorizontalAlignment
Definition at line 76 of file lugre_ogrefonthelper.h.
References Align_Center, Align_Left, and Align_Right.
| static bool Lugre::cOgreFontHelper::IsTab | ( | unicode_char | c | ) | [inline, static] |
Definition at line 94 of file lugre_ogrefonthelper.h.
References UNICODE_TAB.
Referenced by GetCharWidth(), IsTab(), and IsWhiteSpace().
| static bool Lugre::cOgreFontHelper::IsSpace | ( | unicode_char | c | ) | [inline, static] |
Definition at line 95 of file lugre_ogrefonthelper.h.
References UNICODE_SPACE.
Referenced by GetCharWidth(), IsSpace(), and IsWhiteSpace().
| static bool Lugre::cOgreFontHelper::IsNewLine | ( | unicode_char | c | ) | [inline, static] |
Definition at line 96 of file lugre_ogrefonthelper.h.
References UNICODE_CR, UNICODE_LF, and UNICODE_NEL.
Referenced by CalcLineLen(), GetCharWidth(), IsNewLine(), IsWhiteSpace(), and Lugre::cOgreFontHelper::cTextIterator::Next().
| static bool Lugre::cOgreFontHelper::IsWhiteSpace | ( | unicode_char | c | ) | [inline, static] |
Definition at line 97 of file lugre_ogrefonthelper.h.
References IsNewLine(), IsSpace(), and IsTab().
Referenced by CalcLineLen(), CalcWordLen(), IsWhiteSpace(), Lugre::cOgreFontHelper::cTextIterator::Next(), Lugre::cGfx3D::SetText(), TestAutoWrap(), and Lugre::cColourClipTextOverlay::updatePositionGeometry().
| static bool Lugre::cOgreFontHelper::IsCRLF | ( | unicode_char | a, | |
| unicode_char | b | |||
| ) | [inline, static] |
Definition at line 98 of file lugre_ogrefonthelper.h.
References UNICODE_CR, and UNICODE_LF.
Referenced by Lugre::cOgreFontHelper::cTextIterator::Next().
| static bool Lugre::cOgreFontHelper::IsTab | ( | itor | i | ) | [inline, static] |
| static bool Lugre::cOgreFontHelper::IsSpace | ( | itor | i | ) | [inline, static] |
| static bool Lugre::cOgreFontHelper::IsNewLine | ( | itor | i | ) | [inline, static] |
| static bool Lugre::cOgreFontHelper::IsWhiteSpace | ( | itor | i | ) | [inline, static] |
| float Lugre::cOgreFontHelper::GetCharWidth | ( | unicode_char | c | ) | [inline] |
Definition at line 107 of file lugre_ogrefonthelper.h.
References IsNewLine(), IsSpace(), IsTab(), mfGlyphWidthFactor, mfSpaceWidth, mfTabWidth, and mpFont.
Referenced by CalcLineLen(), CalcWordLen(), GetGlyphAtPos(), GetGlyphBounds(), GetTextBounds(), Lugre::cOgreFontHelper::cTextIterator::Next(), Lugre::cGfx3D::SetText(), TestAutoWrap(), and Lugre::cColourClipTextOverlay::updatePositionGeometry().
Definition at line 113 of file lugre_ogrefonthelper.h.
References GetCharWidth(), IsNewLine(), IsWhiteSpace(), mfWrapMaxW, and TestAutoWrap().
Referenced by Lugre::cOgreFontHelper::cTextIterator::StartLine().
can be used for autowrap
Definition at line 130 of file lugre_ogrefonthelper.h.
References GetCharWidth(), and IsWhiteSpace().
Referenced by TestAutoWrap().
| bool Lugre::cOgreFontHelper::TestAutoWrap | ( | itor | i, | |
| const itor | iEnd, | |||
| const float | x, | |||
| const bool | bKeepWords | |||
| ) | [inline] |
Definition at line 140 of file lugre_ogrefonthelper.h.
References CalcWordLen(), GetCharWidth(), IsWhiteSpace(), and mfWrapMaxW.
Referenced by CalcLineLen(), and Lugre::cOgreFontHelper::cTextIterator::Next().
| static void Lugre::cOgreFontHelper::WriteVertex | ( | float *& | pVert, | |
| const float | x, | |||
| const float | y, | |||
| const float | z, | |||
| const float | u, | |||
| const float | v | |||
| ) | [inline, static] |
| float Lugre::cOgreFontHelper::WriteChar_NoIndex | ( | float *& | pVert, | |
| unicode_char | c, | |||
| const float | left, | |||
| const float | top, | |||
| const float | z | |||
| ) | [inline] |
writes 6 vertices to the vertexbuffer, for use without index buffer each vert is (x, y, z, u, v) returns char width = mfGlyphWidthFactor * mpFont->getGlyphAspectRatio(c);
Definition at line 176 of file lugre_ogrefonthelper.h.
References mfCharHeight, mfGlyphWidthFactor, mpFont, and WriteVertex().
| void Lugre::cOgreFontHelper::GetTextBounds | ( | const Ogre::UTFString & | text, | |
| Ogre::Real & | w, | |||
| Ogre::Real & | h | |||
| ) | [inline] |
(e.g. centered text, buttons that automatically scale to fit their label ) returns result in w and h
Definition at line 285 of file lugre_ogrefonthelper.h.
References GetCharWidth(), Lugre::cOgreFontHelper::cTextIterator::HasNext(), mfLineHeight, Lugre::mymax(), Lugre::cOgreFontHelper::cTextIterator::Next(), Lugre::cOgreFontHelper::cTextIterator::x, and Lugre::cOgreFontHelper::cTextIterator::y.
Referenced by Lugre::cColourClipTextOverlay::GetTextBounds().
| void Lugre::cOgreFontHelper::GetGlyphBounds | ( | const Ogre::UTFString & | text, | |
| const int | iCharIndex, | |||
| Ogre::Real & | l, | |||
| Ogre::Real & | t, | |||
| Ogre::Real & | r, | |||
| Ogre::Real & | b | |||
| ) | [inline] |
(e.g. for custom selection effects, custom blinking caret) TODO : TEST ME !
Definition at line 298 of file lugre_ogrefonthelper.h.
References GetCharWidth(), Lugre::cOgreFontHelper::cTextIterator::HasNext(), mfCharHeight, Lugre::cOgreFontHelper::cTextIterator::Next(), Lugre::cOgreFontHelper::cTextIterator::x, and Lugre::cOgreFontHelper::cTextIterator::y.
Referenced by Lugre::cColourClipTextOverlay::GetGlyphBounds().
| int Lugre::cOgreFontHelper::GetGlyphAtPos | ( | const Ogre::UTFString & | text, | |
| const float | x, | |||
| const float | y | |||
| ) | [inline] |
(e.g. clicking to place the caret) returns the INDEX of the char in the string, not the charcode returns -1 if nothing was hit TODO : TEST ME !
Definition at line 317 of file lugre_ogrefonthelper.h.
References GetCharWidth(), Lugre::cOgreFontHelper::cTextIterator::HasNext(), mfCharHeight, Lugre::cOgreFontHelper::cTextIterator::Next(), Lugre::cOgreFontHelper::cTextIterator::x, and Lugre::cOgreFontHelper::cTextIterator::y.
Referenced by Lugre::cColourClipTextOverlay::GetGlyphAtPos().
| Ogre::FontPtr Lugre::cOgreFontHelper::mpFont |
Definition at line 48 of file lugre_ogrefonthelper.h.
Referenced by GetCharWidth(), and WriteChar_NoIndex().
Definition at line 49 of file lugre_ogrefonthelper.h.
Referenced by Lugre::cOgreFontHelper::cTextIterator::StartLine().
Definition at line 50 of file lugre_ogrefonthelper.h.
Referenced by GetGlyphAtPos(), GetGlyphBounds(), and WriteChar_NoIndex().
Definition at line 51 of file lugre_ogrefonthelper.h.
Referenced by GetTextBounds(), and Lugre::cOgreFontHelper::cTextIterator::LineFeed().
Definition at line 53 of file lugre_ogrefonthelper.h.
Referenced by cOgreFontHelper(), and GetCharWidth().
Definition at line 54 of file lugre_ogrefonthelper.h.
Referenced by GetCharWidth(), and WriteChar_NoIndex().
Definition at line 55 of file lugre_ogrefonthelper.h.
Referenced by CalcLineLen(), Lugre::cOgreFontHelper::cTextIterator::Next(), and TestAutoWrap().
1.5.6