X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fmetrics.h;h=5fad4486f641d90a297d134ebf02e8f572041a35;hp=232360e31cc969fd9a6d370dd2b8e216ad9a79c9;hb=528ee21711fc507b20ddb031cf6b1d71f1f44e75;hpb=726e147d14bb18ef193b102a36d8068b62db89ed diff --git a/dali-toolkit/internal/text/metrics.h b/dali-toolkit/internal/text/metrics.h index 232360e..5fad448 100644 --- a/dali-toolkit/internal/text/metrics.h +++ b/dali-toolkit/internal/text/metrics.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TOOLKIT_TEXT_METRICS_H__ -#define __DALI_TOOLKIT_TEXT_METRICS_H__ +#ifndef DALI_TOOLKIT_TEXT_METRICS_H +#define DALI_TOOLKIT_TEXT_METRICS_H /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -19,37 +19,33 @@ */ // EXTERNAL INCLUDES -#include #include +#include // INTERNAL INCLUDES #include namespace Dali { - namespace Toolkit { - namespace Text { - class Metrics; typedef IntrusivePtr MetricsPtr; /** - * @brief A wrapper around FontClient used to get metrics & potentially down-scaled Emoji metrics. + * @brief A wrapper around FontClient used to get metrics. */ class Metrics : public RefObject { public: - /** * Create a new Metrics object */ - static Metrics* New( TextAbstraction::FontClient& fontClient ) + static Metrics* New(TextAbstraction::FontClient& fontClient) { - return new Metrics( fontClient ); + return new Metrics(fontClient); } /** @@ -57,40 +53,20 @@ public: * * @param[in] glyphType The type of glyph; note that metrics for bitmap & vector based glyphs are different. */ - void SetGlyphType( TextAbstraction::GlyphType glyphType ) + void SetGlyphType(TextAbstraction::GlyphType glyphType) { mGlyphType = glyphType; } /** - * @brief Set the maximum Emoji size. - * - * @param[in] emojiSize Emoticons will be scaled to fit this size in pixels. - */ - void SetMaxEmojiSize( int emojiSize ) - { - mEmojiSize = emojiSize; - } - - /** - * @brief Get the maximum Emoji size. - * - * @return The maximum Emoji size. - */ - int GetMaxEmojiSize() const - { - return mEmojiSize; - } - - /** * @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. */ - void GetFontMetrics( FontId fontId, FontMetrics& metrics ) + void GetFontMetrics(FontId fontId, FontMetrics& metrics) { - mFontClient.GetFontMetrics( fontId, metrics, mEmojiSize ); // inline for performance + mFontClient.GetFontMetrics(fontId, metrics); // inline for performance } /** @@ -102,27 +78,38 @@ public: * @param[in] size The size of the array. * @return True if all of the requested metrics were found. */ - bool GetGlyphMetrics( GlyphInfo* array, uint32_t size ) + bool GetGlyphMetrics(GlyphInfo* array, uint32_t size) { - return mFontClient.GetGlyphMetrics( array, size, mGlyphType, true, mEmojiSize ); // inline for performance + return mFontClient.GetGlyphMetrics(array, size, mGlyphType, true); // inline for performance } -protected: + /** + * @brief Whether the font has Italic style. + * + * @param[in] fontId The font identifier. + * + * @return true if the font has italic style. + */ + bool HasItalicStyle(FontId fontId) const + { + return mFontClient.HasItalicStyle(fontId); + } +protected: /** * A reference counted object may only be deleted by calling Unreference() */ - virtual ~Metrics() {} + virtual ~Metrics() + { + } private: - /** * Constructor. */ - Metrics( TextAbstraction::FontClient& fontClient ) - : mFontClient( fontClient ), - mGlyphType( TextAbstraction::BITMAP_GLYPH ), - mEmojiSize( 0 ) + Metrics(TextAbstraction::FontClient& fontClient) + : mFontClient(fontClient), + mGlyphType(TextAbstraction::BITMAP_GLYPH) { } @@ -133,10 +120,8 @@ private: Metrics& operator=(const Metrics& rhs); private: - TextAbstraction::FontClient mFontClient; - TextAbstraction::GlyphType mGlyphType; - int mEmojiSize; + TextAbstraction::GlyphType mGlyphType; }; } // namespace Text @@ -145,4 +130,4 @@ private: } // namespace Dali -#endif // __DALI_TOOLKIT_TEXT_METRICS_H__ +#endif // DALI_TOOLKIT_TEXT_METRICS_H