[SRUK] Initial copy from Tizen 2.2 version
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / text-view / text-view-processor-dbg.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 // INTERNAL INCLUDES
18 #include "text-view-processor-dbg.h"
19
20 namespace Dali
21 {
22
23 namespace Toolkit
24 {
25
26 namespace Internal
27 {
28
29 namespace TextViewProcessor
30 {
31
32 void dbgPrint( const WordLayoutInfo& word )
33 {
34   for( CharacterLayoutInfoContainer::const_iterator characterIt = word.mCharactersLayoutInfo.begin(), endCharacterIt = word.mCharactersLayoutInfo.end();
35        characterIt != endCharacterIt;
36        ++characterIt )
37   {
38     const CharacterLayoutInfo& character( *characterIt );
39
40     std::cout << "[" << character.mSize << std::endl;
41     std::cout << " ascender " << character.mAscender << std::endl;
42
43     if( character.mTextActor )
44     {
45       std::cout << "[" << character.mTextActor.GetText() << "]";
46     }
47     std::cout << "{" << character.mStyledText.mText.GetText() << "}";
48   }
49   std::cout << "     size " << word.mSize << std::endl;
50   std::cout << " ascender " << word.mAscender << std::endl;
51   std::cout << " num char " << word.mCharactersLayoutInfo.size() << std::endl;
52   std::cout << "     type ";
53   switch( word.mType )
54   {
55     case NoSeparator:
56     {
57       std::cout << "NoSeparator" << std::endl;
58       break;
59     }
60     case LineSeparator:
61     {
62       std::cout << "LineSeparator" << std::endl;
63       break;
64     }
65     case WordSeparator:
66     {
67       std::cout << "WordSeparator" << std::endl;
68       break;
69     }
70   }
71 }
72
73 void dbgPrint( const WordGroupLayoutInfo& group )
74 {
75   std::cout << "( ";
76   std::cout << group.mSize;
77   std::cout << group.mNumberOfCharacters;
78   for( WordLayoutInfoContainer::const_iterator wordIt = group.mWordsLayoutInfo.begin(), endWordIt = group.mWordsLayoutInfo.end();
79        wordIt != endWordIt;
80        ++wordIt )
81   {
82     dbgPrint( *wordIt );
83   }
84   std::cout << " )";
85 }
86
87 void dbgPrint( const LineLayoutInfo& line )
88 {
89   std::cout << "< ";
90   std::cout << line.mSize;
91   for( WordGroupLayoutInfoContainer::const_iterator groupIt = line.mWordGroupsLayoutInfo.begin(), endGroupIt = line.mWordGroupsLayoutInfo.end();
92        groupIt != endGroupIt;
93        ++groupIt )
94   {
95     dbgPrint( *groupIt );
96   }
97   std::cout << " >";
98   std::cout << std::endl;
99 }
100
101 void dbgPrint( const TextLayoutInfo& textInfo )
102 {
103   std::cout << "||" << std::endl;
104   std::cout << textInfo.mWholeTextSize;
105   for( LineLayoutInfoContainer::const_iterator it = textInfo.mLinesLayoutInfo.begin(), endIt = textInfo.mLinesLayoutInfo.end();
106        it != endIt;
107        ++it )
108   {
109     dbgPrint( *it );
110   }
111   std::cout << "||" << std::endl;
112 }
113
114 void dbgPrint( const TextStyle& style )
115 {
116   std::cout << "         font name : " << style.GetFontName() << std::endl;
117   std::cout << "        font style : " << style.GetFontStyle() << std::endl;
118   std::cout << "   font point size : " << style.GetFontPointSize() << std::endl;
119   std::cout << "            weight : " << style.GetWeight() << std::endl;
120   std::cout << "        text color : " << style.GetTextColor() << std::endl;
121   std::cout << "           italics : " << style.GetItalics() << std::endl;
122   std::cout << "         underline : " << style.GetUnderline() << std::endl;
123   std::cout << "            shadow : " << style.GetShadow() << std::endl;
124   std::cout << "      shadow color : " << style.GetShadowColor() << std::endl;
125   std::cout << "     shadow offset : " << style.GetShadowOffset() << std::endl;
126   std::cout << "              glow : " << style.GetGlow() << std::endl;
127   std::cout << "     italics angle : " << style.GetItalicsAngle() << std::endl;
128   std::cout << "        glow color : " << style.GetGlowColor() << std::endl;
129   std::cout << "    glow intensity : " << style.GetGlowIntensity() << std::endl;
130   std::cout << "       smooth edge : " << style.GetSmoothEdge() << std::endl;
131   std::cout << "           outline : " << style.GetOutline() << std::endl;
132   std::cout << "     outline color : " << style.GetOutlineColor() << std::endl;
133   std::cout << " outline thickness : " << style.GetOutlineThickness() << std::endl;
134 }
135
136 void dbgPrint( const TextInfoIndices& indices )
137 {
138   std::cout << "   line : " << indices.mLineIndex << std::endl;
139   std::cout << "  group : " << indices.mGroupIndex << std::endl;
140   std::cout << "   word : " << indices.mWordIndex << std::endl;
141   std::cout << "   char : " << indices.mCharacterIndex << std::endl;
142 }
143
144 void dbgPrint( const MarkupProcessor::StyledTextArray& textArray )
145 {
146   for( MarkupProcessor::StyledTextArray::const_iterator it = textArray.begin(), endIt = textArray.end(); it != endIt; ++it )
147   {
148     const MarkupProcessor::StyledText& text( *it );
149
150     std::cout << text.mText.GetText();
151   }
152 }
153
154 void dbgPrintText( const WordLayoutInfo& word )
155 {
156   for( CharacterLayoutInfoContainer::const_iterator characterIt = word.mCharactersLayoutInfo.begin(), endCharacterIt = word.mCharactersLayoutInfo.end();
157        characterIt != endCharacterIt;
158        ++characterIt )
159   {
160     const CharacterLayoutInfo& character( *characterIt );
161
162     std::cout << character.mStyledText.mText.GetText();
163   }
164 }
165
166 } // namespace TextViewProcessor
167
168 } // namespace Internal
169
170 } // namespace Toolkit
171
172 } // namespace Dali