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::SetDpi()
61 void SetDpi( unsigned int horizontalDpi, unsigned int verticalDpi );
64 * @copydoc Dali::TextAbstraction::FontClient::GetDpi()
66 void GetDpi( unsigned int& horizontalDpi, unsigned int& verticalDpi );
69 * @copydoc Dali::TextAbstraction::FontClient::GetDefaultFontSize()
71 int GetDefaultFontSize();
74 * @copydoc Dali::TextAbstraction::FontClient::ResetSystemDefaults()
76 void ResetSystemDefaults();
79 * @copydoc Dali::TextAbstraction::FontClient::GetDefaultFonts()
81 void GetDefaultFonts( FontList& defaultFonts );
84 * @copydoc Dali::TextAbstraction::FontClient::GetDefaultPlatformFontDescription()
86 void GetDefaultPlatformFontDescription( FontDescription& fontDescription );
89 * @copydoc Dali::TextAbstraction::FontClient::GetSystemFonts()
91 void GetSystemFonts( FontList& systemFonts );
94 * @copydoc Dali::TextAbstraction::FontClient::GetDescription()
96 void GetDescription( FontId id, FontDescription& fontDescription );
99 * @copydoc Dali::TextAbstraction::FontClient::GetPointSize()
101 PointSize26Dot6 GetPointSize( FontId id );
104 * @copydoc Dali::TextAbstraction::FontClient::IsCharacterSupportedByFont()
106 bool IsCharacterSupportedByFont( FontId fontId, Character character );
109 * @copydoc Dali::TextAbstraction::FontClient::FindDefaultFont()
111 FontId FindDefaultFont( Character charcode,
112 PointSize26Dot6 requestedPointSize,
116 * @copydoc Dali::TextAbstraction::FontClient::FindFallbackFont()
118 FontId FindFallbackFont( Character charcode,
119 const FontDescription& preferredFontDescription,
120 PointSize26Dot6 requestedPointSize,
124 * @copydoc Dali::TextAbstraction::FontClient::GetFontId( const FontPath& path, PointSize26Dot6 requestedPointSize, FaceIndex faceIndex )
126 FontId GetFontId( const FontPath& path, PointSize26Dot6 requestedPointSize, FaceIndex faceIndex );
129 * @copydoc Dali::TextAbstraction::FontClient::GetFontId( const FontDescription& fontDescription, PointSize26Dot6 requestedPointSize, FaceIndex faceIndex )
131 FontId GetFontId( const FontDescription& fontDescription,
132 PointSize26Dot6 requestedPointSize,
133 FaceIndex faceIndex );
136 * @copydoc Dali::TextAbstraction::FontClient::IsScalable( const FontPath& path )
138 bool IsScalable( const FontPath& path );
141 * @copydoc Dali::TextAbstraction::FontClient::IsScalable( const FontDescription& fontDescription )
143 bool IsScalable( const FontDescription& fontDescription );
146 * @copydoc Dali::TextAbstraction::FontClient::GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes )
148 void GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes );
151 * @copydoc Dali::TextAbstraction::FontClient::GetFixedSizes()
153 void GetFixedSizes( const FontDescription& fontDescription,
154 Dali::Vector< PointSize26Dot6 >& sizes );
157 * @copydoc Dali::TextAbstraction::FontClient::GetFontMetrics()
159 void GetFontMetrics( FontId fontId, FontMetrics& metrics );
162 * @copydoc Dali::TextAbstraction::FontClient::GetGlyphIndex()
164 GlyphIndex GetGlyphIndex( FontId fontId, Character charcode );
167 * @copydoc Dali::TextAbstraction::FontClient::GetGlyphMetrics()
169 bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, GlyphType type, bool horizontal );
172 * @copydoc Dali::TextAbstraction::FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, Dali::TextAbstraction::FontClient::GlyphBufferData& data, int outlineWidth )
174 void CreateBitmap( FontId fontId, GlyphIndex glyphIndex, Dali::TextAbstraction::FontClient::GlyphBufferData& data, int outlineWidth );
177 * @copydoc Dali::TextAbstraction::FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, int outlineWidth )
179 PixelData CreateBitmap( FontId fontId, GlyphIndex glyphIndex, int outlineWidth );
182 * @copydoc Dali::TextAbstraction::FontClient::CreateVectorBlob()
184 void CreateVectorBlob( FontId fontId, GlyphIndex glyphIndex, VectorBlob*& blob, unsigned int& blobLength, unsigned int& nominalWidth, unsigned int& nominalHeight );
187 * @copydoc Dali::TextAbstraction::FontClient::GetEllipsisGlyph()
189 const GlyphInfo& GetEllipsisGlyph( PointSize26Dot6 requestedPointSize );
192 * @copydoc Dali::TextAbstraction::FontClient::IsColorGlyph()
194 bool IsColorGlyph( FontId fontId, GlyphIndex glyphIndex );
199 * Helper for lazy initialization.
203 // Undefined copy constructor.
204 FontClient( const FontClient& );
206 // Undefined assignment constructor.
207 FontClient& operator=( const FontClient& );
214 // Allows DPI to be set without loading plugin
215 unsigned int mDpiHorizontal;
216 unsigned int mDpiVertical;
218 }; // class FontClient
220 } // namespace Internal
222 inline static Internal::FontClient& GetImplementation(FontClient& fontClient)
224 DALI_ASSERT_ALWAYS( fontClient && "fontClient handle is empty" );
225 BaseObject& handle = fontClient.GetBaseObject();
226 return static_cast<Internal::FontClient&>(handle);
229 inline static const Internal::FontClient& GetImplementation(const FontClient& fontClient)
231 DALI_ASSERT_ALWAYS( fontClient && "fontClient handle is empty" );
232 const BaseObject& handle = fontClient.GetBaseObject();
233 return static_cast<const Internal::FontClient&>(handle);
236 } // namespace TextAbstraction
240 #endif // DALI_INTERNAL_TEXT_ABSTRACTION_FONT_CLIENT_IMPL_H