1 #ifndef DALI_TEXT_ABSTRACTION_BITMAP_FONT_H
2 #define DALI_TEXT_ABSTRACTION_BITMAP_FONT_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/dali-common.h>
23 #include <dali/public-api/common/vector-wrapper.h>
24 #include <dali/public-api/dali-adaptor-common.h>
28 #include <dali/devel-api/text-abstraction/text-abstraction-definitions.h>
35 namespace TextAbstraction
39 * @brief Struct that stores the needed info to create a bitmap glyph.
41 * BitmapGlyph objects need to be added to a BitmapFont.
43 struct DALI_ADAPTOR_API BitmapGlyph
46 * @brief Default constructor.
48 * Initialize the members to its defaults.
55 * Initialize the members with the given values.
57 * @param[in] url The url of the bitmap for that glyph.
58 * @param[in] utf32 The utf32 codification of the glyph.
59 * @param[in] ascender The ascender of the glyph.
60 * @param[in] descender The descender of the glyph.
62 BitmapGlyph( const std::string& url, GlyphIndex utf32, float ascender, float descender );
65 * @brief Default destructor.
69 std::string url; ///< The url of the glyph's bitmap.
70 GlyphIndex utf32; ///< The id of the glyph encoded in utf32.
71 float ascender; ///< The ascender in pixels. The distance from the base line to the top of the glyph.
72 float descender; ///< The descender in pixels. The distance from the base line to the bottom of the glyph.
76 * @brief Struct that stores the needed info to create a bitmap font.
78 * A bitmap font can be created by calling FontClient::GetFontId( const BitmapFont& ).
80 struct DALI_ADAPTOR_API BitmapFont
83 * @brief Default constructor.
85 * Initialize the members to its defaults but the @e underlineThickness which is initilized to 1 pixel.
90 * @brief Default destructor.
94 std::vector<BitmapGlyph> glyphs; ///< The glyphs of the font.
95 std::string name; ///< The name of the font.
96 float ascender; ///< The ascender in pixels. Maximum ascender of all the glyphs.
97 float descender; ///< The descender in pixels. Minimum descender of all the glyphs.
98 float underlinePosition; ///< The position in pixels of the underline from the base line.
99 float underlineThickness; ///< The thickness in pixels of the underline.
100 bool isColorFont:1; ///< Whether the glyphs of this font have their own colors.
103 } // namespace TextAbstraction
107 #endif // DALI_TEXT_ABSTRACTION_BITMAP_FONT_H