Merge "Set proper locale to harfbuzz" into devel/master
[platform/core/uifw/dali-adaptor.git] / text / dali / internal / text-abstraction / font-client-impl.cpp
index b749fe9..4ab90bf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 // CLASS HEADER
 #include <dali/internal/text-abstraction/font-client-impl.h>
 
+// EXTERNAL INCLUDES
+#ifndef DALI_PROFILE_UBUNTU
+#include <vconf.h>
+#endif
+
 // INTERNAL INCLUDES
 #include <singleton-service.h>
 #include <dali/internal/text-abstraction/font-client-plugin-impl.h>
@@ -80,12 +85,28 @@ void FontClient::SetDpi( unsigned int horizontalDpi, unsigned int verticalDpi  )
   }
 }
 
-void FontClient::SetDefaultFontFamily( const std::string& fontFamilyName,
-                                       const std::string& fontStyle )
+void FontClient::GetDpi( unsigned int& horizontalDpi, unsigned int& verticalDpi )
+{
+  horizontalDpi = mDpiHorizontal;
+  verticalDpi = mDpiVertical;
+}
+
+int FontClient::GetDefaultFontSize()
+{
+  int fontSize( -1 );
+
+#ifndef DALI_PROFILE_UBUNTU
+  vconf_get_int( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &fontSize );
+#endif // DALI_PROFILE_UBUNTU
+
+  return fontSize;
+}
+
+void FontClient::ResetSystemDefaults()
 {
   CreatePlugin();
 
-  mPlugin->SetDefaultFontFamily( fontFamilyName, fontStyle );
+  mPlugin->ResetSystemDefaults();
 }
 
 void FontClient::GetDefaultFonts( FontList& defaultFonts )
@@ -95,6 +116,13 @@ void FontClient::GetDefaultFonts( FontList& defaultFonts )
   mPlugin->GetDefaultFonts( defaultFonts );
 }
 
+void FontClient::GetDefaultPlatformFontDescription( FontDescription& fontDescription )
+{
+  CreatePlugin();
+
+  mPlugin->GetDefaultPlatformFontDescription( fontDescription );
+}
+
 void FontClient::GetDescription( FontId id, FontDescription& fontDescription )
 {
   CreatePlugin();
@@ -109,6 +137,13 @@ PointSize26Dot6 FontClient::GetPointSize( FontId id )
   return mPlugin->GetPointSize( id );
 }
 
+bool FontClient::IsCharacterSupportedByFont( FontId fontId, Character character )
+{
+  CreatePlugin();
+
+  return mPlugin->IsCharacterSupportedByFont( fontId, character );
+}
+
 void FontClient::GetSystemFonts( FontList& systemFonts )
 {
   CreatePlugin();
@@ -116,11 +151,28 @@ void FontClient::GetSystemFonts( FontList& systemFonts )
   mPlugin->GetSystemFonts( systemFonts );
 }
 
-FontId FontClient::FindDefaultFont( Character charcode, PointSize26Dot6 pointSize, bool preferColor )
+FontId FontClient::FindDefaultFont( Character charcode,
+                                    PointSize26Dot6 requestedPointSize,
+                                    bool preferColor )
+{
+  CreatePlugin();
+
+  return mPlugin->FindDefaultFont( charcode,
+                                   requestedPointSize,
+                                   preferColor );
+}
+
+FontId FontClient::FindFallbackFont( Character charcode,
+                                     const FontDescription& preferredFontDescription,
+                                     PointSize26Dot6 requestedPointSize,
+                                     bool preferColor )
 {
   CreatePlugin();
 
-  return mPlugin->FindDefaultFont( charcode, pointSize, preferColor );
+  return mPlugin->FindFallbackFont( charcode,
+                                    preferredFontDescription,
+                                    requestedPointSize,
+                                    preferColor );
 }
 
 bool FontClient::IsScalable( const FontPath& path )
@@ -130,11 +182,11 @@ bool FontClient::IsScalable( const FontPath& path )
   return mPlugin->IsScalable( path );
 }
 
