ADTF Display Toolbox
Loading...
Searching...
No Matches
glfont.h
Go to the documentation of this file.
1
7#pragma once
8
9#ifdef WIN32
10 #include <windows.h>
11 #include <gl/GL.h>
12 #include <gl/GLU.h>
13#else
14 #include <GL/gl.h>
15 #include <GL/glu.h>
16 #include <fontconfig/fontconfig.h>
17#endif
18
19#include <ft2build.h>
20#include FT_FREETYPE_H
21
22#include <adtf_base.h>
24#include <adtf_platform_inc.h>
25
26#define _USE_MATH_DEFINES
27#include <cmath>
28#ifndef M_PI
29namespace
30{
31const double M_PI = std::acos(-1.0);
32const double M_PI_2 = M_PI / 2.0;
33} // namespace
34#endif
35#include <stdio.h>
36
37#ifdef max
38 #undef max
39#endif
40#include <algorithm>
41
42namespace adtf
43{
44
45namespace disptb
46{
47
48namespace graphicslib
49{
50
51namespace dengar
52{
53
54class cGLCanvas;
55
61class cGLFont : public IFont
62{
63protected:
64 static FT_Library g_hFreeTypeLibrary;
65 static tInt g_nLibraryRefCount;
66 static const tInt g_nCharsetSize = 128;
67
68protected:
69 FT_Face m_hFace;
70 GLuint* m_hTextures;
72 tInt m_nHeight;
73 tInt m_aCharWidth[256];
74
75 static constexpr tInt m_nTextureScale = 8;
76
78 tBool m_bOpposedYAxis;
79 tBool m_bScaleWithCoordinateSystem;
80 tBool m_bRotationWithCoordinateSystem;
81 tBool m_bTextBaselineOnTop;
83
84public:
90 {
92
93 m_hTextures = NULL;
95 m_hFace = NULL;
96 m_bOpposedYAxis = tFalse;
97 m_bRotationWithCoordinateSystem = tFalse;
98 m_bScaleWithCoordinateSystem = tFalse;
99 m_bTextBaselineOnTop = tFalse;
100 }
101
107 {
108 CleanUp();
109
111 }
112
118 static tResult Initialize()
119 {
120 if (g_nLibraryRefCount == 0)
121 {
122 FT_Error l_nError = FT_Init_FreeType(&g_hFreeTypeLibrary);
123 if (l_nError != 0)
124 {
125 g_hFreeTypeLibrary = NULL;
126 RETURN_ERROR(ERR_UNKNOWN);
127 }
128 }
129
130 g_nLibraryRefCount++;
131
132 RETURN_NOERROR;
133 }
134
140 static tResult Uninitialize()
141 {
142 if (g_nLibraryRefCount > 0)
143 {
144 g_nLibraryRefCount--;
145
146 if (g_nLibraryRefCount == 0)
147 {
148 if (g_hFreeTypeLibrary != NULL)
149 {
150 FT_Done_FreeType(g_hFreeTypeLibrary);
151 g_hFreeTypeLibrary = NULL;
152 }
153 }
154 }
155
156 RETURN_NOERROR;
157 }
158
169 tResult Create(const cGLCanvas* /*pCanvas*/, const char* strFilename, tInt nHeight, tStyle eFontStyle)
170 {
171 if (g_hFreeTypeLibrary == NULL)
172 {
173 RETURN_ERROR(ERR_UNKNOWN);
174 }
175
176 char l_strFontPath[MAX_PATH];
177
178#ifdef WIN32
179 char l_strWinDir[MAX_PATH];
180 char l_strPhysPath[MAX_PATH];
181
182 if (strchr(strFilename, '.') != NULL)
183 {
184 adtf::util::cStringUtil::Copy(l_strPhysPath, strFilename, tSize(-1), tSize(MAX_PATH));
185 }
186 else
187 {
188 // filename actually is the family name ?
189 if (!_fnLookupFontFile(strFilename, l_strPhysPath))
190 {
191 adtf::util::cStringUtil::Copy(l_strPhysPath, strFilename, MAX_PATH - 5);
192 strcat_s(l_strPhysPath, MAX_PATH, ".ttf");
193 }
194 }
195
196 ::GetSystemWindowsDirectory(l_strWinDir, sizeof(l_strWinDir));
197 sprintf_s(l_strFontPath, MAX_PATH, "%s\\Fonts\\%s", l_strWinDir, l_strPhysPath);
198#else
199
200 FcInit();
201 FcPattern* psPat = FcNameParse((FcChar8*) strFilename);
202 FcConfigSubstitute(0, psPat, FcMatchPattern);
203 FcDefaultSubstitute(psPat);
204
205 FcFontSet* psFs = FcFontSetCreate();
206 FcResult sResult;
207 FcPattern* psMatch = FcFontMatch(0, psPat, &sResult);
208 if (psMatch)
209 {
210 FcFontSetAdd(psFs, psMatch);
211 }
212
213 FcPatternDestroy(psPat);
214
215 FcChar8* strFile;
216 if (psFs->nfont > 0 && FcPatternGetString(psFs->fonts[0], FC_FILE, 0, &strFile) == FcResultMatch)
217 {
218 adtf::util::cStringUtil::Copy(l_strFontPath, (const tChar*) strFile, -1, MAX_PATH);
219 }
220 else
221 l_strFontPath[0] = 0;
222
223 FcFontSetDestroy(psFs);
224#endif
225
226 tInt l_nError;
227 l_nError = FT_New_Face(g_hFreeTypeLibrary, l_strFontPath, 0, &m_hFace);
228 if (l_nError)
229 {
230 // FT_Err_Cannot_Open_Resource
231 RETURN_ERROR(ERR_UNKNOWN);
232 }
233
234 m_nHeight = nHeight * 64;
235
236 FT_Set_Char_Size(m_hFace, nHeight << 6, nHeight << 6, 96 * m_nTextureScale, 96 * m_nTextureScale);
237
238 m_hTextures = new GLuint[g_nCharsetSize];
239 if (m_hTextures == NULL)
240 {
241 RETURN_ERROR(ERR_MEMORY);
242 }
243
244 m_nTextureBase = glGenLists(g_nCharsetSize);
245 glGenTextures(g_nCharsetSize, m_hTextures);
246
247 for (tInt c = 0; c < g_nCharsetSize; c++)
248 {
249 BuildDisplayList((char) c, eFontStyle);
250 }
251
252 FT_Done_Face(m_hFace);
253 m_hFace = NULL;
254
255 RETURN_NOERROR;
256 }
257
263 tResult CleanUp()
264 {
265 if (m_nTextureBase > 0)
266 {
267 glDeleteLists(m_nTextureBase, g_nCharsetSize);
268 glDeleteTextures(g_nCharsetSize, m_hTextures);
269
270 m_nTextureBase = 0;
271 }
272
273 if (m_hTextures != NULL)
274 {
275 delete[] m_hTextures;
276 m_hTextures = NULL;
277 }
278
279 RETURN_NOERROR;
280 }
281
291 void Print(tInt x, tInt y, tFloat64 fAngle, const char* strFormat, va_list ArgList)
292 {
293 PrintImpl(1, (tFloat32) x, (tFloat32) y, fAngle, strFormat, ArgList);
294 }
295
305 void Print(tFloat32 x, tFloat32 y, tFloat64 fAngle, const char* strFormat, va_list ArgList)
306 {
307 PrintImpl(0, x, y, fAngle, strFormat, ArgList);
308 }
309
317 tVoid FlipTextHorizontally(tBool bOpposedYAxis)
318 {
319 m_bOpposedYAxis = bOpposedYAxis;
320 }
321
328 tVoid TextScaleWithCoordinateSystem(tBool bScaleWithCoordinateSystem)
329 {
330 m_bScaleWithCoordinateSystem = bScaleWithCoordinateSystem;
331 };
332
339 tVoid TextRotateWithCoordinateSystem(tBool bRotateWithCoordinateSystem)
340 {
341 m_bRotationWithCoordinateSystem = bRotateWithCoordinateSystem;
342 };
343
350 tVoid TextBaselineOnTop(tBool bTextBaselineOnTop)
351 {
352 m_bTextBaselineOnTop = bTextBaselineOnTop;
353 };
354
355public: // Implements IFont
357 tResult Release()
358 {
359 CleanUp();
360
361 delete this;
362
363 RETURN_NOERROR;
364 }
365
366 tInt GetHeight() const
367 {
368 return m_nHeight;
369 }
370
371 tBool MeasureText(const char* str, tInt& nWidth, tInt& nHeight) const
372 {
373 if (str == NULL)
374 {
375 return tFalse;
376 }
377
378 tInt nMaxWidth = 0;
379 tInt nCurWidth = 0;
380 tInt nLineCount = 0;
381
382 do
383 {
384 if (*str == '\n' || *str == 0)
385 {
386 nMaxWidth = std::max(nMaxWidth, nCurWidth);
387 nCurWidth = 0;
388 nLineCount++;
389 }
390 else
391 {
392 nCurWidth += m_aCharWidth[static_cast<tInt>(*str)];
393 }
394 } while (*str++);
395
396 nWidth = nMaxWidth / 64;
397 tFloat32 fLineHeight = (tFloat32) m_nHeight / 0.63f;
398 nHeight = (tInt) (nLineCount * fLineHeight / 64.0f);
399 return tTrue;
400 }
402
403protected:
412 tResult BuildDisplayList(char ch, tStyle eFontStyle)
413 {
414 tInt l_nError;
415
416 // The First Thing We Do Is Get FreeType To Render Our Character
417 // Into A Bitmap. This Actually Requires A Couple Of FreeType Commands:
418
419 // Load The Glyph For Our Character.
420 l_nError = FT_Load_Glyph(m_hFace, FT_Get_Char_Index(m_hFace, ch), FT_LOAD_DEFAULT);
421 if (l_nError)
422 {
423 RETURN_ERROR(ERR_UNKNOWN);
424 }
425
426 FT_Render_Mode l_nRenderMode;
427 switch (eFontStyle)
428 {
430 {
431 l_nRenderMode = FT_RENDER_MODE_NORMAL;
432 break;
433 }
434 case STYLE_Mono:
435 {
436 l_nRenderMode = FT_RENDER_MODE_MONO;
437 break;
438 }
439 default:
440 {
441 l_nRenderMode = FT_RENDER_MODE_NORMAL;
442 break;
443 }
444 }
445
446 l_nError = FT_Render_Glyph(m_hFace->glyph, l_nRenderMode);
447 if (l_nError)
448 {
449 RETURN_ERROR(ERR_UNKNOWN);
450 }
451
452 FT_GlyphSlot slot = m_hFace->glyph;
453 FT_Bitmap& bitmap = slot->bitmap;
454
455 // Use Our Helper Function To Get The Widths Of
456 // The Bitmap Data That We Will Need In Order To Create
457 // Our Texture.
458 int width = _fnGetNextPowerOfTwo(bitmap.width);
459 int height = _fnGetNextPowerOfTwo(bitmap.rows);
460
461 // Allocate Memory For The Texture Data.
462 GLubyte* l_pTextureBuffer = new GLubyte[2 * width * height];
463
464 tInt l_nValue;
465 if (bitmap.pixel_mode == FT_PIXEL_MODE_MONO)
466 {
467 tInt l_nSrc;
468 tInt l_nMask;
469 for (int j = 0; j < height; j++)
470 {
471 for (int i = 0; i < width; i++)
472 {
473 if (i < bitmap.width && j < bitmap.rows)
474 {
475 l_nSrc = bitmap.buffer[i / 8 + bitmap.pitch * j];
476 l_nMask = (1 << (7 - (i % 8)));
477 l_nValue = ((l_nSrc & l_nMask) != 0) ? 255 : 0;
478 }
479 else
480 {
481 l_nValue = 0;
482 }
483
484 l_pTextureBuffer[2 * (i + j * width)] = l_pTextureBuffer[2 * (i + j * width) + 1] =
485 (GLubyte) l_nValue;
486 }
487 }
488 }
489 else if (bitmap.pixel_mode == FT_PIXEL_MODE_GRAY)
490 {
491 for (int j = 0; j < height; j++)
492 {
493 for (int i = 0; i < width; i++)
494 {
495 if (i < bitmap.width && j < bitmap.rows)
496 {
497 l_nValue = bitmap.buffer[i + bitmap.pitch * j];
498 }
499 else
500 {
501 l_nValue = 0;
502 }
503
504 l_pTextureBuffer[2 * (i + j * width)] = l_pTextureBuffer[2 * (i + j * width) + 1] =
505 (GLubyte) l_nValue;
506 }
507 }
508 }
509 else
510 {
511 RETURN_ERROR(ERR_NOT_SUPPORTED);
512 }
513
514 glEnable(GL_TEXTURE_2D);
515
516 // Now We Just Setup Some Texture Parameters.
517 glBindTexture(GL_TEXTURE_2D, m_hTextures[static_cast<tInt>(ch)]);
518 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
519 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
520 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
521 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
522
523 // Here We Actually Create The Texture Itself, Notice
524 // That We Are Using GL_LUMINANCE_ALPHA To Indicate That
525 // We Are Using 2 Channel Data.
526 gluBuild2DMipmaps(GL_TEXTURE_2D, 2, width, height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, l_pTextureBuffer);
527
528 // With The Texture Created, We Don't Need The Expanded Data Anymore.
529 delete[] l_pTextureBuffer;
530
531 // Now We Create The Display List
532 glNewList(m_nTextureBase + ch, GL_COMPILE);
533 glBindTexture(GL_TEXTURE_2D, m_hTextures[static_cast<tInt>(ch)]);
534 glPushMatrix();
535
536 // First We Need To Move Over A Little So That
537 // The Character Has The Right Amount Of Space
538 // Between It And The One Before It.
539 glTranslatef((GLfloat) slot->bitmap_left, 0.0f, 0.0f);
540
541 // Now We Move Down A Little In The Case That The
542 // Bitmap Extends Past The Bottom Of The Line
543 // This Is Only True For Characters Like 'g' Or 'y'.
544 glTranslatef(0.0f, (GLfloat) bitmap.rows - slot->bitmap_top, 0.0f);
545
546 // Now We Need To Account For The Fact That Many Of
547 // Our Textures Are Filled With Empty Padding Space.
548 // We Figure What Portion Of The Texture Is Used By
549 // The Actual Character And Store That Information In
550 // The x And y Variables, Then When We Draw The
551 // Quad, We Will Only Reference The Parts Of The Texture
552 // That Contains The Character Itself.
553 float u = (float) bitmap.width / (float) width;
554 float v = (float) bitmap.rows / (float) height;
555
556 // Here We Draw The Texturemapped Quads.
557 // The Bitmap That We Got From FreeType Was Not
558 // Oriented Quite Like We Would Like It To Be,
559 // But We Link The Texture To The Quad
560 // In Such A Way That The Result Will Be Properly Aligned.
561
562 tInt cx = bitmap.width;
563 tInt cy = bitmap.rows;
564
565 tInt l_nFontHeight = ((slot->metrics.vertAdvance + 63) / 64);
566
567 glBegin(GL_QUADS);
568 glNormal3f(0.0f, 0.0f, -1.0f);
569 glTexCoord2d(0, 0);
570 glVertex2i(0, l_nFontHeight - cy - 1);
571 glTexCoord2d(0, v);
572 glVertex2i(0, l_nFontHeight - 1);
573 glTexCoord2d(u, v);
574 glVertex2i(cx, l_nFontHeight - 1);
575 glTexCoord2d(u, 0);
576 glVertex2i(cx, l_nFontHeight - cy - 1);
577 glEnd();
578
579 glPopMatrix();
580 glTranslatef((GLfloat) (m_hFace->glyph->advance.x) / 64.0f, 0.0f, 0.0f);
581
582 m_aCharWidth[static_cast<tInt>(ch)] = m_hFace->glyph->advance.x;
583 // Increment The Raster Position As If We Were A Bitmap Font.
584 // (Only Needed If You Want To Calculate Text Length)
585 // glBitmap(0,0,0,0,face->glyph->advance.x >> 6,0,NULL);
586
587 // Finish The Display List
588 glEndList();
589
590 glDisable(GL_TEXTURE_2D);
591
592 RETURN_NOERROR;
593 }
594
605 void PrintImpl(tUInt32 ui32Flags, tFloat32 x, tFloat32 y, tFloat64 fAngle, const char* strFormat, va_list ArgList)
606 {
607 tBool bUseIntCoords = (ui32Flags != 0);
608
609 // We Make The Height A Little Bigger. There Will Be Some Space Between Lines.
610 tFloat32 fLineHeight = (tFloat32) m_nHeight / 0.63f;
611 tChar strBuffer[4096]; // Holds Our String
612
613 if (strFormat == NULL) // If There's No Text
614 {
615 *strBuffer = 0; // Do Nothing
616 }
617 else
618 {
619#ifdef WIN32
620 vsprintf_s(strBuffer, 4096, strFormat, ArgList);
621#else
622 vsprintf(strBuffer, strFormat, ArgList);
623#endif
624 }
625
626 const char* start_line = strBuffer;
627 std::vector<std::string> lines;
628 const tChar* ptr;
629 for (ptr = strBuffer; *ptr != '\0'; ptr++)
630 {
631 if (*ptr == '\n')
632 {
633 std::string line;
634 for (const tChar* ptr2 = start_line; ptr2 < ptr; ptr2++)
635 {
636 line.append(1, *ptr2); // append char
637 }
638
639 lines.push_back(line);
640
641 start_line = ptr + 1;
642 }
643 }
644
645 if (start_line)
646 {
647 std::string line;
648 for (const tChar* ptr2 = start_line; ptr2 < ptr; ptr2++)
649 {
650 line.append(1, *ptr2);
651 }
652
653 lines.push_back(line);
654 }
655
656 glPushAttrib(GL_LIST_BIT | GL_CURRENT_BIT | GL_ENABLE_BIT | GL_TRANSFORM_BIT);
657 glMatrixMode(GL_MODELVIEW);
658 glEnable(GL_TEXTURE_2D);
659
660 // In case Alpha Blending was not enabled we do not need to disable it again
661 // because glPopAttrib will do it for us (see flags GL_ENABLE_BIT)
662 if (!glIsEnabled(GL_BLEND))
663 {
664 glEnable(GL_BLEND);
665 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
666 }
667
668 glListBase(m_nTextureBase);
669
670 {
671 glPushMatrix();
672
673 // Apply translation first
674 glTranslated(x, y, 0.0);
675
676 if (!m_bScaleWithCoordinateSystem || !m_bRotationWithCoordinateSystem)
677 {
678 // compute the projected position of the text's origin point
679
680 GLdouble modelview[16];
681 glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
682
683 // Extract scalation from the ModelMatrix
684 GLdouble fScaleX = sqrt(modelview[0] * modelview[0] + modelview[4] * modelview[4]);
685
686 GLdouble fScaleY = sqrt(modelview[1] * modelview[1] + modelview[5] * modelview[5]);
687 glLoadIdentity();
688
689 glTranslated(modelview[12], modelview[13], modelview[14]);
690
691 if (m_bRotationWithCoordinateSystem)
692 {
693 // Extract rotation from the ModelMatrix
694 GLdouble fRotation = atan2(modelview[1] / fScaleX, modelview[0] / fScaleY);
695 // Set rotation
696 glRotated(fRotation / M_PI * 180, 0, 0, 1);
697 }
698
699 if (m_bScaleWithCoordinateSystem)
700 {
701 // Set scalation
702 glScaled(fScaleX, fScaleY, 0.0);
703 }
704 }
705
706 if (!m_bOpposedYAxis)
707 {
708 // Flip horizontally first, BuildDisplayList assumes (0,1,0) = UP
709 glRotated(180.0, 1.0, 0.0, 0.0);
710 }
711
712 // Rotate whole text block to requested orientation
713 glRotated(fAngle, 0.0, 0.0, 1.0);
714
715 // Revert internal supersampling
716 glScaled(1.0 / m_nTextureScale, 1.0 / m_nTextureScale, 1);
717 }
718
719 for (int i = 0; i < (int) lines.size(); i++)
720 {
721 const tChar* strLine = lines[i].c_str();
722 tInt nLineLen = (tInt) lines[i].length();
723
724 // Align to either top or bottom of text block
725 int iLineCorrection = m_bTextBaselineOnTop ? 0 : static_cast<int>(lines.size());
726 GLdouble fLineOffset = (fLineHeight * (i - iLineCorrection)) * m_nTextureScale / 64;
727
728 if (bUseIntCoords)
729 {
730 fLineOffset = static_cast<GLdouble>(static_cast<tInt>(fLineOffset));
731 }
732
733 glPushMatrix();
734
735 glTranslated(0.0, fLineOffset, 0.0);
736
737 // output line of text
738 glCallLists(nLineLen, GL_UNSIGNED_BYTE, strLine);
739
740 glPopMatrix();
741 }
742
743 glPopMatrix();
744
745 glPopAttrib();
746 }
747
748 static inline bool _fnLookupFontFile(const char* strFamily, char* strFilenameBuffer)
749 {
750 bool bResult = false;
751
752#ifdef WIN32
753 if (strFamily == NULL)
754 {
755 return false;
756 }
757
758 int nFamilyLen = (int) adtf::util::cStringUtil::GetLength(strFamily);
759
760 HKEY hKey = NULL;
761 RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts", &hKey);
762
763 char strValueBuffer[512];
764 DWORD dwValueBufferSize;
765 DWORD dwType;
766 char strDataBuffer[512];
767 DWORD dwDataBufferSize;
768 LONG nResult;
769 DWORD nIdx = 0;
770
771 while (tTrue)
772 {
773 dwValueBufferSize = sizeof(strValueBuffer);
774 dwType = 0;
775 dwDataBufferSize = sizeof(strDataBuffer);
776
777 nResult = RegEnumValue(hKey, nIdx, strValueBuffer, &dwValueBufferSize, NULL, &dwType, (BYTE*) strDataBuffer,
778 &dwDataBufferSize);
779 if (nResult != ERROR_SUCCESS)
780 {
781 break;
782 }
783
784 if (dwType == REG_SZ)
785 {
786 if (_strnicmp(strFamily, strValueBuffer, nFamilyLen) == 0)
787 {
788 adtf::util::cStringUtil::Copy(strFilenameBuffer, strDataBuffer);
789 bResult = tTrue;
790 break;
791 }
792 }
793
794 nIdx++;
795 }
796
797 RegCloseKey(hKey);
798
799#else
800 // not implemented outside WIN32
801#endif
802
803 return bResult;
804 }
805
806 static inline int _fnGetNextPowerOfTwo(int a)
807 {
808 int rval = 2;
809 while (rval < a)
810 {
811 rval <<= 1;
812 }
813
814 return rval;
815 }
816};
817
818inline FT_Library cGLFont::g_hFreeTypeLibrary = NULL;
819inline tInt cGLFont::g_nLibraryRefCount = 0;
820
821} // namespace dengar
822
823using dengar::cGLFont;
824} // namespace graphicslib
825
826} // namespace disptb
827
828} // namespace adtf
Default Font handling interface for basic font support.
tStyle
The enumeration marks the style of the font.
@ STYLE_Antialiased
the font supports anti aliased.
virtual tResult Release()=0
Releases the font.
virtual tBool MeasureText(const tChar *str, tInt &nWidth, tInt &nHeight) const =0
The methods returns the measurement of the text in nWidth and nHeight.
virtual tInt GetHeight() const =0
This function returns the height of the font in point.
static tResult Uninitialize()
Uninitialize the font.
Definition glfont.h:140
GLuint m_nTextureBase
Base address of texture array.
Definition glfont.h:71
tVoid FlipTextHorizontally(tBool bOpposedYAxis)
Set the text direction with or opposed the x-axis direction.
Definition glfont.h:317
tInt m_aCharWidth[256]
Character width.
Definition glfont.h:73
tVoid TextScaleWithCoordinateSystem(tBool bScaleWithCoordinateSystem)
Set the text to scale with the coordinatesystem.
Definition glfont.h:328
GLuint * m_hTextures
Texture array.
Definition glfont.h:70
tResult BuildDisplayList(char ch, tStyle eFontStyle)
Creates a display list for the given character.
Definition glfont.h:412
static tResult Initialize()
Initialize the font.
Definition glfont.h:118
tVoid TextRotateWithCoordinateSystem(tBool bRotateWithCoordinateSystem)
Set the text to rotate with the coordinatesystem.
Definition glfont.h:339
void Print(tInt x, tInt y, tFloat64 fAngle, const char *strFormat, va_list ArgList)
Print a string onto the screen.
Definition glfont.h:291
tResult CleanUp()
Clean up the font.
Definition glfont.h:263
void Print(tFloat32 x, tFloat32 y, tFloat64 fAngle, const char *strFormat, va_list ArgList)
Print a string onto the screen.
Definition glfont.h:305
tVoid TextBaselineOnTop(tBool bTextBaselineOnTop)
Set the text baseline on the top of the text.
Definition glfont.h:350
static constexpr tInt m_nTextureScale
Super sampling of internal texture.
Definition glfont.h:75
tResult Create(const cGLCanvas *, const char *strFilename, tInt nHeight, tStyle eFontStyle)
Creates a font based on the given parameters.
Definition glfont.h:169
void PrintImpl(tUInt32 ui32Flags, tFloat32 x, tFloat32 y, tFloat64 fAngle, const char *strFormat, va_list ArgList)
Internal print implementation.
Definition glfont.h:605
Copyright © Audi Electronics Venture GmbH.
Namespace for functionality provided by the Display Toolbox.
Main namespace.