# Visualization Library A lightweight C++ OpenGL middleware for 2D/3D graphics | [Home] [Tutorials] [All Classes] [Grouped Classes]

# vl::Text Class Reference

A Renderable that renders text with a given Font. More...

`#include <Text.hpp>`

Inheritance diagram for vl::Text:

List of all members.

## Public Member Functions
virtual const char * | className ()
| Returns the name of the class.
| Text ()
const String & | text () const
void | setText (const String &text)
const fvec4 & | color () const
void | setColor (const fvec4 &color)
const fvec4 & | borderColor () const
void | setBorderColor (const fvec4 &border_color)
const fvec4 & | outlineColor () const
void | setOutlineColor (const fvec4 &outline_color)
const fvec4 & | backgroundColor () const
void | setBackgroundColor (const fvec4 &background_color)
const fvec4 & | shadowColor () const
void | setShadowColor (const fvec4 &shadow_color)
const fvec2 & | shadowVector () const
void | setShadowVector (const fvec2 &shadow_vector)
int | margin () const
void | setMargin (int margin)
Font * | font () const
void | setFont (Font *font)
const fmat4 | matrix () const
void | setMatrix (const fmat4 &matrix)
int | alignment () const
void | setAlignment (int align)
int | viewportAlignment () const
void | setViewportAlignment (int align)
float | interlineSpacing () const
void | setInterlineSpacing (float spacing)
ETextMode | mode () const
void | setMode (ETextMode mode)
ETextLayout | layout () const
void | setLayout (ETextLayout layout)
ETextAlign | textAlignment () const
void | setTextAlignment (ETextAlign align)
bool | borderEnabled () const
void | setBorderEnabled (bool border)
bool | backgroundEnabled () const
void | setBackgroundEnabled (bool background)
bool | kerningEnabled () const
void | setKerningEnabled (bool kerning)
bool | outlineEnabled () const
void | setOutlineEnabled (bool outline)
bool | shadowEnabled () const
void | setShadowEnabled (bool shadow)
virtual void | render (const Actor *, const OpenGLContext *, const Camera *camera) const
| Renders the Renderable.
void | computeBounds_Implementation ()
AABB | boundingRect () const
| Returns the plain 2D bounding box of the text, without taking into consideration the Text's matrix transform and the eventual actor's transform.
AABB | boundingRect (const String &text) const
AABB | boundingRectTransformed (vec3 &a, vec3 &b, vec3 &c, vec3 &d, const Camera *camera, const Actor *actor=NULL) const
AABB | boundingRectTransformed (const Camera *camera, const Actor *actor=NULL) const
| Returns the fully transformed bounding box.
void | translate (float x, float y, float z)
void | rotate (float degrees, float x, float y, float z)
void | resetMatrix ()
## Protected Member Functions
void | renderText (const Actor *, const Camera *camera, const fvec4 &color, const fvec2 &offset) const
void | renderBackground (const Actor *actor, const Camera *camera) const
void | renderBorder (const Actor *actor, const Camera *camera) const
AABB | rawboundingRect (const String &text) const
## Protected Attributes
ref< Font > | mFont
String | mText
fvec4 | mColor
fvec4 | mBorderColor
fvec4 | mBackgroundColor
fvec4 | mOutlineColor
fvec4 | mShadowColor
fvec2 | mShadowVector
fmat4 | mMatrix
float | mInterlineSpacing
int | mAlignment
int | mViewportAlignment
int | mMargin
ETextMode | mMode
ETextLayout | mLayout
ETextAlign | mTextAlignment
bool | mBorderEnabled
bool | mBackgroundEnabled
bool | mOutlineEnabled
bool | mShadowEnabled
bool | mKerningEnabled

## Detailed Description

A Renderable that renders text with a given Font.

See also:
  - Actor
  - VectorGraphics

## Constructor & Destructor Documentation

vl::Text::Text | ( |  | ) | `[inline]`

## Member Function Documentation

virtual const char* vl::Text::className | ( |  | ) | `[inline, virtual]`

Returns the name of the class.

Reimplemented from vl::Renderable.

const String& vl::Text::text | ( |  | ) | const`[inline]`

void vl::Text::setText | ( | const String & | text | ) | `[inline]`

const fvec4& vl::Text::color | ( |  | ) | const`[inline]`

void vl::Text::setColor | ( | const fvec4 & | color | ) | `[inline]`

const fvec4& vl::Text::borderColor | ( |  | ) | const`[inline]`

void vl::Text::setBorderColor | ( | const fvec4 & | border_color | ) | `[inline]`

const fvec4& vl::Text::outlineColor | ( |  | ) | const`[inline]`

void vl::Text::setOutlineColor | ( | const fvec4 & | outline_color | ) | `[inline]`

const fvec4& vl::Text::backgroundColor | ( |  | ) | const`[inline]`

void vl::Text::setBackgroundColor | ( | const fvec4 & | background_color | ) | `[inline]`

const fvec4& vl::Text::shadowColor | ( |  | ) | const`[inline]`

void vl::Text::setShadowColor | ( | const fvec4 & | shadow_color | ) | `[inline]`

const fvec2& vl::Text::shadowVector | ( |  | ) | const`[inline]`

void vl::Text::setShadowVector | ( | const fvec2 & | shadow_vector | ) | `[inline]`

int vl::Text::margin | ( |  | ) | const`[inline]`

void vl::Text::setMargin | ( | int | margin | ) | `[inline]`

Font* vl::Text::font | ( |  | ) | const`[inline]`

void vl::Text::setFont | ( | Font * | font | ) | `[inline]`

const fmat4 vl::Text::matrix | ( |  | ) | const`[inline]`

