1 #ifndef DALI_INTERNAL_TEXT_ABSTRACTION_BITMAP_FONT_CACHE_ITEM_H
2 #define DALI_INTERNAL_TEXT_ABSTRACTION_BITMAP_FONT_CACHE_ITEM_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.
21 #include <dali/devel-api/adaptor-framework/pixel-buffer.h>
22 #include <dali/devel-api/text-abstraction/bitmap-font.h>
23 #include <dali/devel-api/text-abstraction/text-abstraction-definitions.h>
25 #include <dali/internal/text/text-abstraction/plugin/font-cache-item-interface.h>
27 #include FT_FREETYPE_H
29 namespace Dali::TextAbstraction::Internal
32 * @brief Stores a bitmap font and its pixel buffers per glyph.
34 struct BitmapFontCacheItem : public FontCacheItemInterface
39 * @param[in] bitmapFont The font to cache
40 * @param[in] fontId The id of the font
42 BitmapFontCacheItem(const BitmapFont& bitmapFont, FontId fontId);
45 * @copydoc FontCacheItemInterface::GetFontMetrics()
47 void GetFontMetrics(FontMetrics& metrics, unsigned int dpiVertical) const override;
50 * @copydoc FontCacheItemInterface::GetGlyphMetrics()
52 bool GetGlyphMetrics(GlyphInfo& glyph, unsigned int dpiVertical, bool horizontal) const override;
55 * @copydoc FontCacheItemInterface::CreateBitmap()
57 void CreateBitmap(GlyphIndex glyphIndex, Dali::TextAbstraction::FontClient::GlyphBufferData& data, int outlineWidth, bool isItalicRequired, bool isBoldRequired) const override;
60 * @copydoc FontCacheItemInterface::IsColorGlyph()
62 bool IsColorGlyph(GlyphIndex glyphIndex) const override
68 * @copydoc FontCacheItemInterface::IsCharacterSupported()
70 bool IsCharacterSupported(Character character) override;
73 * @copydoc FontCacheItemInterface::GetPointSize()
75 PointSize26Dot6 GetPointSize() const override
77 return TextAbstraction::FontClient::DEFAULT_POINT_SIZE;
81 * @copydoc FontCacheItemInterface::GetGlyphIndex()
83 GlyphIndex GetGlyphIndex(Character character) const override
89 * @copydoc FontCacheItemInterface::GetTypeface()
91 FT_Face GetTypeface() const override
97 * @copydoc FontCacheItemInterface::HasItalicStyle()
99 bool HasItalicStyle() const override
104 BitmapFont font; ///< The bitmap font.
105 std::vector<Devel::PixelBuffer> pixelBuffers; ///< The pixel buffers of the glyphs.
106 FontId id; ///< Index to the vector with the cache of font's ids.
109 } // namespace Dali::TextAbstraction::Internal
111 #endif //DALI_INTERNAL_TEXT_ABSTRACTION_BITMAP_FONT_CACHE_ITEM_H