-bool FontClient::IsScalable( const FontFamily& fontFamily, const FontStyle& style )
+bool FontClient::IsScalable( const FontDescription& fontDescription )
 {
   CreatePlugin();
 
-  return mPlugin->IsScalable( fontFamily, style );
+  return mPlugin->IsScalable( fontDescription );
 }
 
 void FontClient::GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes )
@@ -144,32 +196,32 @@ void FontClient::GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26D
   mPlugin->GetFixedSizes( path, sizes );
 }
 
-void FontClient::GetFixedSizes( const FontFamily& fontFamily,
-                                const FontStyle& style,
+void FontClient::GetFixedSizes( const FontDescription& fontDescription,
                                 Dali::Vector< PointSize26Dot6 >& sizes )
 {
   CreatePlugin();
 
-  mPlugin->GetFixedSizes( fontFamily, style, sizes );
+  mPlugin->GetFixedSizes( fontDescription, sizes );
 }
 
-FontId FontClient::GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex )
+FontId FontClient::GetFontId( const FontPath& path, PointSize26Dot6 requestedPointSize, FaceIndex faceIndex )
 {
   CreatePlugin();
 
-  return mPlugin->GetFontId( path, pointSize, faceIndex );
+  return mPlugin->GetFontId( path,
+                             requestedPointSize,
+                             faceIndex,
+                             true );
 }
 
-FontId FontClient::GetFontId( const FontFamily& fontFamily,
-                              const FontStyle& fontStyle,
-                              PointSize26Dot6 pointSize,
+FontId FontClient::GetFontId( const FontDescription& fontDescription,
+                              PointSize26Dot6 requestedPointSize,
                               FaceIndex faceIndex )
 {
   CreatePlugin();
 
-  return mPlugin->GetFontId( fontFamily,
-                             fontStyle,
-                             pointSize,
+  return mPlugin->GetFontId( fontDescription,
+                             requestedPointSize,
                              faceIndex );
 }
 
@@ -187,18 +239,46 @@ GlyphIndex FontClient::GetGlyphIndex( FontId fontId, Character charcode )
   return mPlugin->GetGlyphIndex( fontId, charcode );
 }
 
-bool FontClient::GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal )
+bool FontClient::GetGlyphMetrics( GlyphInfo* array, uint32_t size, GlyphType type, bool horizontal )
+{
+  CreatePlugin();
+
+  return mPlugin->GetGlyphMetrics( array, size, type, horizontal );
+}
+
+void FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, Dali::TextAbstraction::FontClient::GlyphBufferData& data, int outlineWidth )
+{
+  CreatePlugin();
+
+  mPlugin->CreateBitmap( fontId, glyphIndex, data, outlineWidth );
+}
+
+PixelData FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, int outlineWidth )
+{
+  CreatePlugin();
+
+  return mPlugin->CreateBitmap( fontId, glyphIndex, outlineWidth );
+}
+
+void FontClient::CreateVectorBlob( FontId fontId, GlyphIndex glyphIndex, VectorBlob*& blob, unsigned int& blobLength, unsigned int& nominalWidth, unsigned int& nominalHeight )
+{
+  CreatePlugin();
+
+  return mPlugin->CreateVectorBlob( fontId, glyphIndex, blob, blobLength, nominalWidth, nominalHeight );
+}
+
+const GlyphInfo& FontClient::GetEllipsisGlyph( PointSize26Dot6 requestedPointSize )
 {
   CreatePlugin();
 
-  return mPlugin->GetGlyphMetrics( array, size, horizontal );
+  return mPlugin->GetEllipsisGlyph( requestedPointSize );
 }
 
-BufferImage FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex )
+bool FontClient::IsColorGlyph( FontId fontId, GlyphIndex glyphIndex )
 {
   CreatePlugin();
 
-  return mPlugin->CreateBitmap( fontId, glyphIndex );
+  return mPlugin->IsColorGlyph( fontId, glyphIndex );
 }
 
 void FontClient::CreatePlugin()