1 #ifndef __DALI_TOOLKIT_INTERNAL_TEXT_VIEW_PROCESSOR_HELPER_FUNCTIONS_H__
2 #define __DALI_TOOLKIT_INTERNAL_TEXT_VIEW_PROCESSOR_HELPER_FUNCTIONS_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include "text-view-processor-types.h"
33 namespace TextViewProcessor
37 * Enum type used to update a size adding other one.
38 * If the grow type is \e GrowWidth, size's widths are added and size's height is the max of both.
39 * Alternativelly if grow type is \e GrowHeight heights are added and width is the max of both.
48 * Updates the size of a group of characters, word, group of words, line or the whole text with a given size.
50 * For group of characters, words, groups of words and lines the new height will be the maximum of both sizes
51 * and the new width will be the sum of both.
53 * For the whole text, the new height will be the sum of both and the new width the max of both.
55 * The \e type parameter speficies which type of update is required.
57 * @param[in,out] size1 The current size to be updated.
58 * @param[in] size2 The size of a group of characters, word, group of words or a line.
59 * @param[in] type Type of update.
61 void UpdateSize( Size& size1, const Size& size2, SizeGrowType type = GrowWidth );
64 * Return the type of separator (white space, new line or no separator) for the given character.
66 * @param[in] character The given character.
68 * @return The type of separator.
70 TextSeparatorType GetTextSeparatorType( const Character& character );
73 * Choose a suitable font family name for the given styled text.
75 * It may modify the text-style of the given text by setting a suitable font-family.
77 * @param[in,out] text Text with style.
79 void ChooseFontFamilyName( MarkupProcessor::StyledText& text );
82 * Retrieves the line, word group, word and character indices for the given global character's index.
84 * i.e. The retrieved indices for the character 18 (j) for the following text would be: 2, 0, 2, 0
91 * @param[in] index The global character index.
92 * @param[in] textLayoutInfo Contains info about the number of characters per word, group and line.
93 * @param[out] indices Index to the line, group of words, word and character within the word where the given character is located.
95 void GetIndicesFromGlobalCharacterIndex( std::size_t index,
96 const TextLayoutInfo& textLayoutInfo,
97 TextInfoIndices& indices );
100 * Clear the text of the given text-actors.
102 * @param[in] textActors The given text-actors.
104 void ClearText( std::vector<TextActor>& textActors );
106 } //namespace TextViewProcessor
108 } //namespace Internal
110 } //namespace Toolkit
114 #endif // __DALI_TOOLKIT_INTERNAL_TEXT_VIEW_PROCESSOR_HELPER_FUNCTIONS_H__