2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali-toolkit/internal/text/text-io.h>
23 #include <dali/devel-api/text-abstraction/font-client.h>
24 #include <dali/devel-api/text-abstraction/script.h>
35 std::ostream& operator<< (std::ostream& o, const Vector<Character>& text)
39 for( unsigned int i=0; i<text.Count(); ++i )
42 if( i+1 < text.Count() )
51 std::ostream& operator<< (std::ostream& o, const Vector<ScriptRun>& scriptRun)
53 for( unsigned int i=0; i<scriptRun.Count(); ++i )
55 // e.g. Print "0->9: LATIN" for a ten character run staring from beginning of the model
56 o << scriptRun[i].characterRun.characterIndex << "->" << (scriptRun[i].characterRun.characterIndex + scriptRun[i].characterRun.numberOfCharacters ) << ": ";
57 o << TextAbstraction::ScriptName[scriptRun[i].script];
59 if( i+1 < scriptRun.Count() )
68 std::ostream& operator<< (std::ostream& o, const Vector<FontRun>& fontRun)
70 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
72 for( unsigned int i=0; i<fontRun.Count(); ++i )
74 // e.g. Print "0->9: ID:1 TizenSansKorean style:Regular size:10.0" for a ten character run staring from beginning of the model
75 o << fontRun[i].characterRun.characterIndex << "->" << (fontRun[i].characterRun.characterIndex + fontRun[i].characterRun.numberOfCharacters ) << ": ";
77 FontId id = fontRun[i].fontId;
78 TextAbstraction::FontDescription fontDescription;
79 fontClient.GetDescription( id, fontDescription );
80 o << "ID:" << id << ", " << fontDescription.family << " style:" << fontDescription.style << " size:" << (fontClient.GetPointSize(id) / 64);
82 if( i+1 < fontRun.Count() )
91 std::ostream& operator<< (std::ostream& o, const Vector<LineRun>& lineRuns)
93 for( unsigned int i=0; i<lineRuns.Count(); ++i )
95 // e.g. Print "Line 0 Glyphs: 0->9 Characters: 0->9 (10)" for a ten character run staring from beginning of the model
96 o << "Line " << i << " Glyphs: " << lineRuns[i].glyphIndex << "->" << (lineRuns[i].glyphIndex + lineRuns[i].numberOfGlyphs );
97 o << " Characters: " << lineRuns[i].characterRun.characterIndex << "->" << (lineRuns[i].characterRun.characterIndex + lineRuns[i].characterRun.numberOfCharacters );
98 o << " Width: " << lineRuns[i].width;
99 o << " Ascender: " << lineRuns[i].ascender;
100 o << " Descender: " << lineRuns[i].descender;
102 if( i+1 < lineRuns.Count() )
108 return o << std::dec;
113 } // namespace Toolkit