1 #ifndef __DALI_INTERNAL_TEXT_ABSTRACTION_FONT_CLIENT_IMPL_H__
2 #define __DALI_INTERNAL_TEXT_ABSTRACTION_FONT_CLIENT_IMPL_H__
5 * Copyright (c) 2015 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/public-api/text-abstraction/font-client.h>
30 namespace TextAbstraction
37 * Conversion from Fractional26.6 to float
41 const float FROM_266 = 1.0f / 64.0f;
45 * Implementation of the FontClient
47 class FontClient : public Dali::BaseObject
62 * @copydoc Dali::FontClient::Get()
64 static Dali::TextAbstraction::FontClient Get();
67 * @copydoc Dali::FontClient::SetDpi()
69 void SetDpi( unsigned int horizontalDpi, unsigned int verticalDpi );
72 * @copydoc Dali::FontClient::GetSystemFonts()
74 void GetSystemFonts( FontList& systemFonts );
77 * @copydoc Dali::FontClient::FindSystemFont()
79 bool FindSystemFont( Character charcode, FontDescription& systemFont );
82 * @copydoc Dali::FontClient::GetFontId()
84 FontId GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex );
87 * @copydoc Dali::FontClient::FindDefaultFont()
89 FontId FindDefaultFont( Character charcode );
92 * @copydoc Dali::FontClient::GetFontMetrics()
94 void GetFontMetrics( FontId fontId, FontMetrics& metrics );
97 * @copydoc Dali::FontClient::GetGlyphIndex()
99 GlyphIndex GetGlyphIndex( FontId fontId, Character charcode );
102 * @copydoc Dali::FontClient::CreateMetrics()
104 bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal );
107 * @copydoc Dali::FontClient::CreateBitmap()
109 BitmapImage CreateBitmap( FontId fontId, GlyphIndex glyphIndex );
114 * Helper for lazy initialization.
118 // Undefined copy constructor.
119 FontClient( const FontClient& );
121 // Undefined assignment constructor.
122 FontClient& operator=( FontClient& );
129 // Allows DPI to be set without loading plugin
130 unsigned int mDpiHorizontal;
131 unsigned int mDpiVertical;
133 }; // class FontClient
135 } // namespace Internal
137 inline static Internal::FontClient& GetImplementation(FontClient& fontClient)
139 DALI_ASSERT_ALWAYS( fontClient && "fontClient handle is empty" );
140 BaseObject& handle = fontClient.GetBaseObject();
141 return static_cast<Internal::FontClient&>(handle);
144 inline static const Internal::FontClient& GetImplementation(const FontClient& fontClient)
146 DALI_ASSERT_ALWAYS( fontClient && "fontClient handle is empty" );
147 const BaseObject& handle = fontClient.GetBaseObject();
148 return static_cast<const Internal::FontClient&>(handle);
151 } // namespace TextAbstraction
155 #endif // __DALI_INTERNAL_TEXT_ABSTRACTION_FONT_CLIENT_IMPL_H__