Retrieve outline glyph from freetype
[platform/core/uifw/dali-adaptor.git] / text / dali / devel-api / text-abstraction / font-client.h
index 885fe6c..8c8cfca 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_PLATFORM_TEXT_ABSTRACTION_FONT_CLIENT_H
 
 /*
- * Copyright (c) 2016 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.
@@ -64,6 +64,29 @@ class DALI_IMPORT_API FontClient : public BaseHandle
 public:
   static const PointSize26Dot6 DEFAULT_POINT_SIZE; ///< The default point size.
 
+  /**
+   * @brief Struct used to retrieve the glyph's bitmap.
+   */
+  struct GlyphBufferData
+  {
+    /**
+     * @brief Constructor.
+     *
+     * Initializes struct members to their defaults.
+     */
+    GlyphBufferData();
+
+    /**
+     * @brief Destructor.
+     */
+    ~GlyphBufferData();
+
+    unsigned char* buffer; ///< The glyph's bitmap buffer data.
+    unsigned int   width;  ///< The width of the bitmap.
+    unsigned int   height; ///< The height of the bitmap.
+    Pixel::Format  format; ///< The pixel's format of the bitmap.
+  };
+
 public:
 
   /**
@@ -123,6 +146,15 @@ public:
   void GetDpi( unsigned int& horizontalDpi, unsigned int& verticalDpi );
 
   /**
+   * @brief Called by Dali to retrieve the default font size for the platform.
+   *
+   * This is an accessibility size, which is mapped to a UI Control specific point-size in stylesheets.
+   * For example if zero the smallest size, this could potentially map to TextLabel point-size 8.
+   * @return The default font size.
+   */
+  int GetDefaultFontSize();
+
+  /**
    * @brief Called when the user changes the system defaults.
    *
    * @post Previously cached system defaults are removed.
@@ -168,6 +200,16 @@ public:
   PointSize26Dot6 GetPointSize( FontId id );
 
   /**
+   * @brief Whether the given @p character is supported by the font.
+   *
+   * @param[in] fontId The id of the font.
+   * @param[in] character The character.
+   *
+   * @return @e true if the character is supported by the font.
+   */
+  bool IsCharacterSupportedByFont( FontId fontId, Character character );
+
+  /**
    * @brief Find the default font for displaying a UTF-32 character.
    *
    * This is useful when localised strings are provided for multiple languages
@@ -306,12 +348,25 @@ public:
   /**
    * @brief Create a bitmap representation of a glyph.
    *
+   * @note The caller is responsible for deallocating the bitmap data @p data.buffer using delete[].
+   *
    * @param[in] fontId The identifier of the font.
    * @param[in] glyphIndex The index of a glyph within the specified font.
+   * @param[out] data The bitmap data.
+   * @param[in] outlineWidth The width of the glyph outline in pixels.
+   */
+  void CreateBitmap( FontId fontId, GlyphIndex glyphIndex, GlyphBufferData& data, int outlineWidth );
+
+  /**
+   * @brief Create a bitmap representation of a glyph.
+   *
+   * @param[in] fontId The identifier of the font.
+   * @param[in] glyphIndex The index of a glyph within the specified font.
+   * @param[in] outlineWidth The width of the glyph outline in pixels.
    *
    * @return A valid BufferImage, or an empty handle if the glyph could not be rendered.
    */
-  PixelData CreateBitmap( FontId fontId, GlyphIndex glyphIndex );
+  PixelData CreateBitmap( FontId fontId, GlyphIndex glyphIndex, int outlineWidth );
 
   /**
    * @brief Create a vector representation of a glyph.
@@ -340,6 +395,16 @@ public:
    */
   const GlyphInfo& GetEllipsisGlyph( PointSize26Dot6 requestedPointSize );
 
+  /**
+   * @brief Whether the given glyph @p glyphIndex is a color glyph.
+   *
+   * @param[in] fontId The font id.
+   * @param[in] glyphIndex The glyph index.
+   *
+   * @return @e true if the glyph is a color one.
+   */
+  bool IsColorGlyph( FontId fontId, GlyphIndex glyphIndex );
+
 public: // Not intended for application developers
   /**
    * @brief This constructor is used by FontClient::Get().