1 #ifndef DALI_TOOLKIT_FONT_BITMAP_DEVEL_H
2 #define DALI_TOOLKIT_FONT_BITMAP_DEVEL_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/public-api/common/vector-wrapper.h>
23 #include <dali-toolkit/public-api/dali-toolkit-common.h>
29 namespace TextAbstraction
31 // Forward declarations
42 * @brief Struct that stores the needed info to create a bitmap glyph.
45 struct DALI_TOOLKIT_API Glyph
48 * @brief Default constructor.
50 * Initialize the members to its defaults.
57 * Initialize the members with the given values.
59 * @param[in] url The url of the bitmap for that glyph.
60 * @param[in] utf8 The utf8 codification of the glyph.
61 * @param[in] ascender The ascender of the glyph.
62 * @param[in] descender The descender of the glyph.
64 Glyph( const std::string& url, const std::string utf8, float ascender, float descender );
67 * @brief Default destructor.
71 std::string url; ///< The url of the glyph.
72 uint8_t utf8[4]; ///< the glyph encoded in utf8
73 float ascender; ///< The ascender. The distance from the base line to the top of the glyph.
74 float descender; ///< The descender. The distance from the base line to the bottom of the glyph.
78 * @brief Describes a bitmap font.
80 struct DALI_TOOLKIT_API BitmapFontDescription
83 * @brief Default constructor.
85 * Initialize the members to its defaults.
87 BitmapFontDescription();
90 * @brief Default destructor.
92 ~BitmapFontDescription();
94 std::vector<Glyph> glyphs; ///< Vector of glyphs.
95 std::string name; ///< Name of the font.
96 float underlinePosition; ///< The position of the underline from the base line.
97 float underlineThickness; ///< The thickness of the underline.
98 bool isColorFont:1; ///< Whether the glyphs of this font have their own colors.
102 * @brief Creates a bitmap font with the given description.
104 * The @p bitmapFont output can be passed to the FontClient::GetFontId()
105 * method to load the font and get an Id.
107 * @param[in] description The description of the bitmap font.
108 * @param[out] bitmapFont A bitmap font.
110 * @note If the @e ascender and @e descender of the glyphs are zero, the @e descender value will be left as zero and all the bitmaps will be loaded to find out the @e ascender value.
112 DALI_TOOLKIT_API void CreateBitmapFont( const BitmapFontDescription& description, TextAbstraction::BitmapFont& bitmapFont );
114 } // namespace DevelText
116 } // namespace Toolkit
120 #endif // DALI_TOOLKIT_TEXT_UTILS_DEVEL_H