# Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics

[Home] [Tutorials] [All Classes] [Grouped Classes]

Public Member Functions | Protected Member Functions | Protected Attributes

# vl::CoreText Class Reference

Experimental. More...

`#include <CoreText.hpp>`

Inheritance diagram for vl::CoreText:

List of all members.

## Public Member Functions

| CoreText ()
const String & | text () const
| The text to be rendered.
void | setText (const String &text)
| The text to be rendered.
const fvec4 & | color () const
| The color of the text.
void | setColor (const fvec4 &color)
| The color of the text.
int | margin () const
| The margin to be left around the text.
void | setMargin (int margin)
| The margin to be left around the text.
const Font * | font () const
| The font to be used to render the text.
Font * | font ()
| The font to be used to render the text.
void | setFont (Font *font)
| The font to be used to render the text.
ETextLayout | layout () const
| Text layout: left to right, right to left.
void | setLayout (ETextLayout layout)
| Text layout: left to right, right to left.
ETextAlign | textAlignment () const
| Text alignment: left, right, center, justify.
void | setTextAlignment (ETextAlign align)
| Text alignment: left, right, center, justify.
int | textOrigin () const
| The origin of the text (pivot point for offsetting and rotations).
void | setTextOrigin (int align)
| The origin of the text (pivot point for offsetting and rotations).
bool | kerningEnabled () const
| If enabled text rendering uses kerning information for better quality results (slower).
void | setKerningEnabled (bool kerning)
| If enabled text rendering uses kerning information for better quality results (slower).
bool | borderEnabled () const
| If true draws a rectangular border around the text.
void | setBorderEnabled (bool border)
| If true draws a rectangular border around the text.
const fvec4 & | borderColor () const
| The color of the rectangular border.
void | setBorderColor (const fvec4 &border_color)
| The color of the rectangular border.
bool | backgroundEnabled () const
| If true draws a rectangular background below the text.
void | setBackgroundEnabled (bool background)
| If true draws a rectangular background below the text.
const fvec4 & | backgroundColor () const
| The color of the rectangular background.
void | setBackgroundColor (const fvec4 &background_color)
| The color of the rectangular background.
bool | outlineEnabled () const
| If true the characters are drawn with an outline.
void | setOutlineEnabled (bool outline)
| If true the characters are drawn with an outline.
const fvec4 & | outlineColor () const
| The color of the character outline.
void | setOutlineColor (const fvec4 &outline_color)
| The color of the character outline.
bool | shadowEnabled () const
| If true a sort of shadow is rendered below the text.
void | setShadowEnabled (bool shadow)
| If true a sort of shadow is rendered below the text.
const fvec4 & | shadowColor () const
| The color of the text shadow.
void | setShadowColor (const fvec4 &shadow_color)
| The color of the text shadow.
const fvec2 & | shadowVector () const
| The offset vector of the shadow.
void | setShadowVector (const fvec2 &shadow_vector)
| The offset vector of the shadow.
AABB | boundingRect () const
| Returns the plain 2D bounding box of the text, in local coordinates.
AABB | boundingRect (const String &text) const
| Returns the plain 2D bounding box of the text, in local coordinates.
virtual void | updateDirtyBufferObject (EBufferObjectUpdateMode)
| Uploads the data stored in the local buffers on the GPU memory.
virtual void | deleteBufferObject ()
| Destroys the BufferObject (vertex buffer objects) associated to this a Renderable.

## Protected Member Functions

virtual void | render_Implementation (const Actor *actor, const Shader *shader, const Camera *camera, OpenGLContext *gl_context) const
void | computeBounds_Implementation ()
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
int | mTextOrigin
int | mMargin
ETextLayout | mLayout
ETextAlign | mTextAlignment
bool | mBorderEnabled
bool | mBackgroundEnabled
bool | mOutlineEnabled
bool | mShadowEnabled
bool | mKerningEnabled

## Detailed Description

Experimental.

Not yet functional.

Definition at line 47 of file CoreText.hpp.

## Constructor & Destructor Documentation

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

Definition at line 52 of file CoreText.hpp.

References VL_DEBUG_SET_OBJECT_NAME.

## Member Function Documentation

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

The text to be rendered.

Definition at line 60 of file CoreText.hpp.

Referenced by boundingRect(), render_Implementation(), and renderText().

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

The text to be rendered.

Definition at line 62 of file CoreText.hpp.

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

The color of the text.

Definition at line 65 of file CoreText.hpp.

Referenced by render_Implementation().

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

The color of the text.

Definition at line 67 of file CoreText.hpp.

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

The margin to be left around the text.

Definition at line 70 of file CoreText.hpp.

Referenced by boundingRect(), and renderText().

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

