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