GL Studio C++ Runtime API
gls_runtime_font_base.h
Go to the documentation of this file.
1/// \file gls_runtime_font_base.h
2/// \brief The disti::GlsRuntimeFontBase class and related classes.
3///
4/// \par Copyright Information
5///
6/// Copyright (c) 2017 by The DiSTI Corporation.<br>
7/// 12249 Science Drive; Suite 300<br>
8/// Orlando, Florida 32826<br>
9/// USA<br>
10/// <br>
11/// All rights reserved.<br>
12///
13/// This Software contains proprietary trade secrets of DiSTI and may not be
14/// reproduced, in whole or part, in any form, or by any means of electronic,
15/// mechanical, or otherwise, without the written permission of DiSTI. Said
16/// permission may be derived through the purchase of applicable DiSTI product
17/// licenses which detail the distribution rights of this content and any
18/// Derivative Works based on this or other copyrighted DiSTI Software.
19///
20/// NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
21/// AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
22/// PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
23/// AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
24/// IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
25/// PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
26///
27/// LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
28/// IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
29/// INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
30/// DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
31/// INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
32/// INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
33/// OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
34/// EXCEED FIVE DOLLARS (US$5.00).
35///
36/// The aforementioned terms and restrictions are governed by the laws of the
37/// State of Florida and the United States of America.
38
39#ifndef INCLUDE_GLS_RUNTIME_FONT_BASE_H
40#define INCLUDE_GLS_RUNTIME_FONT_BASE_H
41
42#include "gls_font_base.h"
43#include "scoped_ptr.h"
44
45namespace disti
46{
47// Forward Declaration
48class RuntimeGlyphGenerationFont;
49
50//===========================================================================
51/**
52* The GlsRuntimeFontBase class provides a specific font face for use within the GL
53* Studio. The font face is determined at construction time by the
54* parameters passed in by the creator of the GlsFontBase instance. Specific
55* instances should be wrapped in a singleton object wrapper, as there is
56* no reason to have more than one instance of the exact same face (meaning
57* font family, style, and point size.)
58*
59* Once instanced, a GlsFontRenderer object can be used to render characters in
60* Open GL at specific locations and with several different text effects.
61*
62* \sa GlsFontRenderer
63*/
64//===========================================================================
66{
67public:
68 /** char index associated with absent glyph */
69 static const unsigned short NO_GLYPH;
70
71 //-----------------------------------------------------------------------
72 /// Attributes of the specific font
73 //-----------------------------------------------------------------------
75
76 //-----------------------------------------------------------------------
77 /// Character attributes. One item for each character in the set.
78 //-----------------------------------------------------------------------
80
81 typedef std::vector<CharAttrRuntime_t> AttrContRuntime_t; ///< Typedef for a list of character attributes.
82
83 /** Class Constructor
84 * \param family the family name of the font.
85 * \param style the style name of the font.
86 * \param ptSize the point size of the font.
87 * \param fontPath the path and filename of the font file to load.
88 * \param maxCharWidth the maximum width of the largest character.
89 * \param maxCharHeight the maximum height of the largest character.
90 * \param descender the maximum descender of the largest character.
91 */
92 GLS_EXPORT GlsRuntimeFontBase( const char* family, const char* style, const unsigned int ptSize, const char* fontPath,
93 const unsigned int maxCharWidth, const unsigned int maxCharHeight, const unsigned int descender );
94
95 /** Determine if font was instantiated correctly
96 * \return true if valid else false
97 */
98 GLS_EXPORT bool IsValid() const;
99
100 /** Gets the runtime character attribute for the given char
101 * \param c The character to retrieve attributes for.
102 * \returns The attributes for the character else char attributes for first character
103 * in font if char is not in range for this font
104 */
106
107 /** Gets a pointer to the internal data needed for runtime glyph generation.
108 * \return A pointer to the internal data needed for runtime glyph generation.
109 */
110 GLS_EXPORT RuntimeGlyphGenerationFont* GetRuntimeGlyphGenerationFont();
111
112protected:
113 /**
114 * Class Destructor. This is protected so that no one can delete a font
115 * except via the font manager GlsFontMan.
116 * It is not virtual because we want to avoid calling destructors on unloaded font code,
117 * and it is not needed.
118 */
120
121 friend class GlsFontMan;
122
123 FontAttrRuntime_t _fontAttrRuntime; /**< runtime font attributes */
124
125 mutable CharAttrRuntime_t _charAttrRuntime; /**< runtime char attributes */
126
127 bool _isValid; /**< true if font is valid else false */
128
129 /** Pointer to the internal data needed for runtime glyph generation. */
131
132private:
133 //-----------------------------------------------------------------------
134 // Prevent copies
135 //-----------------------------------------------------------------------
137 GlsRuntimeFontBase& operator=( const GlsRuntimeFontBase& );
138
139}; // end class GlsRuntimeFontBase
140
141} // end namespace disti
142
143#endif
Definition: gls_font_base.h:86
GLuint Char_t
Define the character type to use.
Definition: gls_font_base.h:88
Definition: gls_font_man.h:59
Definition: gls_runtime_font_base.h:66
CharAttrRuntime_t _charAttrRuntime
Definition: gls_runtime_font_base.h:125
const CharAttrRuntime_t & CharAttrRuntime(Char_t c) const
RuntimeGlyphGenerationFont * GetRuntimeGlyphGenerationFont()
GlsFontBase::FontAttr_t FontAttrRuntime_t
Attributes of the specific font.
Definition: gls_runtime_font_base.h:74
GlsRuntimeFontBase(const char *family, const char *style, const unsigned int ptSize, const char *fontPath, const unsigned int maxCharWidth, const unsigned int maxCharHeight, const unsigned int descender)
bool _isValid
Definition: gls_runtime_font_base.h:127
std::vector< CharAttrRuntime_t > AttrContRuntime_t
Typedef for a list of character attributes.
Definition: gls_runtime_font_base.h:81
static const unsigned short NO_GLYPH
Definition: gls_runtime_font_base.h:69
ScopedPtr< RuntimeGlyphGenerationFont > _runtimeGlyphGenerationFont
Definition: gls_runtime_font_base.h:130
FontAttrRuntime_t _fontAttrRuntime
Definition: gls_runtime_font_base.h:123
GlsFontBase::CharAttr_t CharAttrRuntime_t
Character attributes. One item for each character in the set.
Definition: gls_runtime_font_base.h:79
The disti::GlsFontBase class and related classes.
#define GLS_EXPORT
Macro denoting which functions should be visible from the runtime library.
Definition: gls_include.h:50
Definition: bmpimage.h:46
A smart pointer with unique ownership – poor man's std::unique_ptr.
Character attributes. One item for each character in the set.
Definition: gls_font_base.h:124
Attributes of the specific font.
Definition: gls_font_base.h:94