void vl::Text::setMatrix | ( | const fmat4 & | matrix | ) | `[inline]`

int vl::Text::alignment | ( |  | ) | const`[inline]`

void vl::Text::setAlignment | ( | int | align | ) | `[inline]`

int vl::Text::viewportAlignment | ( |  | ) | const`[inline]`

void vl::Text::setViewportAlignment | ( | int | align | ) | `[inline]`

float vl::Text::interlineSpacing | ( |  | ) | const`[inline]`

void vl::Text::setInterlineSpacing | ( | float | spacing | ) | `[inline]`

ETextMode vl::Text::mode | ( |  | ) | const`[inline]`

void vl::Text::setMode | ( | ETextMode | mode | ) | `[inline]`

ETextLayout vl::Text::layout | ( |  | ) | const`[inline]`

void vl::Text::setLayout | ( | ETextLayout | layout | ) | `[inline]`

ETextAlign vl::Text::textAlignment | ( |  | ) | const`[inline]`

void vl::Text::setTextAlignment | ( | ETextAlign | align | ) | `[inline]`

bool vl::Text::borderEnabled | ( |  | ) | const`[inline]`

void vl::Text::setBorderEnabled | ( | bool | border | ) | `[inline]`

bool vl::Text::backgroundEnabled | ( |  | ) | const`[inline]`

void vl::Text::setBackgroundEnabled | ( | bool | background | ) | `[inline]`

bool vl::Text::kerningEnabled | ( |  | ) | const`[inline]`

void vl::Text::setKerningEnabled | ( | bool | kerning | ) | `[inline]`

bool vl::Text::outlineEnabled | ( |  | ) | const`[inline]`

void vl::Text::setOutlineEnabled | ( | bool | outline | ) | `[inline]`

bool vl::Text::shadowEnabled | ( |  | ) | const`[inline]`

void vl::Text::setShadowEnabled | ( | bool | shadow | ) | `[inline]`

void Text::render | ( | const Actor * | actor,
|  | const OpenGLContext * | ,
|  | const Camera * | camera |
| ) |  |  | const`[virtual]`

Renders the Renderable.

Implements vl::Renderable.

void vl::Text::computeBounds_Implementation | ( |  | ) | `[inline, virtual]`

Implements vl::Renderable.

AABB Text::boundingRect | ( |  | ) | const

Returns the plain 2D bounding box of the text, without taking into consideration the Text's matrix transform and the eventual actor's transform.

AABB Text::boundingRect | ( | const String & | text | ) | const

AABB Text::boundingRectTransformed | ( | vec3 & | a,
|  | vec3 & | b,
|  | vec3 & | c,
|  | vec3 & | d,
|  | const Camera * | camera,
|  | const Actor * | actor = `NULL` |
| ) |  |  | const

AABB Text::boundingRectTransformed | ( | const Camera * | camera,
|  | const Actor * | actor = `NULL` |
| ) |  |  | const

Returns the fully transformed bounding box.

`actor` is needed only if you are using the actor's transform with the Text2D to make the Text2D text follow the actor on the screen or you are using the Text3D to make the text follow the actor's transform in 3D.

The layout of the a, b, c and d points is the following:
d---------c
| |
| |
a---------b
Of course the above layout can be scaled, flipped, rotated and so on according to the given Text's matrix.

void Text::translate | ( | float | x,
|  | float | y,
|  | float | z |
| ) |  |  |

void Text::rotate | ( | float | degrees,
|  | float | x,
|  | float | y,
|  | float | z |
| ) |  |  |

void Text::resetMatrix | ( |  | ) |

void Text::renderText | ( | const Actor * | actor,
|  | const Camera * | camera,
|  | const fvec4 & | color,
|  | const fvec2 & | offset |
| ) |  |  | const`[protected]`

void Text::renderBackground | ( | const Actor * | actor,
|  | const Camera * | camera |
| ) |  |  | const`[protected]`

void Text::renderBorder | ( | const Actor * | actor,
|  | const Camera * | camera |
| ) |  |  | const`[protected]`

AABB Text::rawboundingRect | ( | const String & | text | ) | const`[protected]`

## Member Data Documentation

ref<Font> vl::Text::mFont`[protected]`

String vl::Text::mText`[protected]`

fvec4 vl::Text::mColor`[protected]`

fvec4 vl::Text::mBorderColor`[protected]`

fvec4 vl::Text::mBackgroundColor`[protected]`

fvec4 vl::Text::mOutlineColor`[protected]`

fvec4 vl::Text::mShadowColor`[protected]`

fvec2 vl::Text::mShadowVector`[protected]`

fmat4 vl::Text::mMatrix`[protected]`

float vl::Text::mInterlineSpacing`[protected]`

int vl::Text::mAlignment`[protected]`

int vl::Text::mViewportAlignment`[protected]`

int vl::Text::mMargin`[protected]`

ETextMode vl::Text::mMode`[protected]`

ETextLayout vl::Text::mLayout`[protected]`

ETextAlign vl::Text::mTextAlignment`[protected]`

bool vl::Text::mBorderEnabled`[protected]`

bool vl::Text::mBackgroundEnabled`[protected]`

bool vl::Text::mOutlineEnabled`[protected]`

bool vl::Text::mShadowEnabled`[protected]`

bool vl::Text::mKerningEnabled`[protected]`

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

- E:/VisualizationLibrary/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vl/Text.hpp
- E:/VisualizationLibrary/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vl/Text.cpp

Visualization Library v2009.08 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Sun Nov 29 11:11:53 2009.
Permission is granted to use this page to write and publish articles regarding Visualization Library.