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