The margin to be left around the text.

Definition at line 72 of file CoreText.hpp.

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

The font to be used to render the text.

Definition at line 75 of file CoreText.hpp.

Referenced by rawboundingRect(), render_Implementation(), and renderText().

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

The font to be used to render the text.

Definition at line 77 of file CoreText.hpp.

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

The font to be used to render the text.

Definition at line 79 of file CoreText.hpp.

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

Text layout: left to right, right to left.

Definition at line 82 of file CoreText.hpp.

Referenced by rawboundingRect(), and renderText().

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

Text layout: left to right, right to left.

Definition at line 84 of file CoreText.hpp.

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

Text alignment: left, right, center, justify.

Definition at line 87 of file CoreText.hpp.

Referenced by renderText().

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

Text alignment: left, right, center, justify.

Definition at line 89 of file CoreText.hpp.

int vl::CoreText::textOrigin | ( | ) | const`[inline]`

The origin of the text (pivot point for offsetting and rotations).

Definition at line 92 of file CoreText.hpp.

Referenced by boundingRect(), and renderText().

void vl::CoreText::setTextOrigin | ( | int | align ) | `[inline]`

The origin of the text (pivot point for offsetting and rotations).

Definition at line 94 of file CoreText.hpp.

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

If enabled text rendering uses kerning information for better quality results (slower).

Definition at line 97 of file CoreText.hpp.

Referenced by rawboundingRect(), and renderText().

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

If enabled text rendering uses kerning information for better quality results (slower).

Definition at line 99 of file CoreText.hpp.

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

If true draws a rectangular border around the text.

Definition at line 102 of file CoreText.hpp.

Referenced by render_Implementation().

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

If true draws a rectangular border around the text.

Definition at line 104 of file CoreText.hpp.

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

The color of the rectangular border.

Definition at line 107 of file CoreText.hpp.

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

The color of the rectangular border.

Definition at line 109 of file CoreText.hpp.

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

If true draws a rectangular background below the text.

Definition at line 112 of file CoreText.hpp.

Referenced by render_Implementation().

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

If true draws a rectangular background below the text.

Definition at line 114 of file CoreText.hpp.

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

The color of the rectangular background.

Definition at line 117 of file CoreText.hpp.

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

The color of the rectangular background.

Definition at line 119 of file CoreText.hpp.

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

If true the characters are drawn with an outline.

Definition at line 122 of file CoreText.hpp.

Referenced by render_Implementation().

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

If true the characters are drawn with an outline.

Definition at line 124 of file CoreText.hpp.

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

The color of the character outline.

Definition at line 127 of file CoreText.hpp.

Referenced by render_Implementation().

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

The color of the character outline.

Definition at line 129 of file CoreText.hpp.

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

If true a sort of shadow is rendered below the text.

Definition at line 132 of file CoreText.hpp.

Referenced by render_Implementation().

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

If true a sort of shadow is rendered below the text.

Definition at line 134 of file CoreText.hpp.

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

The color of the text shadow.

Definition at line 137 of file CoreText.hpp.

Referenced by render_Implementation().

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

The color of the text shadow.

Definition at line 139 of file CoreText.hpp.

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

The offset vector of the shadow.

Definition at line 142 of file CoreText.hpp.

Referenced by render_Implementation().

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

The offset vector of the shadow.

Definition at line 144 of file CoreText.hpp.

AABB CoreText::boundingRect | ( | ) | const

Returns the plain 2D bounding box of the text, in local coordinates.

Definition at line 631 of file CoreText.cpp.

References text().

Referenced by renderBackground(), and renderBorder().

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

Returns the plain 2D bounding box of the text, in local coordinates.

Definition at line 636 of file CoreText.cpp.

References vl::AlignBottom, vl::AlignHCenter, vl::AlignLeft, vl::AlignRight, vl::AlignTop, vl::AlignVCenter, vl::AABB::height(), margin(), vl::max(), vl::AABB::maxCorner(), vl::min(), vl::AABB::minCorner(), rawboundingRect(), vl::AABB::setMaxCorner(), vl::AABB::setMinCorner(), textOrigin(), VL_CHECK, vl::AABB::width(), vl::Vector3< T_Scalar >::x(), and vl::Vector3< T_Scalar >::y().

virtual void vl::CoreText::updateDirtyBufferObject | ( | EBufferObjectUpdateMode | ) | `[inline, virtual]`

Uploads the data stored in the local buffers on the GPU memory.

If 'discard_local_data' is set to `true` the memory used by the local buffers is released.

Implements vl::Renderable.

Definition at line 154 of file CoreText.hpp.

virtual void vl::CoreText::deleteBufferObject | ( | ) | `[inline, virtual]`

