1 #ifndef DALI_TOOLKIT_TEXT_VIEW_INTERFACE_H
2 #define DALI_TOOLKIT_TEXT_VIEW_INTERFACE_H
5 * Copyright (c) 2021 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 <dali-toolkit/internal/text/text-definitions.h>
36 * @brief Abstract interface to provide the information necessary to display text.
39 * - The font & glyph IDs needed to get bitmaps etc. from TextAbstraction
40 * - The visual position of each glyph within the layout
41 * - A window into the text layout e.g. which page of a document to view
52 * @brief Virtual destructor
54 virtual ~ViewInterface();
57 * @brief Retrieves the target size of the UI control.
59 * @return The control's size.
61 virtual const Vector2& GetControlSize() const = 0;
64 * @brief Retrieves the text's layout size.
66 * @return The text's size. Note that this may be larger than the control size,
67 * in the case where text is scrolling/clipped.
69 virtual const Vector2& GetLayoutSize() const = 0;
72 * Retrieves the number of glyphs.
74 * @return The number of glyphs.
76 virtual Length GetNumberOfGlyphs() const = 0;
79 * @brief Retrieves glyphs and positions in the given buffers.
81 * @note The size of the @p glyphs and @p glyphPositions buffers need to be big enough to copy the @p numberOfGlyphs glyphs and positions.
82 * @note The returned number of glyphs may be less than @p numberOfGlyphs if a line has ellipsis.
84 * @param[out] glyphs Pointer to a buffer where the glyphs are copied.
85 * @param[out] glyphPositions Pointer to a buffer where the glyph's positions are copied.
86 * @param[out] minLineOffset The minimum line offset.
87 * @param[in] glyphIndex Index to the first glyph.
88 * @param[in] numberOfGlyphs Number of glyphs to be copied.
90 * @return The number of glyphs.
92 virtual Length GetGlyphs(GlyphInfo* glyphs,
93 Vector2* glyphPositions,
95 GlyphIndex glyphIndex,
96 Length numberOfGlyphs) const = 0;
99 * @brief Retrieves the vector of colors.
101 * @return Pointer to the vector of colors.
103 virtual const Vector4* const GetColors() const = 0;
106 * @brief Retrieves the vector of indices to the vector of colors.
108 * @return Pointer to a vector which stores for each glyph the index to the vector of colors.
110 virtual const ColorIndex* const GetColorIndices() const = 0;
113 * @brief Retrieves the vector of background colors.
115 * @return Pointer to the vector of background colors.
117 virtual const Vector4* const GetBackgroundColors() const = 0;
120 * @brief Retrieves the vector of indices to the vector of background colors.
122 * @return Pointer to a vector which stores for each glyph the index to the vector of background colors.
124 virtual const ColorIndex* const GetBackgroundColorIndices() const = 0;
127 * @brief Retrieves the text color
129 * @return The text color
131 virtual const Vector4& GetTextColor() const = 0;
134 * @brief Retrieves the shadow offset, 0 indicates no shadow.
136 * @return The shadow offset.
138 virtual const Vector2& GetShadowOffset() const = 0;
141 * @brief Retrieves the shadow color.
143 * @return The shadow color.
145 virtual const Vector4& GetShadowColor() const = 0;
148 * @brief Retrieves the underline color.
150 * @return The underline color.
152 virtual const Vector4& GetUnderlineColor() const = 0;
155 * @brief Returns whether underline is enabled or not.
157 * @return The underline state.
159 virtual bool IsUnderlineEnabled() const = 0;
162 * @brief Retrieves the underline height override
164 * @return Returns the override height for an underline, 0 indicates that adaptor will determine the height
166 virtual float GetUnderlineHeight() const = 0;
169 * @brief Retrieves the number of underline runs.
171 * @return The number of underline runs.
173 virtual Length GetNumberOfUnderlineRuns() const = 0;
176 * @brief Retrieves the underline runs.
178 * @param[out] underlineRuns Pointer to a buffer where the underline runs are copied.
179 * @param[in] index Index of the first underline run to be copied.
180 * @param[in] numberOfRuns Number of underline runs to be copied.
182 virtual void GetUnderlineRuns(GlyphRun* underlineRuns,
183 UnderlineRunIndex index,
184 Length numberOfRuns) const = 0;
187 * @brief Retrieve the outline color.
189 * @return The outline color.
191 virtual const Vector4& GetOutlineColor() const = 0;
194 * @brief Retrieves the width of an outline
196 * @return The width of the outline.
198 virtual uint16_t GetOutlineWidth() const = 0;
203 } // namespace Toolkit
207 #endif // DALI_TOOLKIT_TEXT_VIEW_INTERFACE_H