Free Electron
FontOpenGL.h
Go to the documentation of this file.
1 
2 /* Copyright (C) 2003-2021 Free Electron Organization
3  Any use of this software requires a license. If a valid license
4  was not distributed with this file, visit freeelectron.org. */
5 
6 /** @file */
7 
8 #ifndef __opengl_FontOpenGL_h__
9 #define __opengl_FontOpenGL_h__
10 
11 namespace fe
12 {
13 namespace ext
14 {
15 
16 /**************************************************************************//**
17  @brief OpenGL-specific implementations for FontI
18 
19  @ingroup opengl
20 *//***************************************************************************/
21 class FE_DL_EXPORT FontOpenGL: public FontI,
22  public Initialize<FontOpenGL>
23 {
24  public:
25  FontOpenGL(void);
26 virtual ~FontOpenGL(void);
27 
28  void initialize(void);
29 
30 virtual I32 fontHeight(I32* a_pAscent,I32* a_pDescent)
31  {
32  if(a_pAscent)
33  {
34  *a_pAscent=m_fontAscent;
35  }
36  if(a_pDescent)
37  {
38  *a_pDescent=m_fontDescent;
39  }
40 
41  return m_fontAscent+m_fontDescent;
42  }
43 virtual I32 pixelWidth(String a_string)
44  {
45 #if FE_2DGL==FE_2D_X_GFX
46  return XTextWidth(m_pFontStruct,
47  a_string.c_str(),a_string.length());
48 #else
49  //* TODO Win32
50  return 0;
51 #endif
52  }
53 
54 virtual void drawAlignedText(sp<Component> a_spDrawComponent,
55  const SpatialVector& a_location,
56  const String a_text,const Color &a_color);
57 
58  private:
59 
60  I32 m_fontBase;
61  I32 m_fontRange;
62  I32 m_fontAscent;
63  I32 m_fontDescent;
64 #if FE_2DGL==FE_2D_X_GFX
65  XFontStruct* m_pFontStruct;
66 #endif
67 
68  Real m_multiplication;
69 };
70 
71 } /* namespace ext */
72 } /* namespace fe */
73 
74 #endif /* __opengl_FontOpenGL_h__ */
const FESTRING_I8 * c_str(void) const
Return the contents of the 8-bit buffer cast as signed bytes.
Definition: String.h:352
kernel
Definition: namespace.dox:3
OpenGL-specific implementations for FontI.
Definition: FontOpenGL.h:21
General interface to a window.
Definition: FontI.h:20
Per-class participation in the Initialized <> mechanism.
Definition: Initialized.h:117
Special vector for color (RGBA)
Definition: Color.h:21
Automatically reference-counted string container.
Definition: String.h:128
Intrusive Smart Pointer.
Definition: src/core/ptr.h:53
U32 length(void) const
Return the number of represented characters, but not necessarily the size of any buffer.
Definition: String.h:662