*
*/
+// INTERNAL INCLUDES
#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/images/bitmap-image.h>
-#include <dali/public-api/common/dali-vector.h>
-#include <dali/public-api/text-abstraction/text-abstraction-definitions.h>
#include <dali/public-api/text-abstraction/glyph-info.h>
#include <dali/public-api/text-abstraction/font-list.h>
+#include <dali/public-api/text-abstraction/font-metrics.h>
namespace Dali
{
*
* <h3>Accessing Fonts</h3>
*
- * A "font" is created from the system for a specific point size. A "FontId" is used to identify each font.
+ * A "font" is created from the system for a specific point size in 26.6 fractional points. A "FontId" is used to identify each font.
* For example two different fonts with point sizes 10 & 12 can be created from the "Ubuntu Mono" family:
* @code
* FontClient fontClient = FontClient::Get();
- * FontId ubuntuMonoTen = fontClient.GetFontId( "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-R.ttf", 10 );
- * FontId ubuntuMonoTwelve = fontClient.GetFontId( "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-R.ttf", 12 );
+ * FontId ubuntuMonoTen = fontClient.GetFontId( "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-R.ttf", 10*64 );
+ * FontId ubuntuMonoTwelve = fontClient.GetFontId( "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-R.ttf", 12*64 );
* @endcode
* Glyph metrics and bitmap resources can then be retrieved using the FontId.
*/
class DALI_IMPORT_API FontClient : public BaseHandle
{
public:
+ static const PointSize26Dot6 DEFAULT_POINT_SIZE; ///< The default point size.
+
+public:
/**
* @brief Retrieve a handle to the FontClient instance.
*/
FontClient& operator=( const FontClient& handle );
+ ////////////////////////////////////////
+ // Font management and validation.
+ ////////////////////////////////////////
+
/**
* @brief Set the DPI of the target window.
*
void GetSystemFonts( FontList& systemFonts );
/**
- * @brief Find an appropriate system-font for displaying a UTF-32 character.
+ * @brief Retrieves the font description of a given font @p id.
+ *
+ * @param[in] id The font id.
+ * @param[out] fontDescription The path, family & style describing the font.
+ */
+ void GetDescription( FontId id, FontDescription& fontDescription );
+
+ /**
+ * @brief Retrieves the font point size of a given font @p id.
+ *
+ * @param[in] id The font id.
+ *
+ * @return The point size in 26.6 fractional points.
+ */
+ PointSize26Dot6 GetPointSize( FontId id );
+
+ /**
+ * @brief Find an appropriate font for displaying a UTF-32 character.
*
* This is useful when localised strings are provided for multiple languages
* i.e. when a single default font does not work for all languages.
* @param[in] charcode The character for which a font is needed.
- * @param[out] systemFont The path, family & style describing the font.
- * @return True if an appropriate system font was found.
+ * @param[in] pointSize The point size in 26.6 fractional points; the default point size is 12*64.
+ * @return A valid font ID, or zero if the font does not exist.
*/
- bool FindSystemFont( Character charcode, FontDescription& systemFont );
+ FontId FindDefaultFont( Character charcode,
+ PointSize26Dot6 pointSize = DEFAULT_POINT_SIZE );
/**
* @brief Retrieve the unique identifier for a font.
*
* @param[in] path The path to a font file.
- * @param[in] pointSize The point size in 26.6 fractional points; the default point size is 12.
+ * @param[in] pointSize The point size in 26.6 fractional points; the default point size is 12*64.
* @param[in] faceIndex The index of the font face (optional).
* @return A valid font ID, or zero if the font does not exist.
*/
- FontId GetFontId( const FontPath& path, PointSize26Dot6 pointSize = 12*64, FaceIndex faceIndex = 0 );
+ FontId GetFontId( const FontPath& path, PointSize26Dot6 pointSize = DEFAULT_POINT_SIZE, FaceIndex faceIndex = 0 );
/**
- * @brief Retrieve the ID of the default font for displaying a UTF-32 character.
+ * @brief Retrieve the unique identifier for a font.
*
- * This is useful when localised strings are provided for multiple languages
- * i.e. when a single default font does not work for all languages.
- * @param[in] charcode The character for which a font is needed.
- * @return A valid font ID, or zero if no appropriate font was found.
+ * @param[in] fontFamily The font family name.
+ * @param[in] fontStyle The font style.
+ * @param[in] pointSize The point size in 26.6 fractional points; the default point size is 12*64.
+ * @param[in] faceIndex The index of the font face (optional).
+ * @return A valid font ID, or zero if the font does not exist.
+ */
+ FontId GetFontId( const FontFamily& fontFamily,
+ const FontStyle& fontStyle,
+ PointSize26Dot6 pointSize = DEFAULT_POINT_SIZE,
+ FaceIndex faceIndex = 0 );
+
+ ////////////////////////////////////////
+ // Font metrics, glyphs and bitmaps.
+ ////////////////////////////////////////
+
+ /**
+ * @brief Query the metrics for a font.
+ *
+ * @param[in] fontId The ID of the font for the required glyph.
+ * @param[out] metrics The font metrics.
*/
- FontId FindDefaultFont( Character charcode );
+ void GetFontMetrics( FontId fontId, FontMetrics& metrics );
/**
* @brief Retrieve the glyph index for a UTF-32 character code.