1 #ifndef DALI_TEST_ABSTRACTION_INTERNAL_FONT_CACHE_ITEM_INTERFACE_H
2 #define DALI_TEST_ABSTRACTION_INTERNAL_FONT_CACHE_ITEM_INTERFACE_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.
21 #include <dali/devel-api/text-abstraction/font-client.h>
22 #include <dali/devel-api/text-abstraction/font-metrics.h>
23 #include <dali/devel-api/text-abstraction/glyph-info.h>
24 #include <dali/internal/text/text-abstraction/font-client-impl.h> // for HarfBuzzFontHandle
28 #include FT_FREETYPE_H
30 namespace Dali::TextAbstraction::Internal
32 struct FontCacheItemInterface
35 * Get the font metrics
37 * @param[out] metrics The metrics struct to fill out
39 virtual void GetFontMetrics(FontMetrics& metrics, unsigned int dpiVertical) const = 0;
44 * @param[in,out] glyph The glyph to fill
46 virtual bool GetGlyphMetrics(GlyphInfo& glyphInfo, unsigned int dpiVertical, bool horizontal) const = 0;
49 * Create a bitmap for the given glyph
51 * @param[in] glyphIndex The index of the glyph
52 * @param[out] data The bitmap data for the glyph
53 * @param[in] outlineWidth
54 * @param[in] isItalicRequired
55 * @param[in] isBoldRequired
57 virtual void CreateBitmap(GlyphIndex glyphIndex, Dali::TextAbstraction::GlyphBufferData& data, int outlineWidth, bool isItalicRequired, bool isBoldRequired) const = 0;
60 * Return true if the glyph is colored
62 * @param[in] glyphIndex The index of the glyph
63 * @return true if the glyph is colored
65 virtual bool IsColorGlyph(GlyphIndex glyphIndex) const = 0;
68 * Check if the character is supported by this font
69 * @param[in] character The character to test
71 virtual bool IsCharacterSupported(Character character) = 0;
74 * Get the point size of this font
75 * @return the point size
77 virtual PointSize26Dot6 GetPointSize() const = 0;
80 * Get the index into this font's glyph table of the character
82 * @param[in] character to look up
83 * @return the glyph index of this character
85 virtual GlyphIndex GetGlyphIndex(Character character) const = 0;
88 * Get the index into this font's glyph table of the character
90 * @param[in] character to look up
91 * @param[in] variantSelector the variation selector modify character code
92 * @return the glyph index of this character
94 virtual GlyphIndex GetGlyphIndex(Character character, Character variantSelector) const = 0;
97 * Get the freetype typeface for this font.
99 virtual FT_Face GetTypeface() const = 0;
102 * Get the harfbuzz font struct for this font.
104 * @param[in] horizontalDpi Horizontal DPI for this harfbuzz font.
105 * @param[in] verticalDpi Vertical DPI for this harfbuzz font.
106 * @return the harfbuzz font data, or nullptr if failed.
108 virtual HarfBuzzFontHandle GetHarfBuzzFont(const uint32_t& horizontalDpi, const uint32_t& verticalDpi) = 0;
111 * @return true if this font has an italic style
113 virtual bool HasItalicStyle() const = 0;
116 } // namespace Dali::TextAbstraction::Internal
118 #endif // DALI_TEST_ABSTRACTION_INTERNAL_FONT_CACHE_ITEM_INTERFACE_H