1 #ifndef DALI_TOOLKIT_TEXT_VIEW_INTERFACE_H
2 #define DALI_TOOLKIT_TEXT_VIEW_INTERFACE_H
5 * Copyright (c) 2019 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>
39 * @brief Abstract interface to provide the information necessary to display text.
42 * - The font & glyph IDs needed to get bitmaps etc. from TextAbstraction
43 * - The visual position of each glyph within the layout
44 * - A window into the text layout e.g. which page of a document to view
56 * @brief Virtual destructor
58 virtual ~ViewInterface();
61 * @brief Retrieves the target size of the UI control.
63 * @return The control's size.
65 virtual const Vector2& GetControlSize() const = 0;
68 * @brief Retrieves the text's layout size.
70 * @return The text's size. Note that this may be larger than the control size,
71 * in the case where text is scrolling/clipped.
73 virtual const Vector2& GetLayoutSize() const = 0;
76 * Retrieves the number of glyphs.
78 * @return The number of glyphs.
80 virtual Length GetNumberOfGlyphs() const = 0;
83 * @brief Retrieves glyphs and positions in the given buffers.
85 * @note The size of the @p glyphs and @p glyphPositions buffers need to be big enough to copy the @p numberOfGlyphs glyphs and positions.
86 * @note The returned number of glyphs may be less than @p numberOfGlyphs if a line has ellipsis.
88 * @param[out] glyphs Pointer to a buffer where the glyphs are copied.
89 * @param[out] glyphPositions Pointer to a buffer where the glyph's positions are copied.
90 * @param[out] minLineOffset The minimum line offset.
91 * @param[in] glyphIndex Index to the first glyph.
92 * @param[in] numberOfGlyphs Number of glyphs to be copied.
94 * @return The number of glyphs.
96 virtual Length GetGlyphs( GlyphInfo* glyphs,
97 Vector2* glyphPositions,
99 GlyphIndex glyphIndex,
100 Length numberOfGlyphs ) const = 0;
103 * @brief Retrieves the vector of colors.
105 * @return Pointer to the vector of colors.
107 virtual const Vector4* const GetColors() const = 0;
110 * @brief Retrieves the vector of indices to the vector of colors.
112 * @return Pointer to a vector which stores for each glyph the index to the vector of colors.
114 virtual const ColorIndex* const GetColorIndices() const = 0;
117 * @brief Retrieves the text color
119 * @return The text color
121 virtual const Vector4& GetTextColor() const = 0;
124 * @brief Retrieves the shadow offset, 0 indicates no shadow.
126 * @return The shadow offset.
128 virtual const Vector2& GetShadowOffset() const = 0;
131 * @brief Retrieves the shadow color.
133 * @return The shadow color.
135 virtual const Vector4& GetShadowColor() const = 0;
138 * @brief Retrieves the underline color.
140 * @return The underline color.
142 virtual const Vector4& GetUnderlineColor() const = 0;
145 * @brief Returns whether underline is enabled or not.
147 * @return The underline state.
149 virtual bool IsUnderlineEnabled() const = 0;
152 * @brief Retrieves the underline height override
154 * @return Returns the override height for an underline, 0 indicates that adaptor will determine the height
156 virtual float GetUnderlineHeight() const = 0;
159 * @brief Retrieves the number of underline runs.
161 * @return The number of underline runs.
163 virtual Length GetNumberOfUnderlineRuns() const = 0;
166 * @brief Retrieves the underline runs.
168 * @param[out] underlineRuns Pointer to a buffer where the underline runs are copied.
169 * @param[in] index Index of the first underline run to be copied.
170 * @param[in] numberOfRuns Number of underline runs to be copied.
172 virtual void GetUnderlineRuns( GlyphRun* underlineRuns,
173 UnderlineRunIndex index,
174 Length numberOfRuns ) const = 0;
177 * @brief Retrieve the outline color.
179 * @return The outline color.
181 virtual const Vector4& GetOutlineColor() const = 0;
184 * @brief Retrieves the width of an outline
186 * @return The width of the outline.
188 virtual uint16_t GetOutlineWidth() const = 0;
194 } // namespace Toolkit
198 #endif // DALI_TOOLKIT_TEXT_VIEW_INTERFACE_H