Add IsColorFont to font client 09/324809/1
authorBowon Ryu <bowon.ryu@samsung.com>
Tue, 27 May 2025 05:34:38 +0000 (14:34 +0900)
committerBowon Ryu <bowon.ryu@samsung.com>
Tue, 27 May 2025 05:34:38 +0000 (14:34 +0900)
Change-Id: I53cf9fb88ac5810b92d2a9bdb0819e82105f4927
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
dali/devel-api/text-abstraction/font-client.cpp
dali/devel-api/text-abstraction/font-client.h
dali/internal/text/text-abstraction/font-client-impl.cpp
dali/internal/text/text-abstraction/font-client-impl.h
dali/internal/text/text-abstraction/plugin/bitmap-font-cache-item.h
dali/internal/text/text-abstraction/plugin/font-cache-item-interface.h
dali/internal/text/text-abstraction/plugin/font-client-plugin-impl.cpp
dali/internal/text/text-abstraction/plugin/font-client-plugin-impl.h
dali/internal/text/text-abstraction/plugin/font-face-cache-item.cpp
dali/internal/text/text-abstraction/plugin/font-face-cache-item.h

index d4ac74ff1cae2699acfafda0274456b7664d4336..8767d8e8c6b3970d5daebe80dfa2cbaf8fae6db6 100644 (file)
@@ -295,6 +295,11 @@ bool FontClient::IsColorGlyph(FontId fontId, GlyphIndex glyphIndex)
   return GetImplementation(*this).IsColorGlyph(fontId, glyphIndex);
 }
 
+bool FontClient::IsColorFont(FontId fontId)
+{
+  return GetImplementation(*this).IsColorFont(fontId);
+}
+
 bool FontClient::AddCustomFontDirectory(const FontPath& path)
 {
   return GetImplementation(*this).AddCustomFontDirectory(path);
index ceff0061f89f0c5f665a1add25fb699d4ae39177..42c820b6483206257dc78a52ef7c9e12623792f5 100644 (file)
@@ -506,6 +506,15 @@ public:
    */
   bool IsColorGlyph(FontId fontId, GlyphIndex glyphIndex);
 
+  /**
+   * @brief Whether the given glyph font is a color.
+   *
+   * @param[in] fontId The font id.
+   *
+   * @return @e true if the font is a color one.
+   */
+  bool IsColorFont(FontId fontId);
+
   /**
    * @brief  Add custom fonts directory
    *
index 2e6beab4ea3e32d5d12010794a0762dd8252405f..2a5332530e0f00455e644ed5babeb0dfe0ab4ba4 100644 (file)
@@ -639,6 +639,13 @@ bool FontClient::IsColorGlyph(FontId fontId, GlyphIndex glyphIndex)
   return mPlugin->IsColorGlyph(fontId, glyphIndex);
 }
 
+bool FontClient::IsColorFont(FontId fontId)
+{
+  CreatePlugin();
+
+  return mPlugin->IsColorFont(fontId);
+}
+
 GlyphIndex FontClient::CreateEmbeddedItem(const TextAbstraction::FontClient::EmbeddedItemDescription& description, Pixel::Format& pixelFormat)
 {
   CreatePlugin();
index 0713b14501691472ad9c20b0e433e40b90b6b7e3..c1077b8ddc5b14861ddb2e915974a45e08232279 100644 (file)
@@ -288,6 +288,11 @@ public: // API for Dali::TextAbstraction::FontClient used.
    */
   bool IsColorGlyph(FontId fontId, GlyphIndex glyphIndex);
 
+  /**
+   * @copydoc Dali::TextAbstraction::FontClient::IsColorFont()
+   */
+  bool IsColorFont(FontId fontId);
+
   /**
    * @copydoc Dali::TextAbstraction::FontClient::CreateEmbeddedItem()
    */
index eb1f1704664d8be04d59bb97340b978655b17ea3..6c7e491639b9e0a5c0525431682bd2545ad4e58c 100644 (file)
@@ -69,6 +69,14 @@ struct BitmapFontCacheItem : public FontCacheItemInterface
     return true;
   }
 
+  /**
+   * @copydoc FontCacheItemInterface::IsColorFont()
+   */
+  bool IsColorFont() const override
+  {
+    return true;
+  }
+
   /**
    * @copydoc FontCacheItemInterface::IsCharacterSupported()
    */
index 6da01dab6c337aa43ebdc6f39cec14eec123b102..9889ab2d2419c8a9eba7e02efd35369aba833919 100644 (file)
@@ -65,6 +65,13 @@ struct FontCacheItemInterface
    */
   virtual bool IsColorGlyph(GlyphIndex glyphIndex) const = 0;
 
+  /**
+   * Return true if the font is colored
+   *
+   * @return true if the font is colored
+   */
+  virtual bool IsColorFont() const = 0;
+
   /**
    * Check if the character is supported by this font
    * @param[in] fontConfig A handle to a FontConfig library instance.
index 06fbc6b24051814625d070528f7ba60c4c8b3069..da4b67242496c2f827d1f2d760b501072e92c957 100644 (file)
@@ -1061,6 +1061,12 @@ bool FontClient::Plugin::IsColorGlyph(FontId fontId, GlyphIndex glyphIndex) cons
   return fontCacheItem && fontCacheItem->IsColorGlyph(glyphIndex);
 }
 
+bool FontClient::Plugin::IsColorFont(FontId fontId) const
+{
+  const FontCacheItemInterface* fontCacheItem = GetCachedFontItem(fontId);
+  return fontCacheItem && fontCacheItem->IsColorFont();
+}
+
 FT_FaceRec_* FontClient::Plugin::GetFreetypeFace(FontId fontId) const
 {
   const FontCacheItemInterface* fontCacheItem = GetCachedFontItem(fontId);
index 1acb766f8879989804a067c9467ac1fca11ae969..509337eb6191a07e6fc3fda30a4b2495f469d86f 100644 (file)
@@ -265,6 +265,11 @@ public: // Dali::TextAbstraction::FontClient
    */
   bool IsColorGlyph(FontId fontId, GlyphIndex glyphIndex) const;
 
+  /**
+   * @copydoc Dali::TextAbstraction::FontClient::IsColorFont()
+   */
+  bool IsColorFont(FontId fontId) const;
+
   /**
    * @copydoc Dali::TextAbstraction::FontClient::CreateEmbeddedItem()
    */
index 9e47c61613922fcaa84e196774d07920086a3061..4ac3fc15b62fc2e02895a269e03895d9299fbcb6 100644 (file)
@@ -598,6 +598,11 @@ bool FontFaceCacheItem::IsColorGlyph(GlyphIndex glyphIndex) const
   return FT_Err_Ok == error;
 }
 
+bool FontFaceCacheItem::IsColorFont() const
+{
+  return mHasColorTables;
+}
+
 /**
  * Check if the character is supported by this font
  * @param[in] fontConfig A handle to a FontConfig library instance.
index 5cd55c2e638ec789d0765d58fda719b557cf0665..ef1512ed31394acbdae5480a8f3129f3a69f0e4f 100644 (file)
@@ -92,6 +92,11 @@ struct FontFaceCacheItem : public FontCacheItemInterface
    */
   bool IsColorGlyph(GlyphIndex glyphIndex) const override;
 
+  /**
+   * @copydoc FontCacheItemInterface::IsColorFont()
+   */
+  bool IsColorFont() const override;
+
   /**
    * @copydoc FontCacheItemInterface::IsCharacterSupported()
    */