Merge branch 'devel/master' into tizen
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Tue, 14 Dec 2021 05:36:23 +0000 (14:36 +0900)
committerSeoyeon Kim <seoyeon2.kim@samsung.com>
Tue, 14 Dec 2021 05:36:23 +0000 (14:36 +0900)
Change-Id: Iba8de4e2fe18cd7aeab3088f44e10d6adb83491a

dali/internal/accessibility/bridge/bridge-impl.cpp
dali/internal/text/text-abstraction/plugin/font-client-plugin-impl.cpp
dali/internal/text/text-abstraction/plugin/font-face-cache-item.cpp
dali/public-api/dali-adaptor-version.cpp
packaging/dali-adaptor.spec

index b072033..19d519a 100644 (file)
 
 using namespace Dali::Accessibility;
 
+namespace // unnamed namespace
+{
+
+const int RETRY_INTERVAL = 1000;
+
+} // unnamed namespace
+
 /**
  * @brief The BridgeImpl class is to implement some Bridge functions.
  */
@@ -72,6 +79,9 @@ class BridgeImpl : public virtual BridgeBase,
   Dali::Actor                                                   mHighlightedActor;
   std::function<void(Dali::Actor)>                              mHighlightClearAction;
   Dali::CallbackBase*                                           mIdleCallback          = NULL;
+  Dali::Timer                                                   mInitializeTimer;
+  Dali::Timer                                                   mReadIsEnabledTimer;
+  Dali::Timer                                                   mReadScreenReaderEnabledTimer;
 
 public:
   BridgeImpl()
@@ -225,6 +235,24 @@ public:
     mApplication.mWindows.clear();
   }
 
+  void StopTimer()
+  {
+    if(mInitializeTimer)
+    {
+      mInitializeTimer.Stop();
+    }
+
+    if(mReadIsEnabledTimer)
+    {
+      mReadIsEnabledTimer.Stop();
+    }
+
+    if(mReadScreenReaderEnabledTimer)
+    {
+      mReadScreenReaderEnabledTimer.Stop();
+    }
+  }
+
   /**
    * @copydoc Dali::Accessibility::Bridge::Terminate()
    */
@@ -236,6 +264,7 @@ public:
       mData->mHighlightActor            = {};
     }
     ForceDown();
+    StopTimer();
     if((NULL != mIdleCallback) && Dali::Adaptor::IsAvailable())
     {
       Dali::Adaptor::Get().RemoveIdle(mIdleCallback);
@@ -414,6 +443,12 @@ public:
     }
   }
 
+  bool ReadIsEnabledTimerCallback()
+  {
+    ReadIsEnabledProperty();
+    return false;
+  }
+
   void ReadIsEnabledProperty()
   {
     mAccessibilityStatusClient.property<bool>("IsEnabled").asyncGet([this](DBus::ValueOrError<bool> msg) {
@@ -422,7 +457,12 @@ public:
         DALI_LOG_ERROR("Get IsEnabled property error: %s\n", msg.getError().message.c_str());
         if(msg.getError().errorType == DBus::ErrorType::INVALID_REPLY)
         {
-          ReadIsEnabledProperty();
+          if(!mReadIsEnabledTimer)
+          {
+            mReadIsEnabledTimer = Dali::Timer::New(RETRY_INTERVAL);
+            mReadIsEnabledTimer.TickSignal().Connect(this, &BridgeImpl::ReadIsEnabledTimerCallback);
+          }
+          mReadIsEnabledTimer.Start();
         }
         return;
       }
@@ -449,6 +489,12 @@ public:
     });
   }
 
