Guiliani  Version 2.5 revision 7293 (documentation build 13)
FntWrap.h
1/*
2* Copyright (C) TES Electronic Solutions GmbH,
3* All Rights Reserved.
4* Contact: info@guiliani.de
5*
6* This file is part of the Guiliani HMI framework
7* for the development of graphical user interfaces on embedded systems.
8*/
9
10#ifndef __FNT_WRAP__H__
11#define __FNT_WRAP__H__
12
13#include "eC_Types.h"
14#include "GUIFontResource.h"
15
16#include "GUIText.h"
17#include "GUITrace.h"
18#include "GUICommonEnums.h"
19
21class eC_String;
22
24
36{
37 friend class CGUIComponentManager;
38
39public:
44 {
45 FNT_NORMAL = 0,
46 FNT_ITALIC = 1,
47 FNT_UNDERLINED = 2,
48 FNT_BOLD = 4
49 };
50
54 static void DeleteInstance();
55
59 typedef struct
60 {
61 eC_Value vWidth;
62 eC_Value vHeight;
64
65public:
69 {
72 };
73
74public:
80 virtual void Text(const eC_Value& vX1, const eC_Value& vY1, const eC_String * const lpString) = 0;
81
82 // ---------------------------------------------------------------
83 // Font-access
84 // ---------------------------------------------------------------
85
89 virtual void SetFont(const FontResource_t &eID);
90
94 virtual void SetFontSpacing(const eC_Float &fSpacing);
95
100 virtual void GetGlyphMetrics(const eC_Char cChar, GlyphMetrics_t& kMetrics) {}
101
107 virtual void RequiredSpace(const eC_String * const pkText, eC_Value& vWidth, eC_Value& vHeight) = 0;
108
115 virtual void FittingNumChars(const eC_String * const pkText, eC_Value vWidthMax, eC_UInt &uiNumChars, const eC_Bool& bStartAtEnd = false);
116
121 virtual eC_Int GetAscender() const
122 {
123 return 0;
124 }
125
130 virtual eC_Int GetDescender() const
131 {
132 return 0;
133 }
134
139 virtual eC_Int GetInternalLeading() const
140 {
141 return 0;
142 }
143
151 void ChangeFont(const FontResource_t &eFontID,
152 const eC_String& pcPath,
153 const eC_UInt uiFontSize,
154 const GUIFont_t &eFontStyle);
155
161 virtual void LoadFont(const FontResource_t &eFontID) {}
162
166 virtual void UnloadFont(const FontResource_t &eFontID) {}
167
176 virtual eC_Bool SetNOFFonts(const eC_UInt uiNOFFonts);
177
181 virtual eC_UInt GetNOFFonts()
182 {
183 return m_uiNOFFonts;
184 }
185
192 virtual eC_Value GetTextXPosAdjustment(const CGUIText::HorAligned_t eHorAlignment)
193 {
194 return 0;
195 }
196
203 virtual eC_Value GetTextYPosAdjustment(const CGUIText::VerAligned_t eVerAlignment)
204 {
205 return 0;
206 }
207
212 {
213 m_eRotation = eRotation;
214 }
215
220 {
221 return m_eRotation;
222 }
223
224protected:
227
229 virtual ~CFntWrap();
230
231protected:
234
236 eC_Value m_vSpacing;
237
240
243
244 private:
248 CFntWrap(const CFntWrap& kSource);
249
253 CFntWrap& operator=(const CFntWrap& kSource);
254};
255#endif
Helper Macros in Guiliani
FontResource_t
List of font resource ids.
Definition: GUIFontResource.h:54
The font wrapper base class.
Definition: FntWrap.h:36
virtual eC_Value GetTextXPosAdjustment(const CGUIText::HorAligned_t eHorAlignment)
Definition: FntWrap.h:192
virtual ~CFntWrap()
Destructor.
virtual eC_Int GetInternalLeading() const
Definition: FntWrap.h:139
virtual void Text(const eC_Value &vX1, const eC_Value &vY1, const eC_String *const lpString)=0
CGUICommonEnums::Rotation_t GetRotation() const
Definition: FntWrap.h:219
CGUICommonEnums::Rotation_t m_eRotation
Rotation.
Definition: FntWrap.h:242
virtual void FittingNumChars(const eC_String *const pkText, eC_Value vWidthMax, eC_UInt &uiNumChars, const eC_Bool &bStartAtEnd=false)
virtual eC_Bool SetNOFFonts(const eC_UInt uiNOFFonts)
virtual void SetFont(const FontResource_t &eID)
virtual void LoadFont(const FontResource_t &eFontID)
Definition: FntWrap.h:161
FontResource_t m_eCurFont
Current font id.
Definition: FntWrap.h:233
virtual eC_UInt GetNOFFonts()
Definition: FntWrap.h:181
TextOperation_t
Definition: FntWrap.h:69
@ RENDER_TEXT
render the text
Definition: FntWrap.h:70
@ GET_REQUIRED_SPACE
get required space for text
Definition: FntWrap.h:71
eC_Value m_vSpacing
Font spacing, i.e the space between letters.
Definition: FntWrap.h:236
static void DeleteInstance()
GUIFont_t
Definition: FntWrap.h:44
CFntWrap()
Constructor.
virtual void GetGlyphMetrics(const eC_Char cChar, GlyphMetrics_t &kMetrics)
Definition: FntWrap.h:100
virtual void UnloadFont(const FontResource_t &eFontID)
Definition: FntWrap.h:166
eC_UInt m_uiNOFFonts
Total number of fonts.
Definition: FntWrap.h:239
virtual void SetFontSpacing(const eC_Float &fSpacing)
void SetRotation(const CGUICommonEnums::Rotation_t &eRotation)
Definition: FntWrap.h:211
virtual void RequiredSpace(const eC_String *const pkText, eC_Value &vWidth, eC_Value &vHeight)=0
virtual eC_Value GetTextYPosAdjustment(const CGUIText::VerAligned_t eVerAlignment)
Definition: FntWrap.h:203
virtual eC_Int GetDescender() const
Definition: FntWrap.h:130
void ChangeFont(const FontResource_t &eFontID, const eC_String &pcPath, const eC_UInt uiFontSize, const GUIFont_t &eFontStyle)
virtual eC_Int GetAscender() const
Definition: FntWrap.h:121
Rotation_t
Enumaration for Rotation.
Definition: GUICommonEnums.h:129
central component-manager
Definition: GUIComponentManager.h:62
Base class for all platform-specific render targets.
Definition: GUIRenderTarget.h:17
HorAligned_t
Possible horizontal alignments.
Definition: GUIText.h:124
VerAligned_t
Possible vertical alignments.
Definition: GUIText.h:116
Definition: FntWrap.h:60
eC_Value vWidth
width of glyph
Definition: FntWrap.h:61
eC_Value vHeight
height of glyph
Definition: FntWrap.h:62