GL Studio C++ Runtime API
gls_text_box.h
Go to the documentation of this file.
1/// \file gls_text_box.h
2/// \brief The disti::GlsTextBox class.
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 DISTI_INCLUDED_GLS_TEXT_BOX_H
40#define DISTI_INCLUDED_GLS_TEXT_BOX_H
41
42/// Provides support for creating DLLs.
43#if( defined( GLSGEN_EXPORT_GLSTEXTBOX ) || defined( GLSGEN_IMPORT_GLSTEXTBOX ) || defined( GLSGEN_GLSTEXTBOX_EXPORT_GENERATED ) || defined( GLS_IMPORT_GENERATED ) ) \
44 && defined( _MSC_VER )
45# if defined( GLSGEN_EXPORT_GLSTEXTBOX ) || defined( GLSGEN_GLSTEXTBOX_EXPORT_GENERATED )
46# define GLSGEN_GLSTEXTBOX_EXPORT __declspec( dllexport )
47# else
48# define GLSGEN_GLSTEXTBOX_EXPORT __declspec( dllimport )
49# endif
50#else
51# define GLSGEN_GLSTEXTBOX_EXPORT
52#endif
53///////////////////////////////////////////////////////////////////////////////
54
55#include "gls_gl.h"
56#include <string>
57
59#include "gls_text.h"
60#include "unhide_globals.h"
61
62#ifdef GLES
63# include "gls_quad_storage.h"
64# include "gls_state_manager.h"
65#endif
66
67/// Automatically link the runtime library plugin (on Windows).
68#define LIB_BASE_NAME "gls_text_box"
69#include "gls_auto_lib.h"
70#undef LIB_BASE_NAME
71
72#undef GetCharWidth
73
74//===========================================================================
75// BEGIN NAMESPACE
76//===========================================================================
77namespace disti
78{
79#ifdef GLES
80// Forward Declaration
81class GlsGloFileAttribute;
82#endif
83
84//===========================================================================
85/**
86* The GlsTextBox
87*/
88class GlsTextBox : public GlsText
89{
90protected:
92
93 /// Helper function that performs the underlying text draw.
94 /// \note Not normally called by users.
95 void DrawText();
96
97#ifdef GLES
98 GlsQuadListVC_3D _backgrounds; ///< Quads used to render the backgrounds. This is rendered behind the other quads associated with this text box.
99 GlsQuadListVCT_2D _shadows; ///< Quads used to render the shadows behind the text.
100 GlsQuadListVC_3D _shadowLines; ///< Quads used to render the shadows for lines such as underlines and strikethroughs.
101 GlsQuadListVCT_2D _characters; ///< Quads used to render the characters in the foreground.
102 GlsQuadListVC_3D _lines; ///< Quads used to render lines such as underlines and strikethroughs.
103
104 /// Constructs primitives and renders each character. This function considers the text box's position, justification, character size,
105 /// and decorations (such as strikethroughs and shadows).
106 void PopulateQuadStorage();
107#endif
108
109public:
110 /// The ResizeMode_t enumeration. Describes the resize behavior of this text object.
112 {
113 RESIZE_MODE_FIXED,
114 RESIZE_MODE_AUTO_WIDTH,
115 RESIZE_MODE_AUTO_HEIGHT
116 };
117
118 DISTI_DEPRECATED( "This identifier is forbidden by the C++ standard. Use BaseClass instead." )
119 typedef GlsText _BaseClass; ///< Deprecated typedef for the base class.
120 typedef GlsText BaseClass; ///< Typedef for the base class.
121
122 friend class GlsTextBoxEditor;
123
124 /** Class Constructor. */
126
127 /// Copy constructor
128 /// \param that The object to copy from.
129 /// \param generateNames Whether or not to generate an instance name for this object.
130 GLSGEN_GLSTEXTBOX_EXPORT GlsTextBox( const GlsTextBox& that, const bool generateNames );
131
132 /** Class Constructor. */
134
135 // Need to declare using all base class methods that we overload
136 using BaseClass::Baseline;
137 using BaseClass::BgColor;
138 using BaseClass::CellHeight;
139 using BaseClass::CellWidth;
140 using BaseClass::Char;
141 using BaseClass::CharAttr;
142 using BaseClass::CharScaling;
143 using BaseClass::CharSpacing;
144 using BaseClass::Erase;
145 using BaseClass::FauxBold;
147 using BaseClass::Inverse;
148 using BaseClass::StrikeThru;
149 using BaseClass::String;
150 using BaseClass::TextColor;
151 using BaseClass::Underline;
152
154
155 /* Peform any necessary non-draw calculations like resizing
156 * the grid.
157 * \param time The time since the start of program execution
158 */
160
165
166#ifndef GLES
169#endif
170
171#ifdef GLES
173#endif
174
175 GLSGEN_GLSTEXTBOX_EXPORT void SetVertices( unsigned int nPoints, Vertex* vertices ) DISTI_METHOD_OVERRIDE;
176
177 /// Sets the initial state of this object.
179
180 /// Rebuilds this text box layout. This may be an expensive call, so it should only be called when a property changes.
182
183 /* Unhides base class implementation. */
184 using BaseClass::Scale;
185
186 /**
187 We need to know the Max number of lines/rows possible to display, we
188 may run out of characters to print/display before we hit the max
189 number of lines though.
190 \return A value between Zero and INT_MAX, representing the max lines/rows to draw
191 \pre The TextBox object has been initialized
192 \post The value of max lines returned to the caller
193 */
195
196 GLSGEN_GLSTEXTBOX_EXPORT void Scale( float px, float py, float pz, Vertex* anchor, int handleBar ) DISTI_METHOD_OVERRIDE;
197
198 /// Different text justifications.
200 {
201 ALIGN_CENTER,
202 ALIGN_TOP,
203 ALIGN_BOTTOM
204 };
205
206 /** Set the vertical justification for this text object
207 * \param justification The justification mode (TOP, BOTTOM, CENTER)
208 */
210
211 /** Get the vertical justification for this text object
212 * \return vertical justification
213 */
215 {
216 return _verticalAlignment;
217 }
218
219 //-----------------------------------------------------------------------
220 //-----------------------------------------------------------------------
221 // Routines for compatbility with TextDisplay.gls
222 //-----------------------------------------------------------------------
223 //-----------------------------------------------------------------------
224
225 /** Clears all of the characters and resets the attributes of all
226 * characters (TextDisplay compatability method)
227 * \deprecated use Erase instead
228 */
229 void Clear()
230 {
231 Erase();
232 }
233
234 /** Clears all of the characters. Does NOT reset the attributes
235 * of the characters (TextDisplay compatability method)
236 * \deprecated
237 */
239 {
240 _text.erase();
241 SetRebuild();
242 }
243
244 /** SetColor() meaning has changed, now use TextColor */
245
246 /** Print a string into this text object starting at index 0 and proceeding Left
247 * to right Wraps at newline characters. Does not change the color or any
248 * other modes. Replaces the entire string.
249 * (TextDisplay compatability method)
250 * \param s The string to print
251 * \deprecated use String instead
252 */
253 void SetString( const char* s )
254 {
255 String( s );
256 }
257
258 /** Print a string into this text object
259 * to right. Wraps at newline characters. Does not change the color or any
260 * other modes. Replaces the entire string.
261 * \param format printf style varargs formatting string.
262 */
263 GLSGEN_GLSTEXTBOX_EXPORT void VaString( const char* format, ... );
264
265 /// \cond INTERNAL
266 // Undocumented.
267 // This method is used to calculate the lines of the text box and is likely to change in future releases.
268 GLSGEN_GLSTEXTBOX_EXPORT void NextLineInfo( const unsigned int currentStringIndex,
269 unsigned int* lineEndIndex,
270 unsigned int* nextLineStringIndex,
271 float* startXpixels,
272 float* lineLengthPixels );
273
274 // Undocumented.
275 // This method is used to calculate the lines of the text box and may change in future releases.
276 GLSGEN_GLSTEXTBOX_EXPORT unsigned int GetLineCount();
277 // \endcond
278
279 /** Sets tab space multiplier, 1.0 == same as specified in font */
281
282 /** Returns the current tab space multiplier
283 * \return the current tab space multiplier
284 */
286
287 /** Determine if the text direction is set to left->right or right->left
288 * \return true if if the text direction is set to left->right else false for right->left
289 */
291
292 /** Set the text direction
293 * \param leftToRight true for left->right else false for right->left
294 */
295 GLSGEN_GLSTEXTBOX_EXPORT void LeftToRight( bool leftToRight );
296
297 /// Set the resize behavior for this object.
298 /// \param value The new resize behavior.
300
301 /// \return The current resize behavior for this object.
303
304 /// Set the maximum resize width for this object in logical units.
305 /// \param value The new maximum width.
306 virtual GLSGEN_GLSTEXTBOX_EXPORT void MaxWidth( float value );
307
308 /// \return The current maximum resize width for this object in logical units.
310
311 /// Set the maximum resize height for this object in logical units.
312 /// \param value The new maximum height.
313 virtual GLSGEN_GLSTEXTBOX_EXPORT void MaxHeight( float value );
314
315 /// \return The current maximum resize height for this object in logical units.
317
318protected:
319#ifdef GLES
320 /** Set a single attribute from the GLO file.
321 * \param data The attribute to set and its associated data.
322 */
324#endif
325
326 /// Allocate a text buffer of the appropriate size for this grid and output snprintf style format into the buffer.
327 /// \param format snprintf style format spec
328 /// \param args Arguments for sprintf style formatting.
329 /// \return A formatted textbuffer ( must be deleted by caller ).
330 GLSGEN_GLSTEXTBOX_EXPORT char* FormatVarArgList( const char* format, va_list args );
331
332 /// true -> grid will draw characters using "per character attributes" else
333 /// false -> all characters will be drawn using the first character's attribute
334 /// NOTE: This defaults to false and automatically enables to true if the user calls
335 /// a method that requires per character attributes
337
338 /// Enable per character attribute drawing for this grid.
340 {
341 if( !_perCharAttribs )
342 {
343 _perCharAttribs = true;
344 SetRebuild();
345 }
346 }
347
348 Align_t _verticalAlignment; ///< Justification setting (TOP, CENTER, BOTTOM).
349
350 float _tabSpacing; ///< Space multiplier for tabs.
351
352 /// Helper function to calculate cell sizes based on the
353 /// scale of the object if control cell size is enabled.
354 /// \note Not normally called by users.
356
357 /// Helper function to readjust vertices back to the local origin being aligned with vertex 0.
358 /// \note Not normally called by users.
360
361 /** Populate the _rowInfo array based on the current display string
362 * \pre none
363 * \post _rowInfo array is populated based on the current display string
364 */
366
367 /// Get the row info for the row starting at the given string index
368 /// \param strIndex starting index into string
369 /// \param rowLength [out] gets number of characters in row
370 /// \param rowPixelWidth [out] gets pixel width of row
371 /// \param nextRowStartIndex [out] gets starting string index for next row
372 /// else GLSUINT32_MAX if there is no string data for the next row
373 /// \pre strIndex < _str.GetLength()
374 /// \post rowLength has the number of characters in the row,
375 /// rowPixelWidth has the pixel width of the row,
376 /// nextRowStartIndex has the starting string index for the next row
377 /// else GLSUINT32_MAX if there is no string data for the next row
378 GLSGEN_GLSTEXTBOX_EXPORT void GetNextRowInfo( const unsigned int strIndex,
379 unsigned int& rowLength,
380 float& rowPixelWidth,
381 unsigned int& nextRowStartIndex ) const;
382
383 /// Helper function that returns the maximum line length (text box width) in logical units.
384 /// \return Infinity if no limit, otherwise the limit in logical units.
386
387 /// Helper function that adjusts the vertices to contain the text based on the resize behavior.
389
390public:
391 /** Get the width for the given character taking into account cell sizing, character spacing, uppercasing
392 * and tab characters width being expanded
393 * \param c character in question
394 * \return width for given character
395 * \pre none
396 * \post none
397 */
398 GLSGEN_GLSTEXTBOX_EXPORT float GetCharWidth( const unsigned short c ) const;
399
400protected:
401 /** info for one row of text in the display */
402 struct RowInfo
403 {
404 unsigned int startingIndex; /**< starting text index into the display for row
405 * else GLSUINT32_MAX if row has no characters */
406 unsigned int length; /**< the number of characters in row */
407 float pixelWidth; /**< the width of row in pixels */
408 };
409
410 unsigned int _lineCount; ///< Number of rows of characters in the text grid (number of lines).
411 bool _lineCountChanged; ///< If true, the line count has changed, and row information needs to be rebuilt.
412
413 RowInfo* _rowInfo; /**< array ( _rows number of elements ) of RowInfo */
414
415 float _cellWidthRatio; ///< Holds cell width / max char width ratio used for horizontal advance.
416
417 float _maxLineLengthPixels; ///< Calculated maximimum line width in "pixels" (logical units).
418 float _maxTextHeightPixels; ///< Calculated maximimum height in "pixels" (logical units).
419 unsigned int _maxLinesToDraw; ///< Calculated maximum number of lines that can fit.
420
421 bool _leftToRight; ///< true to render characters from left to right else, false for right to left.
422
423 ResizeMode_t _resizeMode; ///< The current automatic resize behavior.
424 float _resizeMaxWidth; ///< The calculated maximum width in logical units based on the current resize behavior.
425 float _resizeMaxHeight; ///< The calculated maximim height in logical units based on the current resize behavior.
426
427 UTF16String _unicodeText; /**< unicode version of _text from base class, updated by CalculateRowData */
428
429 /// \details A helper class for processing underline and strike-thru when drawing text grid.
431 {
432 public:
433 /**
434 * \param cellWidth maximum width of a character cell in the text box
435 * \param cellHeight height of a character cell in the text box
436 * \param cellYScale unused
437 * \param shadow true if text box has shadow enabled
438 * \param shadowOffset offset for shadow
439 * \param shadowColor color of shadow in text box
440 * \param underlineOffset offset of underline
441 * \param underlineSize size of underline
442 * \param halo true if text box has halo enabled
443 * \param haloOffset offset for halo
444 * \param haloColor color of halo in text box
445 * \param leftToRight true if text flows left to right else false for right to left
446 */
447 UnderlineStrikeThruHelper( float cellWidth, float cellHeight, float cellYScale, bool shadow, const Vector& shadowOffset, const GlsColor& shadowColor,
448 float underlineOffset, float underlineSize, bool halo, float haloOffset, GlsColor haloColor, bool leftToRight );
449
450 /**
451 * Setup to process a new row in the text box.
452 */
453 void NewRow();
454
455 /**
456 * Pre Process the given character attributes
457 * \param charAttr attributes in question
458 * \param c the character code to process.
459 * \param cellX x coord of character cell
460 * \param charY y coord of character
461 */
462 void PreProcessCharacter( const CharAttr_t& charAttr, const Char_t& c, float cellX, float charY );
463
464 /**
465 * Post Process the given character attributes
466 * \param charAttr attributes in question
467 * \param c the character code to process.
468 * \param cellX x coord of character cell
469 * \param charY y coord of character cell
470 * \param cellWidth the width of the current character
471 * \param endOfLine true if character was the end of the current line
472 */
473 void PostProcessCharacter( const CharAttr_t& charAttr, const Char_t& c, float cellX, float charY, float cellWidth, bool endOfLine );
474
475#ifdef GLES
476 /**
477 * Render the line segments for the underline / strikethru
478 * \param quadStorage The quad storage list to render
479 */
480 void RenderLineSegments( GlsQuadListVC_3D& quadStorage );
481#else
482 /**
483 * Render the line segments for the underline / strikethru
484 */
486#endif
487 /// Sets the underlying shadow visibility flag to false.
489
490 /// Sets the underlying shadow visibility flag to true.
492
493 protected:
494 // cell constants
495 const float _cellWidth; ///< Height of each character cell in the grid in logical units.
496 const float _cellHeight; ///< Width of each character cell in the grid in logical units.
497
498 // shadow constants
499 const bool _shadow; ///< Whether or not the shadow effect is on.
500 const Vector _shadowOffset; ///< Offset of the shadow effect from the characters. Z component is ignored.
501 const GlsColor _shadowColor; ///< Color of the shadow effect behind the characters.
502 bool _allowShadow; ///< Whether or not shadows are being drawn in general.
503
504 // underline constants
505 const float _underlineOffset; ///< Vertical offset of the underline in logical units.
506 const float _underlineSize; ///< Thickness of the underline in logical units.
507
508 // halo constants
509 const bool _halo; ///< Whether or not the halo effect is on.
510 const float _haloOffset; ///< Offset multiplier for the halo effect.
511 const GlsColor _haloColor; ///< Color of the halo effect behind the characters.
512
513 // left to right
514 const bool _leftToRight; ///< If true, characters are rendered left to right, otherwise right to left.
515
516 // state vars for underline processing
517 float _underlineX1; ///< Current underline state left X coordinate.
518 float _underlineX2; ///< Current underline state right X coordinate.
519 float _underlineY; ///< Current underline state Y coordinate.
520 float _underlineScale; ///< Current underline drawing scale.
521 GlsColor _underlineColor; ///< Current underline drawing color.
522 bool _underlineOn; ///< If true, underline drawing is enabled.
523
524 // state vars for strike-thru processing
525 float _strikeX1; ///< Current strike through state left X coordinate.
526 float _strikeX2; ///< Current strike through state right X coordinate.
527 float _strikeY; ///< Current strike through state Y coordinate.
528 float _strikeScale; ///< Current strike through drawing scale.
529 GlsColor _strikeColor; ///< Current strike through drawing color.
530 bool _strikeOn; ///< If true, strike through drawing is enabled.
531
532 // state vars for line processing
533 bool _whiteSpaceYes; ///< If true, the currently processed character is whitespace.
534
535 // line segments to draw
536 typedef std::list<LineSegment_t> LineSegmentCont_t; ///< Typedef for a list of line segments.
537 LineSegmentCont_t _lineSegments; ///< The list of line segments to draw.
538 };
539
540private:
543
544 void OnCellDimensionChanged() DISTI_METHOD_OVERRIDE
545 {
546 _needToRebuild = true;
547 }
548};
549
550/// Stream in operator
551/// \param instr The stream to read from.
552/// \param j The returned value read from the stream.
553/// \return The stream in its current state.
554inline std::istream& operator>>( std::istream& instr, disti::GlsTextBox::Align_t& j )
555{
556 std::string str;
557 instr >> str;
558
559 if( str == "ALIGN_TOP" )
560 {
561 j = disti::GlsTextBox::ALIGN_TOP;
562 }
563 else if( str == "ALIGN_CENTER" )
564 {
565 j = disti::GlsTextBox::ALIGN_CENTER;
566 }
567 else if( str == "ALIGN_BOTTOM" )
568 {
569 j = disti::GlsTextBox::ALIGN_BOTTOM;
570 }
571 return instr;
572}
573
574/// Stream out operator
575/// \param outstr The stream to write to.
576/// \param j The value to write to the stream.
577/// \return The stream in its current state.
578inline std::ostream& operator<<( std::ostream& outstr, disti::GlsTextBox::Align_t j )
579{
580 switch( j )
581 {
582 case disti::GlsTextBox::ALIGN_TOP:
583 outstr << "ALIGN_TOP";
584 break;
585 case disti::GlsTextBox::ALIGN_CENTER:
586 outstr << "ALIGN_CENTER";
587 break;
588 case disti::GlsTextBox::ALIGN_BOTTOM:
589 outstr << "ALIGN_BOTTOM";
590 break;
591 }
592 return outstr;
593}
594
595/// Stream in operator
596/// \param instr The stream to read from.
597/// \param direction The returned value read from the stream.
598/// \return The stream in its current state.
599inline std::istream& operator>>( std::istream& instr, disti::GlsTextBox::ResizeMode_t& direction )
600{
601 std::string str;
602 instr >> str;
603
604 if( str == "RESIZE_MODE_FIXED" )
605 {
606 direction = disti::GlsTextBox::RESIZE_MODE_FIXED;
607 }
608 else if( str == "RESIZE_MODE_AUTO_WIDTH" )
609 {
610 direction = disti::GlsTextBox::RESIZE_MODE_AUTO_WIDTH;
611 }
612 else if( str == "RESIZE_MODE_AUTO_HEIGHT" )
613 {
614 direction = disti::GlsTextBox::RESIZE_MODE_AUTO_HEIGHT;
615 }
616 return instr;
617}
618
619/// Stream out operator
620/// \param outstr The stream to write to.
621/// \param direction The value to write to the stream.
622/// \return The stream in its current state.
623inline std::ostream& operator<<( std::ostream& outstr, disti::GlsTextBox::ResizeMode_t direction )
624{
625 switch( direction )
626 {
627 case disti::GlsTextBox::RESIZE_MODE_FIXED:
628 outstr << "RESIZE_MODE_FIXED";
629 break;
630 case disti::GlsTextBox::RESIZE_MODE_AUTO_WIDTH:
631 outstr << "RESIZE_MODE_AUTO_WIDTH";
632 break;
633 case disti::GlsTextBox::RESIZE_MODE_AUTO_HEIGHT:
634 outstr << "RESIZE_MODE_AUTO_HEIGHT";
635 break;
636 }
637 return outstr;
638}
639
640} // namespace disti
641
642#endif
Definition: cull.h:49
Definition: display.h:95
virtual void PreDraw(const OpenGLMatrices &current, Culler &culler)
virtual void Scale(float px, float py, float pz, Vertex *anchor, int handleBar=0)
Definition: dynamic_array.h:79
Definition: gls_color.h:53
Definition: gls_glo_file.h:1241
Definition: gls_quad_storage.h:156
Definition: gls_quad_storage.h:60
Definition: gls_text_box.h:431
void AllowShadow()
Sets the underlying shadow visibility flag to true.
float _underlineY
Current underline state Y coordinate.
Definition: gls_text_box.h:519
bool _whiteSpaceYes
If true, the currently processed character is whitespace.
Definition: gls_text_box.h:533
bool _allowShadow
Whether or not shadows are being drawn in general.
Definition: gls_text_box.h:502
const float _cellHeight
Width of each character cell in the grid in logical units.
Definition: gls_text_box.h:496
const bool _leftToRight
If true, characters are rendered left to right, otherwise right to left.
Definition: gls_text_box.h:514
bool _strikeOn
If true, strike through drawing is enabled.
Definition: gls_text_box.h:530
bool _underlineOn
If true, underline drawing is enabled.
Definition: gls_text_box.h:522
float _underlineX1
Current underline state left X coordinate.
Definition: gls_text_box.h:517
LineSegmentCont_t _lineSegments
The list of line segments to draw.
Definition: gls_text_box.h:537
float _underlineScale
Current underline drawing scale.
Definition: gls_text_box.h:520
const GlsColor _shadowColor
Color of the shadow effect behind the characters.
Definition: gls_text_box.h:501
const GlsColor _haloColor
Color of the halo effect behind the characters.
Definition: gls_text_box.h:511
const float _underlineOffset
Vertical offset of the underline in logical units.
Definition: gls_text_box.h:505
float _strikeX2
Current strike through state right X coordinate.
Definition: gls_text_box.h:526
UnderlineStrikeThruHelper(float cellWidth, float cellHeight, float cellYScale, bool shadow, const Vector &shadowOffset, const GlsColor &shadowColor, float underlineOffset, float underlineSize, bool halo, float haloOffset, GlsColor haloColor, bool leftToRight)
float _strikeY
Current strike through state Y coordinate.
Definition: gls_text_box.h:527
std::list< LineSegment_t > LineSegmentCont_t
Typedef for a list of line segments.
Definition: gls_text_box.h:536
const bool _shadow
Whether or not the shadow effect is on.
Definition: gls_text_box.h:499
const bool _halo
Whether or not the halo effect is on.
Definition: gls_text_box.h:509
void PostProcessCharacter(const CharAttr_t &charAttr, const Char_t &c, float cellX, float charY, float cellWidth, bool endOfLine)
float _underlineX2
Current underline state right X coordinate.
Definition: gls_text_box.h:518
const float _haloOffset
Offset multiplier for the halo effect.
Definition: gls_text_box.h:510
GlsColor _underlineColor
Current underline drawing color.
Definition: gls_text_box.h:521
const float _underlineSize
Thickness of the underline in logical units.
Definition: gls_text_box.h:506
void PreProcessCharacter(const CharAttr_t &charAttr, const Char_t &c, float cellX, float charY)
const float _cellWidth
Height of each character cell in the grid in logical units.
Definition: gls_text_box.h:495
void IgnoreShadow()
Sets the underlying shadow visibility flag to false.
float _strikeScale
Current strike through drawing scale.
Definition: gls_text_box.h:528
GlsColor _strikeColor
Current strike through drawing color.
Definition: gls_text_box.h:529
float _strikeX1
Current strike through state left X coordinate.
Definition: gls_text_box.h:525
const Vector _shadowOffset
Offset of the shadow effect from the characters. Z component is ignored.
Definition: gls_text_box.h:500
Definition: gls_text_box.h:89
void CopyGeometry(DisplayObject *src) DISTI_METHOD_OVERRIDE
char * FormatVarArgList(const char *format, va_list args)
virtual Align_t VerticalAlignment() const
Definition: gls_text_box.h:214
float _tabSpacing
Space multiplier for tabs.
Definition: gls_text_box.h:350
float _cellWidthRatio
Holds cell width / max char width ratio used for horizontal advance.
Definition: gls_text_box.h:415
void EnablePerCharAttribs()
Enable per character attribute drawing for this grid.
Definition: gls_text_box.h:339
UTF16String _unicodeText
Definition: gls_text_box.h:427
void CopyProperties(DisplayObject *src) DISTI_METHOD_OVERRIDE
bool _leftToRight
true to render characters from left to right else, false for right to left.
Definition: gls_text_box.h:421
virtual void CalculateRowData()
void VerticalAlignment(Align_t justification)
void GetNextRowInfo(const unsigned int strIndex, unsigned int &rowLength, float &rowPixelWidth, unsigned int &nextRowStartIndex) const
virtual unsigned int MaxLinesToDraw()
Align_t
Different text justifications.
Definition: gls_text_box.h:200
float _resizeMaxWidth
The calculated maximum width in logical units based on the current resize behavior.
Definition: gls_text_box.h:424
bool _perCharAttribs
Definition: gls_text_box.h:336
float GetCharWidth(const unsigned short c) const
void SetAvailableAttributes(unsigned int value) DISTI_METHOD_OVERRIDE
void GetCppInterfaceDescriptionFree(InterfaceListType *array) DISTI_METHOD_OVERRIDE
unsigned int _lineCount
Number of rows of characters in the text grid (number of lines).
Definition: gls_text_box.h:410
void VaString(const char *format,...)
void LeftToRight(bool leftToRight)
virtual ResizeMode_t ResizeMode()
void SetVerticesToTextBounds()
Helper function that adjusts the vertices to contain the text based on the resize behavior.
virtual void MaxWidth(float value)
void ClearChars()
Definition: gls_text_box.h:238
void SetVertices(unsigned int nPoints, Vertex *vertices) DISTI_METHOD_OVERRIDE
ResizeMode_t _resizeMode
The current automatic resize behavior.
Definition: gls_text_box.h:423
void Draw() DISTI_METHOD_OVERRIDE
void TabSpacing(float)
void SetString(const char *s)
Definition: gls_text_box.h:253
virtual void ResizeMode(ResizeMode_t value)
float _maxLineLengthPixels
Calculated maximimum line width in "pixels" (logical units).
Definition: gls_text_box.h:417
virtual float MaxHeight()
void Clear()
Definition: gls_text_box.h:229
unsigned int _maxLinesToDraw
Calculated maximum number of lines that can fit.
Definition: gls_text_box.h:419
virtual float MaxWidth()
virtual void MaxHeight(float value)
bool _lineCountChanged
If true, the line count has changed, and row information needs to be rebuilt.
Definition: gls_text_box.h:411
virtual void Initialize()
Sets the initial state of this object.
void Scale(float px, float py, float pz, Vertex *anchor, int handleBar) DISTI_METHOD_OVERRIDE
RowInfo * _rowInfo
Definition: gls_text_box.h:413
void Calculate(double time) DISTI_METHOD_OVERRIDE
DisplayObject * CloneObject(bool generateNames=false) DISTI_METHOD_OVERRIDE
Align_t _verticalAlignment
Justification setting (TOP, CENTER, BOTTOM).
Definition: gls_text_box.h:348
ResizeMode_t
The ResizeMode_t enumeration. Describes the resize behavior of this text object.
Definition: gls_text_box.h:112
float GetMaxLineLengthForResizeMode() const
InterfaceListType * GetCppInterfaceDescription(InterfaceListType *addToThisList=NULL) DISTI_METHOD_OVERRIDE
float _resizeMaxHeight
The calculated maximim height in logical units based on the current resize behavior.
Definition: gls_text_box.h:425
void Rebuild()
Rebuilds this text box layout. This may be an expensive call, so it should only be called when a prop...
float _maxTextHeightPixels
Calculated maximimum height in "pixels" (logical units).
Definition: gls_text_box.h:418
Definition: gls_text.h:152
virtual CharAttr_t CharAttr(unsigned int index) const
Definition: gls_text.h:295
virtual float CellWidth() const
Definition: gls_text.h:272
virtual GlsColor BgColor()
virtual float Baseline()
virtual void Char(Char_t code)
virtual bool Inverse()
virtual float CharSpacing()
bool _needToRebuild
Definition: gls_text.h:701
virtual bool Underline()
virtual GlsColor TextColor()
virtual void SetRebuild()
Definition: gls_text.h:581
virtual float CharScaling()
virtual float CellHeight() const
Definition: gls_text.h:258
virtual bool StrikeThru()
virtual bool FauxBold()
virtual std::string String() const
Definition: gls_text.h:537
GlsFontBase::Char_t Char_t
Typedef shorthand for GlsFontBase::Char_t.
Definition: gls_text.h:158
virtual void Erase()
std::string _text
Definition: gls_text.h:712
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:540
Definition: vertex.h:84
Definition: vertex.h:419
The gls_auto_lib.
Macros and helper code to determine what subset of C++11/14/17 is available.
#define DISTI_SPECIAL_MEM_FUN_DELETE
Macro to wrap function deletion, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:245
#define DISTI_DEPRECATED(msg)
Defines whether this compiler supports the C++14 deprecated attribute.
Definition: gls_cpp_lang_support.h:487
#define DISTI_METHOD_OVERRIDE
Macro to wrap the override keyword, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:221
The gls_gl.
The disti::GlsQuadListVC_3D and GlsQuadListVCT_2D classes.
The disti::GlsStateManager factory class. Creates an instance of a state manager that manages the GL ...
The disti::GlsText class.
#define GLSGEN_GLSTEXTBOX_EXPORT
Provides support for creating DLLs.
Definition: gls_text_box.h:51
Definition: bmpimage.h:46
std::ostream & operator<<(std::ostream &outstr, const AttributeName &name)
std::istream & operator>>(std::istream &instr, GlsColor &color)
std::basic_string< unsigned short, CharTraitsUnsignedShort > UTF16String
A cross platform UTF-16 encoded string.
Definition: util.h:425
Definition: gls_text_box.h:403
unsigned int startingIndex
Definition: gls_text_box.h:404
float pixelWidth
Definition: gls_text_box.h:407
unsigned int length
Definition: gls_text_box.h:406
Attributes for each character position in the grid.
Definition: gls_text.h:177
The DistiUnhideGlobalsDummyClass class.