Lugre::cOgreFontHelper Class Reference

#include <lugre_ogrefonthelper.h>

List of all members.

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...


Detailed Description

forward iterator that can be used for text plotting or measurement ogre forum thread http://www.ogre3d.org/phpBB2/viewtopic.php?t=29344

Definition at line 37 of file lugre_ogrefonthelper.h.


Member Typedef Documentation

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.


Member Enumeration Documentation

aligning text for drawing, around 0

Enumerator:
Align_Left 
Align_Center 
Align_Right 

Definition at line 42 of file lugre_ogrefonthelper.h.

anonymous enum

important control chars

Enumerator:
UNICODE_NEL 
UNICODE_CR 
UNICODE_LF 
UNICODE_TAB 
UNICODE_SPACE 
UNICODE_ZERO 

Definition at line 85 of file lugre_ogrefonthelper.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

static eAlignment Lugre::cOgreFontHelper::Alignment ( Ogre::TextAreaOverlayElement::Alignment  align  )  [inline, static]

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]

static bool Lugre::cOgreFontHelper::IsWhiteSpace ( unicode_char  c  )  [inline, static]

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]

Definition at line 100 of file lugre_ogrefonthelper.h.

References IsTab().

static bool Lugre::cOgreFontHelper::IsSpace ( itor  i  )  [inline, static]

Definition at line 101 of file lugre_ogrefonthelper.h.

References IsSpace().

static bool Lugre::cOgreFontHelper::IsNewLine ( itor  i  )  [inline, static]

Definition at line 102 of file lugre_ogrefonthelper.h.

References IsNewLine().

static bool Lugre::cOgreFontHelper::IsWhiteSpace ( itor  i  )  [inline, static]

Definition at line 103 of file lugre_ogrefonthelper.h.

References IsWhiteSpace().

float Lugre::cOgreFontHelper::GetCharWidth ( unicode_char  c  )  [inline]

float Lugre::cOgreFontHelper::CalcLineLen ( itor  i,
const itor  iEnd 
) [inline]

float Lugre::cOgreFontHelper::CalcWordLen ( itor  i,
const itor  iEnd 
) [inline]

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]

static void Lugre::cOgreFontHelper::WriteVertex ( float *&  pVert,
const float  x,
const float  y,
const float  z,
const float  u,
const float  v 
) [inline, static]

Definition at line 165 of file lugre_ogrefonthelper.h.

Referenced by WriteChar_NoIndex().

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]

void Lugre::cOgreFontHelper::GetGlyphBounds ( const Ogre::UTFString &  text,
const int  iCharIndex,
Ogre::Real &  l,
Ogre::Real &  t,
Ogre::Real &  r,
Ogre::Real &  b 
) [inline]

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().


Member Data Documentation

Definition at line 48 of file lugre_ogrefonthelper.h.

Referenced by GetCharWidth(), and WriteChar_NoIndex().

Definition at line 50 of file lugre_ogrefonthelper.h.

Referenced by GetGlyphAtPos(), GetGlyphBounds(), and WriteChar_NoIndex().

Definition at line 52 of file lugre_ogrefonthelper.h.

Referenced by GetCharWidth().

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().


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

Generated on Tue May 22 06:00:42 2012 for cpp by  doxygen 1.5.6