1 #ifndef DALI_TOOLKIT_TEXT_FONT_SPAN_H
2 #define DALI_TOOLKIT_TEXT_FONT_SPAN_H
5 * Copyright (c) 2022 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/devel-api/text-abstraction/font-list.h>
25 #include <dali-toolkit/devel-api/text/spans/base-span.h>
33 namespace Internal DALI_INTERNAL
39 * @brief FontSpan is a handle to an object that specifies the font properties for range of characters.
41 class DALI_TOOLKIT_API FontSpan : public BaseSpan
45 * @brief Create an initialized FontSpan.
47 * @param[in] familyName The font family name.
48 * @param[in] sizeInPoints The font size.
49 * @param[in] weight The font weight.
50 * @param[in] width The font width.
51 * @param[in] slant The font slant.
53 * @return A handle to a newly allocated Dali resource
55 static FontSpan New(const std::string familyName,
56 const float sizeInPoints,
57 const Dali::TextAbstraction::FontWeight::Type weight,
58 const Dali::TextAbstraction::FontWidth::Type width,
59 const Dali::TextAbstraction::FontSlant::Type slant);
62 * @brief Creates an uninitialized FontSpan handle.
64 * Calling member functions with an uninitialized FontSpan handle is not allowed.
69 * @brief Copy constructor.
70 * @param[in] rhs A reference to the copied handle
72 FontSpan(const FontSpan& rhs);
75 * @brief Move constructor.
76 * @param[in] rhs A reference to the handle to move
78 FontSpan(FontSpan&& rhs);
81 * @brief Assignment operator.
82 * @param[in] rhs A reference to the copied handle
83 * @return A reference to this
85 FontSpan& operator=(const FontSpan& rhs);
88 * @brief Move assignment operator.
89 * @param[in] rhs A reference to the moved handle
90 * @return A reference to this
92 FontSpan& operator=(FontSpan&& rhs);
95 * @brief Non virtual destructor.
100 * @brief Downcasts to a FontSpan handle.
101 * If handle is not a FontSpan, the returned handle is left uninitialized.
103 * @param[in] handle Handle to an object
104 * @return FontSpan handle or an uninitialized handle
106 static FontSpan DownCast(BaseHandle handle);
110 * @brief Retrive the font family name.
112 * @return A family name value.
114 const std::string GetFamilyName() const;
117 * @brief Retrive the font weight.
119 * @return A font weight value.
121 const Dali::TextAbstraction::FontWeight::Type GetWeight() const;
124 * @brief Retrive the font width.
126 * @return A font width value.
128 const Dali::TextAbstraction::FontWidth::Type GetWidth() const;
131 * @brief Retrive the font slant.
133 * @return A font slant value.
135 const Dali::TextAbstraction::FontSlant::Type GetSlant() const;
138 * @brief Retrive the font size.
140 * @return A font size value.
142 const float GetSize() const;
145 * @brief Retrieve whether the font family name is defined.
147 * @return The return is true if font family name is defined, otherwise false.
149 bool IsFamilyNameDefined() const;
152 * @brief Retrieve whether the font weight is defined.
154 * @return The return is true if font weight is defined, otherwise false.
156 bool IsWeightDefined() const;
159 * @brief Retrieve whether the font width is defined.
161 * @return The return is true if font width is defined, otherwise false.
163 bool IsWidthDefined() const;
166 * @brief Retrieve whether the font slant is defined.
168 * @return The return is true if font slant is defined, otherwise false.
170 bool IsSlantDefined() const;
173 * @brief Retrieve whether the font size is defined.
175 * @return The return is true if font size is defined, otherwise false.
178 bool IsSizeDefined() const;
180 public: // Not intended for application developers
183 * @brief This constructor is used internally to Create an initialized FontSpan handle.
185 * @param[in] fontSpan Pointer to internal FontSpan
187 explicit DALI_INTERNAL FontSpan(Internal::FontSpan* fontSpan);
193 } // namespace Toolkit
197 #endif // DALI_TOOLKIT_TEXT_FONT_SPAN_H