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/devel-api/text/text-enumerations-devel.h>
23 #include <dali-toolkit/internal/text/text-definitions.h>
24 #include <dali-toolkit/public-api/text/text-enumerations.h>
38 * @brief Abstract interface to provide the information necessary to display text.
41 * - The font & glyph IDs needed to get bitmaps etc. from TextAbstraction
42 * - The visual position of each glyph within the layout
43 * - A window into the text layout e.g. which page of a document to view
54 * @brief Virtual destructor
56 virtual ~ViewInterface();
59 * @brief Retrieves the target size of the UI control.
61 * @return The control's size.
63 virtual const Vector2& GetControlSize() const = 0;
66 * @brief Retrieves the text's layout size.
68 * @return The text's size. Note that this may be larger than the control size,
69 * in the case where text is scrolling/clipped.
71 virtual const Vector2& GetLayoutSize() const = 0;
74 * Retrieves the number of glyphs.
76 * @return The number of glyphs.
78 virtual Length GetNumberOfGlyphs() const = 0;
81 * @brief Retrieves glyphs and positions in the given buffers.
83 * @note The size of the @p glyphs and @p glyphPositions buffers need to be big enough to copy the @p numberOfGlyphs glyphs and positions.
84 * @note The returned number of glyphs may be less than @p numberOfGlyphs if a line has ellipsis.
86 * @param[out] glyphs Pointer to a buffer where the glyphs are copied.
87 * @param[out] glyphPositions Pointer to a buffer where the glyph's positions are copied.
88 * @param[out] minLineOffset The minimum line offset.
89 * @param[in] glyphIndex Index to the first glyph.
90 * @param[in] numberOfGlyphs Number of glyphs to be copied.
92 * @return The number of glyphs.
94 virtual Length GetGlyphs(GlyphInfo* glyphs,
95 Vector2* glyphPositions,
97 GlyphIndex glyphIndex,
98 Length numberOfGlyphs) const = 0;
101 * @brief Retrieves the vector of colors.
103 * @return Pointer to the vector of colors.
105 virtual const Vector4* const GetColors() const = 0;
108 * @brief Retrieves the vector of indices to the vector of colors.
110 * @return Pointer to a vector which stores for each glyph the index to the vector of colors.
112 virtual const ColorIndex* const GetColorIndices() const = 0;
115 * @brief Retrieves the vector of background colors.
117 * @return Pointer to the vector of background colors.
119 virtual const Vector4* const GetBackgroundColors() const = 0;
122 * @brief Retrieves the vector of indices to the vector of background colors.
124 * @return Pointer to a vector which stores for each glyph the index to the vector of background colors.
126 virtual const ColorIndex* const GetBackgroundColorIndices() const = 0;
129 * @brief checks if there is background colors set using markup.
131 * @return boolean if there is background colors set using markup .
133 virtual bool const IsMarkupBackgroundColorSet() const = 0;
136 * @brief Retrieves the text color
138 * @return The text color
140 virtual const Vector4& GetTextColor() const = 0;
143 * @brief Retrieves the shadow offset, 0 indicates no shadow.
145 * @return The shadow offset.
147 virtual const Vector2& GetShadowOffset() const = 0;
150 * @brief Retrieves the shadow color.
152 * @return The shadow color.
154 virtual const Vector4& GetShadowColor() const = 0;
157 * @brief Retrieves the underline color.
159 * @return The underline color.
161 virtual const Vector4& GetUnderlineColor() const = 0;
164 * @brief Returns whether underline is enabled or not.
166 * @return The underline state.
168 virtual bool IsUnderlineEnabled() const = 0;
171 * @brief Returns the hyphens glyph info.
173 * @return hyphens glyph info.
175 virtual const GlyphInfo* GetHyphens() const = 0;
178 * @brief Returns the indices of the hyphen in the text.
180 * @return the hyphen indices.
182 virtual const Length* GetHyphenIndices() const = 0;
185 * @brief Returns number of hyphens to add in text.
187 * @return number of hyphens.
189 virtual Length GetHyphensCount() const = 0;
191 * @brief Retrieves the underline height override
193 * @return Returns the override height for an underline, 0 indicates that adaptor will determine the height
195 virtual float GetUnderlineHeight() const = 0;
198 * @brief Retrieves the underline type override
200 * @return Returns the override type for an underline.
202 virtual Text::Underline::Type GetUnderlineType() const = 0;
205 * @brief Retrieves the dashed underline width override.
207 * @return Returns the override width for the dashed underline.
209 virtual float GetDashedUnderlineWidth() const = 0;
212 * @brief Retrieves the dashed underline gap override.
214 * @return Returns the override gap for the dashed underline.
216 virtual float GetDashedUnderlineGap() const = 0;
219 * @brief Retrieves the number of underline runs.
221 * @return The number of underline runs.
223 virtual Length GetNumberOfUnderlineRuns() const = 0;
226 * @brief Retrieves the underline runs.
228 * @param[out] underlineRuns Pointer to a buffer where the underline runs are copied.
229 * @param[in] index Index of the first underline run to be copied.
230 * @param[in] numberOfRuns Number of underline runs to be copied.
232 virtual void GetUnderlineRuns(GlyphRun* underlineRuns,
233 UnderlineRunIndex index,
234 Length numberOfRuns) const = 0;
237 * @brief Retrieve the outline color.
239 * @return The outline color.
241 virtual const Vector4& GetOutlineColor() const = 0;
244 * @brief Retrieves the width of an outline
246 * @return The width of the outline.
248 virtual uint16_t GetOutlineWidth() const = 0;
251 * @brief Retrieves ellipsis position for text.
253 * @return The ellipsis position.
255 virtual DevelText::EllipsisPosition::Type GetEllipsisPosition() const = 0;
258 * @brief Whether the text elide property is enabled.
260 * @return @e true if the text elide property is enabled, @e false otherwise.
262 virtual bool IsTextElideEnabled() const = 0;
265 * @brief Retrieves the start index of laid-out glyphs.
267 * @return The start index of laid-out glyphs.
269 virtual GlyphIndex GetStartIndexOfElidedGlyphs() const = 0;
272 * @brief Retrieves the end index of laid-out glyphs.
274 * @return The end index of laid-out glyphs.
276 virtual GlyphIndex GetEndIndexOfElidedGlyphs() const = 0;
279 * @brief Retrieves the first middle index of elided glyphs, index before ellipsis of middle.
281 * @return The first middle index of elided glyphs, index before ellipsis of middle.
283 virtual GlyphIndex GetFirstMiddleIndexOfElidedGlyphs() const = 0;
286 * @brief Retrieves the second middle index of elided glyphs, index of ellipsis of middle.
288 * @return The second middle index of elided glyphs, index of ellipsis of middle.
290 virtual GlyphIndex GetSecondMiddleIndexOfElidedGlyphs() const = 0;
293 * @brief Retrieves the strikethrough color.
295 * @return The strikethrough color.
297 virtual const Vector4& GetStrikethroughColor() const = 0;
300 * @brief Returns whether strikethrough is enabled or not.
302 * @return The strikethrough state.
304 virtual bool IsStrikethroughEnabled() const = 0;
307 * @brief Retrieves the strikethrough height override
309 * @return Returns the override height for a strikethrough, 0 indicates that adaptor will determine the height
311 virtual float GetStrikethroughHeight() const = 0;
316 } // namespace Toolkit
320 #endif // DALI_TOOLKIT_TEXT_VIEW_INTERFACE_H