1 #ifndef DALI_INTERNAL_TEXT_ABSTRACTION_FONT_CLIENT_IMPL_H
2 #define DALI_INTERNAL_TEXT_ABSTRACTION_FONT_CLIENT_IMPL_H
5 * Copyright (c) 2017 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/object/base-object.h>
25 #include <dali/devel-api/text-abstraction/font-client.h>
30 namespace TextAbstraction
37 * Implementation of the FontClient
39 class FontClient : public BaseObject
54 * @copydoc Dali::TextAbstraction::FontClient::Get()
56 static Dali::TextAbstraction::FontClient Get();
59 * @copydoc Dali::TextAbstraction::FontClient::ClearCache()
64 * @copydoc Dali::TextAbstraction::FontClient::SetDpi()
66 void SetDpi( unsigned int horizontalDpi, unsigned int verticalDpi );
69 * @copydoc Dali::TextAbstraction::FontClient::GetDpi()
71 void GetDpi( unsigned int& horizontalDpi, unsigned int& verticalDpi );
74 * @copydoc Dali::TextAbstraction::FontClient::GetDefaultFontSize()
76 int GetDefaultFontSize();
79 * @copydoc Dali::TextAbstraction::FontClient::ResetSystemDefaults()
81 void ResetSystemDefaults();
84 * @copydoc Dali::TextAbstraction::FontClient::GetDefaultFonts()
86 void GetDefaultFonts( FontList& defaultFonts );
89 * @copydoc Dali::TextAbstraction::FontClient::GetDefaultPlatformFontDescription()
91 void GetDefaultPlatformFontDescription( FontDescription& fontDescription );
94 * @copydoc Dali::TextAbstraction::FontClient::GetSystemFonts()
96 void GetSystemFonts( FontList& systemFonts );
99 * @copydoc Dali::TextAbstraction::FontClient::GetDescription()
101 void GetDescription( FontId id, FontDescription& fontDescription );
104 * @copydoc Dali::TextAbstraction::FontClient::GetPointSize()
106 PointSize26Dot6 GetPointSize( FontId id );
109 * @copydoc Dali::TextAbstraction::FontClient::IsCharacterSupportedByFont()
111 bool IsCharacterSupportedByFont( FontId fontId, Character character );
114 * @copydoc Dali::TextAbstraction::FontClient::FindDefaultFont()
116 FontId FindDefaultFont( Character charcode,
117 PointSize26Dot6 requestedPointSize,
121 * @copydoc Dali::TextAbstraction::FontClient::FindFallbackFont()
123 FontId FindFallbackFont( Character charcode,
124 const FontDescription& preferredFontDescription,
125 PointSize26Dot6 requestedPointSize,
129 * @copydoc Dali::TextAbstraction::FontClient::GetFontId( const FontPath& path, PointSize26Dot6 requestedPointSize, FaceIndex faceIndex )
131 FontId GetFontId( const FontPath& path, PointSize26Dot6 requestedPointSize, FaceIndex faceIndex );
134 * @copydoc Dali::TextAbstraction::FontClient::GetFontId( const FontDescription& fontDescription, PointSize26Dot6 requestedPointSize, FaceIndex faceIndex )
136 FontId GetFontId( const FontDescription& fontDescription,
137 PointSize26Dot6 requestedPointSize,
138 FaceIndex faceIndex );
141 * @copydoc Dali::TextAbstraction::FontClient::IsScalable( const FontPath& path )
143 bool IsScalable( const FontPath& path );
146 * @copydoc Dali::TextAbstraction::FontClient::IsScalable( const FontDescription& fontDescription )
148 bool IsScalable( const FontDescription& fontDescription );
151 * @copydoc Dali::TextAbstraction::FontClient::GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes )
153 void GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes );
156 * @copydoc Dali::TextAbstraction::FontClient::GetFixedSizes()
158 void GetFixedSizes( const FontDescription& fontDescription,
159 Dali::Vector< PointSize26Dot6 >& sizes );
162 * @copydoc Dali::TextAbstraction::FontClient::GetFontMetrics()
164 void GetFontMetrics( FontId fontId, FontMetrics& metrics );
167 * @copydoc Dali::TextAbstraction::FontClient::GetGlyphIndex()
169 GlyphIndex GetGlyphIndex( FontId fontId, Character charcode );
172 * @copydoc Dali::TextAbstraction::FontClient::GetGlyphMetrics()
174 bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, GlyphType type, bool horizontal );
177 * @copydoc Dali::TextAbstraction::FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, bool softwareItalic, bool softwareBold, Dali::TextAbstraction::FontClient::GlyphBufferData& data, int outlineWidth )
179 void CreateBitmap( FontId fontId, GlyphIndex glyphIndex, bool softwareItalic, bool softwareBold, Dali::TextAbstraction::FontClient::GlyphBufferData& data, int outlineWidth );
182 * @copydoc Dali::TextAbstraction::FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, int outlineWidth )
184 PixelData CreateBitmap( FontId fontId, GlyphIndex glyphIndex, int outlineWidth );
187 * @copydoc Dali::TextAbstraction::FontClient::CreateVectorBlob()
189 void CreateVectorBlob( FontId fontId, GlyphIndex glyphIndex, VectorBlob*& blob, unsigned int& blobLength, unsigned int& nominalWidth, unsigned int& nominalHeight );
192 * @copydoc Dali::TextAbstraction::FontClient::GetEllipsisGlyph()
194 const GlyphInfo& GetEllipsisGlyph( PointSize26Dot6 requestedPointSize );
197 * @copydoc Dali::TextAbstraction::FontClient::IsColorGlyph()
199 bool IsColorGlyph( FontId fontId, GlyphIndex glyphIndex );
202 * @copydoc Dali::TextAbstraction::FontClient::AddCustomFontDirectory()
204 bool AddCustomFontDirectory( const FontPath& path );
209 * Helper for lazy initialization.
213 // Undefined copy constructor.
214 FontClient( const FontClient& );
216 // Undefined assignment constructor.
217 FontClient& operator=( const FontClient& );
224 // Allows DPI to be set without loading plugin
225 unsigned int mDpiHorizontal;
226 unsigned int mDpiVertical;
228 }; // class FontClient
230 } // namespace Internal
232 inline static Internal::FontClient& GetImplementation(FontClient& fontClient)
234 DALI_ASSERT_ALWAYS( fontClient && "fontClient handle is empty" );
235 BaseObject& handle = fontClient.GetBaseObject();
236 return static_cast<Internal::FontClient&>(handle);
239 inline static const Internal::FontClient& GetImplementation(const FontClient& fontClient)
241 DALI_ASSERT_ALWAYS( fontClient && "fontClient handle is empty" );
242 const BaseObject& handle = fontClient.GetBaseObject();
243 return static_cast<const Internal::FontClient&>(handle);
246 } // namespace TextAbstraction
250 #endif // DALI_INTERNAL_TEXT_ABSTRACTION_FONT_CLIENT_IMPL_H