Merge base & optional
[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 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 // FILE HEADER
19 #include <dali-toolkit/internal/controls/text-view/text-view-processor-dbg.h>
20
21 // INTERNAL INCLUDES
22 #include <dali-toolkit/internal/controls/text-view/text-view-processor-types.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 namespace Internal
31 {
32
33 namespace TextViewProcessor
34 {
35
36 #if defined(DEBUG_ENABLED)
37 Debug::Filter* gTextViewProcessorLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_TEXT_VIEW_PROCESSOR");
38 #endif
39
40 void dbgPrint( const WordLayoutInfo& word )
41 {
42   std::cout << "       size " << word.mSize << std::endl;
43   std::cout << "   ascender " << word.mAscender << std::endl;
44   std::cout << "       type ";
45   switch( word.mType )
46   {
47     case NoSeparator:
48     {
49       std::cout << "NoSeparator" << std::endl;
50       break;
51     }
52     case ParagraphSeparator:
53     {
54       std::cout << "ParagraphSeparator" << std::endl;
55       break;
56     }
57     case WordSeparator:
58     {
59       std::cout << "WordSeparator" << std::endl;
60       break;
61     }
62   }
63   std::cout << " first char " << word.mFirstCharacter << std::endl;
64   std::cout << "   num char " << word.mCharactersLayoutInfo.size() << std::endl;
65   for( CharacterLayoutInfoContainer::const_iterator characterIt = word.mCharactersLayoutInfo.begin(), endCharacterIt = word.mCharactersLayoutInfo.end();
66        characterIt != endCharacterIt;
67        ++characterIt )
68   {
69     const CharacterLayoutInfo& character( *characterIt );
70
71     std::cout << "[" << character.mSize << std::endl;
72     std::cout << " ascender " << character.mAscender << std::endl;
73   }
74 }
75
76 void dbgPrint( const ParagraphLayoutInfo& paragraph )
77 {
78   std::cout << "< ";
79   std::cout << "  text : [" << paragraph.mText.GetText() << "]" << std::endl;
80   std::cout << "  number of styles : " << paragraph.mTextStyles.Count() << std::endl;
81   std::cout << paragraph.mSize;
82   for( WordLayoutInfoContainer::const_iterator wordIt = paragraph.mWordsLayoutInfo.begin(), endWordIt = paragraph.mWordsLayoutInfo.end();
83        wordIt != endWordIt;
84        ++wordIt )
85   {
86     dbgPrint( *wordIt );
87   }
88   std::cout << " >";
89   std::cout << std::endl;
90 }
91
92 void dbgPrint( const TextLayoutInfo& textInfo )
93 {
94   std::cout << "||" << std::endl;
95   std::cout << textInfo.mWholeTextSize;
96   std::cout << textInfo.mNumberOfCharacters;
97   for( ParagraphLayoutInfoContainer::const_iterator it = textInfo.mParagraphsLayoutInfo.begin(), endIt = textInfo.mParagraphsLayoutInfo.end();
98        it != endIt;
99        ++it )
100   {
101     dbgPrint( *it );
102   }
103   std::cout << "||" << std::endl;
104 }
105
106 void dbgPrint( const TextStyle& style )
107 {
108   std::cout << "               font name : " << style.GetFontName() << std::endl;
109   std::cout << "              font style : " << style.GetFontStyle() << std::endl;
110   std::cout << "         font point size : " << style.GetFontPointSize() << std::endl;
111   std::cout << "                  weight : " << style.GetWeight() << std::endl;
112   std::cout << "              text color : " << style.GetTextColor() << std::endl;
113   std::cout << "                 italics : " << style.IsItalicsEnabled() << std::endl;
114   std::cout << "           italics angle : " << style.GetItalicsAngle() << std::endl;
115   std::cout << "               underline : " << style.IsUnderlineEnabled() << std::endl;
116   std::cout << "     underline thickness : " << style.GetUnderlineThickness() << std::endl;
117   std::cout << "      underline position : " << style.GetUnderlinePosition() << std::endl;
118   std::cout << "                  shadow : " << style.IsShadowEnabled() << std::endl;
119   std::cout << "            shadow color : " << style.GetShadowColor() << std::endl;
120   std::cout << "           shadow offset : " << style.GetShadowOffset() << std::endl;
121   std::cout << "             shadow size : " << style.GetShadowSize() << std::endl;
122   std::cout << "                    glow : " << style.IsGlowEnabled() << std::endl;
123   std::cout << "              glow color : " << style.GetGlowColor() << std::endl;
124   std::cout << "          glow intensity : " << style.GetGlowIntensity() << std::endl;
125   std::cout << "             smooth edge : " << style.GetSmoothEdge() << std::endl;
126   std::cout << "                 outline : " << style.IsOutlineEnabled() << std::endl;
127   std::cout << "           outline color : " << style.GetOutlineColor() << std::endl;
128   std::cout << "       outline thickness : " << style.GetOutlineThickness() << std::endl;
129   std::cout << "                gradient : " << style.IsGradientEnabled() << std::endl;
130   std::cout << "          gradient color : " << style.GetGradientColor() << std::endl;
131   std::cout << "    gradient start point : " << style.GetGradientStartPoint() << std::endl;
132   std::cout << "      gradient end point : " << style.GetGradientEndPoint() << std::endl;
133   std::cout << "    is font name default : " << style.IsFontNameDefault() << std::endl;
134   std::cout << "   is font style default : " << style.IsFontStyleDefault() << std::endl;
135   std::cout << "    is font size default : " << style.IsFontSizeDefault() << std::endl;
136   std::cout << "   is text color default : " << style.IsTextColorDefault() << std::endl;
137   std::cout << "  is font weight default : " << style.IsFontWeightDefault() << std::endl;
138   std::cout << "  is smooth edge default : " << style.IsSmoothEdgeDefault() << std::endl;
139   std::cout << "      is italics default : " << style.IsItalicsDefault() << std::endl;
140   std::cout << "    is underline default : " << style.IsUnderlineDefault() << std::endl;
141   std::cout << "       is shadow default : " << style.IsShadowDefault() << std::endl;
142   std::cout << "         is glow default : " << style.IsGlowDefault() << std::endl;
143   std::cout << "      is outline default : " << style.IsOutlineDefault() << std::endl;
144   std::cout << "     is gradient default : " << style.IsGradientDefault() << std::endl;
145 }
146
147 void dbgPrint( const TextInfoIndices& indices )
148 {
149   std::cout << "          paragraph : " << indices.mParagraphIndex << std::endl;
150   std::cout << "               word : " << indices.mWordIndex << std::endl;
151   std::cout << "               char : " << indices.mCharacterIndex << std::endl;
152   std::cout << "  char in paragraph : " << indices.mCharacterParagraphIndex << std::endl;
153 }
154
155 void dbgPrint( const MarkupProcessor::StyledTextArray& textArray )
156 {
157   for( MarkupProcessor::StyledTextArray::const_iterator it = textArray.begin(), endIt = textArray.end(); it != endIt; ++it )
158   {
159     const MarkupProcessor::StyledText& text( *it );
160
161     std::cout << text.mText.GetText();
162   }
163 }
164
165 } // namespace TextViewProcessor
166
167 } // namespace Internal
168
169 } // namespace Toolkit
170
171 } // namespace Dali