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