Merge remote-tracking branch 'origin/tizen' into new_text
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / shaper.h
1 #ifndef __DALI_TOOLKIT_TEXT_SHAPER_H__
2 #define __DALI_TOOLKIT_TEXT_SHAPER_H__
3
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/common/dali-vector.h>
23
24 // INTERNAL INCLUDES
25 #include <dali-toolkit/internal/text/font-run.h>
26 #include <dali-toolkit/internal/text/script-run.h>
27
28 namespace Dali
29 {
30
31 namespace Toolkit
32 {
33
34 namespace Text
35 {
36
37 class LogicalModel;
38 class VisualModel;
39
40 /**
41  * Shapes the whole text.
42  *
43  * @param[in] text Vector of UTF-32 characters.
44  * @param[in] lineBreakInfo The line break info.
45  * @param[in] scripts Vector containing the script runs for the whole text.
46  * @param[in] fonts Vector with validated fonts.
47  * @param[out] glyphs Vector of glyphs in the visual order.
48  * @param[out] glyphToCharacterMap Vector containing the first character in the logical model that each glyph relates to.
49  * @param[out] charactersPerGlyph Vector containing the number of characters per glyph.
50  */
51 void ShapeText( const Vector<Character>& text,
52                 const Vector<LineBreakInfo>& lineBreakInfo,
53                 const Vector<ScriptRun>& scripts,
54                 const Vector<FontRun>& fonts,
55                 Vector<GlyphInfo>& glyphs,
56                 Vector<CharacterIndex>& glyphToCharacterMap,
57                 Vector<Length>& charactersPerGlyph );
58
59 /**
60  * Replaces the shape info of the given range of characters.
61  *
62  * @pre The @p model needs to have a text set.
63  * @pre The @p model needs to have the scripts set.
64  * @pre The @p model needs to have the fonts set.
65  * @pre The @p model needs to have the bidirectional info set.
66  *
67  * If the @p numberOfCharactersToRemove is zero, this operation is like an insert.
68  * If the @p numberOfCharactersToInsert is zero, this operation is like a remove.
69  *
70  * @param[in] logicalModel The text's logical model.
71  * @param[in,out] visualModel The text's logical model.
72  * @param[in] characterIndex Index to the first character.
73  * @param[in] numberOfCharactersToRemove The number of characters removed from the text.
74  * @param[in] numberOfCharactersToInsert The number of characters inserted in the text.
75  */
76 void ShapeText( const LogicalModel& logicalModel,
77                 VisualModel& visualModel,
78                 CharacterIndex characterIndex,
79                 Length numberOfCharactersToRemove,
80                 Length numberOfCharactersToInsert );
81
82 } // namespace Text
83
84 } // namespace Toolkit
85
86 } // namespace Dali
87
88 #endif // __DALI_TOOLKIT_TEXT_SHAPER_H__