[dali_1.0.31] Merge branch 'tizen'
[platform/core/uifw/dali-core.git] / dali / internal / event / text / glyph-metric.h
1 #ifndef __DALI_INTERNAL_GLYPH_METRIC_H__
2 #define __DALI_INTERNAL_GLYPH_METRIC_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21
22 // EXTERNAL INCLUDES
23 #include <stdint.h> // for uint32_t
24
25 namespace Dali
26 {
27
28 namespace Internal
29 {
30
31
32 /**
33  * Structure that contains the glyph metrics
34  * Font-Metrics class will create and and own this class.
35  * All data members are plain old data, so compiler generated copy constructor
36  * and assignment operator are used.
37  *
38  *
39  */
40 struct GlyphMetric
41 {
42
43   /**
44    * Constructor
45    */
46   GlyphMetric();
47
48
49   /**
50    * Constructor
51    */
52   GlyphMetric( uint32_t characterCode,
53                float    width,
54                float    height,
55                float    top,
56                float    left,
57                float    xAdvance);
58
59   /**
60    * non-virtual destructor.
61    */
62   ~GlyphMetric();
63
64   /**
65    * Helper to return the character code of the glyph
66    * @return character code
67    */
68   uint32_t GetCharacterCode() const;
69
70   /**
71    * @return width of character
72    */
73   float GetWidth() const;
74
75   /**
76    * @return height of character
77    */
78   float GetHeight() const;
79
80   /**
81    * @return top of character
82    */
83   float GetTop() const;
84
85   /**
86    * @return left position of character
87    */
88   float GetLeft() const;
89
90   /**
91    * @return x advance of character
92    */
93   float GetXAdvance() const;
94
95 private:
96
97   uint32_t mCode;        ///< character code (UTF-32), max value of 0x10ffff (21 bits)
98   float    mWidth;       ///< glyph width in pixels
99   float    mHeight;      ///< glyph height in pixels
100   float    mTop;         ///< distance between glyph's tallest pixel and baseline
101   float    mLeft;        ///< where to place the glyph horizontally in relation to current 'pen' position
102   float    mXAdvance;    ///< distance in pixels to move the 'pen' after displaying the character
103
104 };
105
106 } // namespace Internal
107
108 } // namespace Dali
109
110 #endif // __DALI_INTERNAL_FONT_METRICS_IMPL_H__