Destroys the BufferObject (vertex buffer objects) associated to this a Renderable.

Note:
  This function does not touch the local (non GPU) data stored in the buffers associated to the vertex attributes and DrawCall.

Implements vl::Renderable.

Definition at line 156 of file CoreText.hpp.

void CoreText::render_Implementation | ( | const Actor * | actor,
|  | const Shader * | shader,
|  | const Camera * | camera,
|  | OpenGLContext * | gl_context
| ) |  | const`[protected, virtual]`

Implements vl::Renderable.

Definition at line 61 of file CoreText.cpp.

References backgroundEnabled(), vl::OpenGLContext::bindVAS(), borderEnabled(), color(), font(), vl::Has_GL_Version_2_0, NULL, outlineColor(), outlineEnabled(), renderBackground(), renderBorder(), renderText(), shadowColor(), shadowEnabled(), shadowVector(), text(), and VL_CHECK.

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

Implements vl::Renderable.

Definition at line 160 of file CoreText.hpp.

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

Definition at line 159 of file CoreText.cpp.

References vl::Glyph::advance(), vl::AlignBottom, vl::AlignHCenter, vl::AlignLeft, vl::AlignRight, vl::AlignTop, vl::AlignVCenter, vl::Log::error(), font(), vl::Glyph::glyphIndex(), vl::Glyph::height(), kerningEnabled(), layout(), vl::Glyph::left(), vl::LeftToRightText, vl::String::length(), vl::length(), margin(), vl::AABB::maxCorner(), mFont, vl::AABB::minCorner(), vl::Vector4< T_Scalar >::ptr(), rawboundingRect(), vl::RightToLeftText, vl::Glyph::s0(), vl::Glyph::s1(), vl::AABB::setMaxCorner(), vl::Glyph::t0(), vl::Glyph::t1(), text(), vl::TextAlignCenter, vl::TextAlignJustify, vl::TextAlignLeft, textAlignment(), vl::TextAlignRight, textOrigin(), vl::Glyph::textureHandle(), vl::Glyph::top(), VL_CHECK, VL_CHECK_OGL, VL_TRAP, vl::Glyph::width(), vl::AABB::width(), vl::Vector3< T_Scalar >::x(), vl::Vector2< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), vl::Vector2< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().

Referenced by render_Implementation().

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

Definition at line 569 of file CoreText.cpp.

References boundingRect(), vl::AABB::maxCorner(), mBackgroundColor, vl::AABB::minCorner(), vl::Vector4< T_Scalar >::ptr(), vl::Vector3< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().

Referenced by render_Implementation().

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

Definition at line 600 of file CoreText.cpp.

References boundingRect(), vl::AABB::maxCorner(), mBorderColor, vl::AABB::minCorner(), vl::Vector4< T_Scalar >::ptr(), vl::Vector3< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().

Referenced by render_Implementation().

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

Definition at line 467 of file CoreText.cpp.

References vl::AABB::addPoint(), vl::Log::error(), font(), vl::ref< T >::get(), kerningEnabled(), layout(), vl::LeftToRightText, vl::String::length(), mFont, NULL, vl::RightToLeftText, VL_TRAP, vl::Vector3< T_Scalar >::x(), vl::Vector2< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), and vl::Vector2< T_Scalar >::y().

Referenced by boundingRect(), and renderText().

## Member Data Documentation

ref<Font> vl::CoreText::mFont`[mutable, protected]`

Definition at line 168 of file CoreText.hpp.

Referenced by rawboundingRect(), and renderText().

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

Definition at line 169 of file CoreText.hpp.

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

Definition at line 170 of file CoreText.hpp.

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

Definition at line 171 of file CoreText.hpp.

Referenced by renderBorder().

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

Definition at line 172 of file CoreText.hpp.

Referenced by renderBackground().

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

Definition at line 173 of file CoreText.hpp.

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

Definition at line 174 of file CoreText.hpp.

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

Definition at line 175 of file CoreText.hpp.

int vl::CoreText::mTextOrigin`[protected]`

Definition at line 176 of file CoreText.hpp.

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

Definition at line 177 of file CoreText.hpp.

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

Definition at line 178 of file CoreText.hpp.

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

Definition at line 179 of file CoreText.hpp.

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

Definition at line 180 of file CoreText.hpp.

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

Definition at line 181 of file CoreText.hpp.

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

Definition at line 182 of file CoreText.hpp.

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

Definition at line 183 of file CoreText.hpp.

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

Definition at line 184 of file CoreText.hpp.

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

- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/CoreText.hpp
- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/CoreText.cpp

Visualization Library v2011.09.1162 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu Jan 26 2012 00:44:31.
Permission is granted to use this page to write and publish articles regarding Visualization Library.