Added object sizes to platform abstraction in profiling section
[platform/core/uifw/dali-core.git] / dali / integration-api / glyph-set.cpp
1 //
2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://floralicense.org/license/
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 // CLASS HEADER
18 #include <dali/integration-api/glyph-set.h>
19
20 namespace Dali
21 {
22
23 namespace Integration
24 {
25
26 GlyphSet::GlyphSet()
27 : mFontHash(0),
28   mLineHeight(0.0f),
29   mAscender(0.0f),
30   mUnitsPerEM(0.0f),
31   mUnderlinePosition(0.0f),
32   mUnderlineThickness(0.0f),
33   mPadAdjust(0.0f)
34 {
35 }
36
37 GlyphSet::~GlyphSet()
38 {
39   mCharacterList.clear();
40 }
41
42 void GlyphSet::AddCharacter(BitmapPtr bitmapData, const GlyphMetrics& glyphMetrics)
43 {
44   mCharacterList.push_back(Character(bitmapData, glyphMetrics));
45 }
46
47 void GlyphSet::AddCharacter(const Character& character)
48 {
49   mCharacterList.push_back(character);
50 }
51
52 const GlyphSet::CharacterList& GlyphSet::GetCharacterList() const
53 {
54   return mCharacterList;
55 }
56
57 bool GlyphSet::HasCharacter(const uint32_t charCode) const
58 {
59   for (CharacterConstIter iter = mCharacterList.begin(), endIter = mCharacterList.end(); iter != endIter; ++iter)
60   {
61     if (iter->second.code == charCode)
62     {
63       return true;
64     }
65   }
66   return false;
67 }
68
69 bool GlyphSet::HasCharacter(const Character& character) const
70 {
71   return HasCharacter(character.second.code);
72 }
73
74 ResourceId GlyphSet::GetAtlasResourceId() const
75 {
76   return mAtlasId;
77 }
78
79 void GlyphSet::SetAtlasResourceId(ResourceId resourceId)
80 {
81   mAtlasId = resourceId;
82 }
83
84 } //namespace Integration
85
86 } //namespace Dali