+  bool ReadScreenReaderEnabledTimerCallback()
+  {
+    ReadScreenReaderEnabledProperty();
+    return false;
+  }
+
   void ReadScreenReaderEnabledProperty()
   {
     mAccessibilityStatusClient.property<bool>("ScreenReaderEnabled").asyncGet([this](DBus::ValueOrError<bool> msg) {
@@ -457,7 +503,12 @@ public:
         DALI_LOG_ERROR("Get ScreenReaderEnabled property error: %s\n", msg.getError().message.c_str());
         if(msg.getError().errorType == DBus::ErrorType::INVALID_REPLY)
         {
-          ReadScreenReaderEnabledProperty();
+          if(!mReadScreenReaderEnabledTimer)
+          {
+            mReadScreenReaderEnabledTimer = Dali::Timer::New(RETRY_INTERVAL);
+            mReadScreenReaderEnabledTimer.TickSignal().Connect(this, &BridgeImpl::ReadScreenReaderEnabledTimerCallback);
+          }
+          mReadScreenReaderEnabledTimer.Start();
         }
         return;
       }
@@ -506,6 +557,16 @@ public:
     return true;
   }
 
+  bool InitializeTimerCallback()
+  {
+    if ( InitializeAccessibilityStatusClient() )
+    {
+      ReadAndListenProperties();
+      return false;
+    }
+    return true;
+  }
+
   bool OnIdleSignal()
   {
     if ( InitializeAccessibilityStatusClient() )
@@ -515,7 +576,15 @@ public:
       return false;
     }
 
-    return true;
+    if(!mInitializeTimer)
+    {
+      mInitializeTimer = Dali::Timer::New(RETRY_INTERVAL);
+      mInitializeTimer.TickSignal().Connect(this, &BridgeImpl::InitializeTimerCallback);
+    }
+    mInitializeTimer.Start();
+
+    mIdleCallback = NULL;
+    return false;
   }
 
   /**
index 40d3f32..5668718 100644 (file)
@@ -1567,16 +1567,17 @@ FontId FontClient::Plugin::CreateFont(const FontPath& path,
       }
       else
       {
+        FT_Size_Metrics& ftMetrics = ftFace->size->metrics;
+
+        FontMetrics metrics(static_cast<float>(ftMetrics.ascender) * FROM_266,
+                            static_cast<float>(ftMetrics.descender) * FROM_266,
+                            static_cast<float>(ftMetrics.height) * FROM_266,
+                            static_cast<float>(ftFace->underline_position) * FROM_266,
+                            static_cast<float>(ftFace->underline_thickness) * FROM_266);
+
         const float fixedWidth  = static_cast<float>(ftFace->available_sizes[fixedSizeIndex].width);
         const float fixedHeight = static_cast<float>(ftFace->available_sizes[fixedSizeIndex].height);
 
-        // Indicate that the font is a fixed sized bitmap
-        FontMetrics metrics(fixedHeight, // The ascender in pixels.
-                            0.0f,
-                            fixedHeight, // The height in pixels.
-                            0.0f,
-                            0.0f);
-
         // Create the FreeType font face item to cache.
         FontFaceCacheItem fontFaceCacheItem(mFreeTypeLibrary, ftFace, path, requestedPointSize, faceIndex, metrics, fixedSizeIndex, fixedWidth, fixedHeight, hasColorTables);
 
index 894500e..92a1ff2 100644 (file)
@@ -90,9 +90,9 @@ void FontFaceCacheItem::GetFontMetrics(FontMetrics& metrics, unsigned int dpiVer
     {
       const float scaleFactor = desiredFixedSize / mFixedHeightPixels;
 
-      metrics.ascender           = metrics.ascender * scaleFactor;
-      metrics.descender          = metrics.descender * scaleFactor;
-      metrics.height             = metrics.height * scaleFactor;
+      metrics.ascender           = round(metrics.ascender * scaleFactor);
+      metrics.descender          = round(metrics.descender * scaleFactor);
+      metrics.height             = round(metrics.height * scaleFactor);
       metrics.underlinePosition  = metrics.underlinePosition * scaleFactor;
       metrics.underlineThickness = metrics.underlineThickness * scaleFactor;
     }
@@ -117,7 +117,15 @@ bool FontFaceCacheItem::GetGlyphMetrics(GlyphInfo& glyph, unsigned int dpiVertic
       glyph.height   = mFixedHeightPixels;
       glyph.advance  = mFixedWidthPixels;
       glyph.xBearing = 0.0f;
-      glyph.yBearing = mFixedHeightPixels;
+
+      if(horizontal)
+      {
+        glyph.yBearing += static_cast<float>(ftFace->glyph->metrics.horiBearingY) * FROM_266;
+      }
+      else
+      {
+        glyph.yBearing += static_cast<float>(ftFace->glyph->metrics.vertBearingY) * FROM_266;
+      }
 
       // Adjust the metrics if the fixed-size font should be down-scaled
       const float desiredFixedSize = static_cast<float>(mRequestedPointSize) * FROM_266 / POINTS_PER_INCH * dpiVertical;
@@ -125,12 +133,11 @@ bool FontFaceCacheItem::GetGlyphMetrics(GlyphInfo& glyph, unsigned int dpiVertic
       if(desiredFixedSize > 0.f)
       {
         const float scaleFactor = desiredFixedSize / mFixedHeightPixels;
-
-        glyph.width    = glyph.width * scaleFactor;
-        glyph.height   = glyph.height * scaleFactor;
-        glyph.advance  = glyph.advance * scaleFactor;
-        glyph.xBearing = glyph.xBearing * scaleFactor;
-        glyph.yBearing = glyph.yBearing * scaleFactor;
+        glyph.width             = round(glyph.width * scaleFactor);
+        glyph.height            = round(glyph.height * scaleFactor);
+        glyph.advance           = round(glyph.advance * scaleFactor);
+        glyph.xBearing          = round(glyph.xBearing * scaleFactor);
+        glyph.yBearing          = round(glyph.yBearing * scaleFactor);
 
         glyph.scaleFactor = scaleFactor;
       }
index ae2e40a..c97b1f4 100644 (file)
@@ -27,7 +27,7 @@ namespace Dali
 {
 const unsigned int ADAPTOR_MAJOR_VERSION = 2;
 const unsigned int ADAPTOR_MINOR_VERSION = 1;
-const unsigned int ADAPTOR_MICRO_VERSION = 1;
+const unsigned int ADAPTOR_MICRO_VERSION = 2;
 const char* const  ADAPTOR_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index d784fd0..5a29b8a 100644 (file)
@@ -17,7 +17,7 @@
 
 Name:       dali2-adaptor
 Summary:    The DALi Tizen Adaptor
-Version:    2.1.1
+Version:    2.1.2
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT