1 #ifndef DALI_INTERNAL_TEXT_ABSTRACTION_VECTOR_FONT_CACHE_H
2 #define DALI_INTERNAL_TEXT_ABSTRACTION_VECTOR_FONT_CACHE_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.
24 #include FT_FREETYPE_H
26 #include <dali/integration-api/debug.h>
29 #include <dali/devel-api/text-abstraction/glyph-info.h>
30 #include <dali/devel-api/text-abstraction/text-abstraction-definitions.h>
35 namespace TextAbstraction
42 * A cache of vector-based font data.
51 VectorFontCache( FT_Library freeTypeLibrary );
59 * @brief Get the font ID for a vector-based font.
61 * @param[in] url The path to the font file.
62 * @return A valid font ID, or zero if the font does not exist.
64 FontId GetFontId( const std::string& url );
67 * @brief Get the unscaled metrics for a glyph.
69 * @param[in] vectorFontId The font ID for a vector-based font.
70 * @param[in,out] array A glyph-info structure with initialized FontId & GlyphIndex value.
71 * On return the size, bearing and advance values will be set.
73 void GetGlyphMetrics( FontId vectorFontId, GlyphInfo& glyph_info );
76 * @brief Get the vector representation of a glyph.
78 * @param[in] vectorFontId The font ID for a vector-based font.
79 * @param[in] fontId The equivalent font ID.
80 * @param[in] glyphIndex The index of a glyph within the specified font.
81 * @param[out] blob A blob of data; this is owned by VectorFontCache and should be copied by the caller of GetVectorBlob().
82 * @param[out] blobLength The length of the blob data, or zero if the blob creation failed.
83 * @param[out] nominalWidth The width of the blob.
84 * @param[out] nominalHeight The height of the blob.
86 void GetVectorBlob( FontId vectorFontId, FontId fontId, GlyphIndex glyphIndex, VectorBlob*& blob, unsigned int& blobLength, unsigned int& nominalWidth, unsigned int& nominalHeight );
91 * @brief Get the font ID for a vector-based font.
93 * @param[in] url The path to the font file.
94 * @param[out] fontId A valid font ID, or zero if the font does not exist.
95 * @return True if the font was found.
97 bool FindFont( const std::string& url, FontId& fontId ) const;
100 * @brief Add a new vector-based font to the cache.
102 * @param[in] url The path to the font file.
103 * @return A valid font ID, or zero if the font does not exist.
105 FontId CreateFont( const std::string& url );
107 // Undefined copy constructor.
108 VectorFontCache( const VectorFontCache& );
110 // Undefined assignment constructor.
111 VectorFontCache& operator=( const VectorFontCache& );
119 } // namespace Internal
121 } // namespace TextAbstraction
125 #endif // DALI_INTERNAL_TEXT_ABSTRACTION_VECTOR_FONT_CACHE_H