X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Flayouts%2Flayout-engine.h;h=5e80d8c334c5195632df061144ebace7b56dab33;hb=77f26df9824d174eda53dce2fc5440faddcf9f9b;hp=0c17d681a94a5c2819fc3b8059cfd9288e1bfd4d;hpb=3bdbf66c314bb6036eb35ec0d2f1c9c32652f931;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/layouts/layout-engine.h b/dali-toolkit/internal/text/layouts/layout-engine.h old mode 100644 new mode 100755 index 0c17d68..5e80d8c --- a/dali-toolkit/internal/text/layouts/layout-engine.h +++ b/dali-toolkit/internal/text/layouts/layout-engine.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TOOLKIT_TEXT_LAYOUT_ENGINE_H__ -#define __DALI_TOOLKIT_TEXT_LAYOUT_ENGINE_H__ +#ifndef DALI_TOOLKIT_TEXT_LAYOUT_ENGINE_H +#define DALI_TOOLKIT_TEXT_LAYOUT_ENGINE_H /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -21,101 +21,84 @@ // EXTERNAL INCLUDE #include #include +#include // INTERNAL INCLUDE +#include #include +#include namespace Dali { -struct Vector2; - namespace Toolkit { namespace Text { -struct LayoutParameters; +namespace Layout +{ + +struct Parameters; /** * @brief LayoutEngine is responsible for calculating the visual position of glyphs in layout. */ -class LayoutEngine +class Engine { public: - enum Layout + enum Type { SINGLE_LINE_BOX, MULTI_LINE_BOX }; - enum HorizontalAlignment - { - HORIZONTAL_ALIGN_BEGIN, - HORIZONTAL_ALIGN_CENTER, - HORIZONTAL_ALIGN_END - }; - - enum VerticalAlignment - { - VERTICAL_ALIGN_TOP, - VERTICAL_ALIGN_CENTER, - VERTICAL_ALIGN_BOTTOM - }; - /** * @brief Create a new instance of a LayoutEngine. */ - LayoutEngine(); + Engine(); /** * @brief Virtual destructor. */ - ~LayoutEngine(); + ~Engine(); /** - * @brief Choose the required layout. - * - * @param[in] layout The required layout. - */ - void SetLayout( Layout layout ); - - /** - * @brief Query the required layout. + * @brief Provide the wrapper around FontClient used to get metrics * - * @return The required layout. + * @param[in] metrics Used to get metrics */ - unsigned int GetLayout() const; + void SetMetrics( MetricsPtr& metrics ); /** - * @brief Choose the required text horizontal alignment. + * @brief Choose the required layout. * - * @param[in] alignment The required alignment. + * @param[in] layout The required layout. */ - void SetHorizontalAlignment( HorizontalAlignment alignment ); + void SetLayout( Type layout ); /** - * @brief Query the required text horizontal alignment. + * @brief Query the required layout. * - * @return The required alignment. + * @return The required layout. */ - HorizontalAlignment GetHorizontalAlignment() const; + Type GetLayout() const; /** - * @brief Choose the required text vertical alignment. + * @brief Sets the width of the cursor. * - * @param[in] alignment The required alignment. + * @param[in] width The width of the cursor in pixels. */ - void SetVerticalAlignment( VerticalAlignment alignment ); + void SetCursorWidth( int width ); /** - * @brief Query the required text vertical alignment. + * @brief Retrieves the width of the cursor. * - * @return The required alignment. + * @return The width of the cursor in pixels. */ - VerticalAlignment GetVerticalAlignment() const; + int GetCursorWidth() const; /** * @brief Store the visual position of glyphs in the VisualModel. @@ -123,14 +106,16 @@ public: * @param[in] layoutParameters The parameters needed to layout the text. * @param[out] glyphPositions The positions of all the glyphs. * @param[out] lines The laid-out lines. - * @param[out] actualSize The size of the text after it has been laid-out. + * @param[out] layoutSize The size of the text after it has been laid-out. + * @param[in] elideTextEnabled Whether the text elide is enabled. * * @return \e true if the text has been re-laid-out. \e false means the given width is too small to layout even a single character. */ - bool LayoutText( const LayoutParameters& layoutParameters, + bool LayoutText( const Parameters& layoutParameters, Vector& glyphPositions, Vector& lines, - Size& actualSize ); + Size& layoutSize, + bool elideTextEnabled ); /** * @brief Re-lays out those lines with right to left characters. @@ -138,41 +123,70 @@ public: * It doesn't change the phisical position of the glyphs in the model but sets their new position. * * @param[in] layoutParameters The parameters needed to layout the text. + * @param[in] startIndex Character index of the line from where the lines are reordered. + * @param[in] numberOfCharacters The number of characters. * @param[in,out] glyphPositions The positions of all the glyphs. */ - void ReLayoutRightToLeftLines( const LayoutParameters& layoutParameters, + void ReLayoutRightToLeftLines( const Parameters& layoutParameters, + CharacterIndex startIndex, + Length numberOfCharacters, Vector& glyphPositions ); /** * @brief Aligns the laid out lines. * - * @param[in] layoutParameters The parameters needed to layout the text. - * @param[in] layoutSize The size of the laid out the text. - * @param[in] lines The laid-out lines. - * @param[in,out] glyphPositions The positions of all the glyphs. + * @param[in] size The size of the container where the text is laid-out. + * @param[in] startIndex Character index of the line from where the lines are aligned. + * @param[in] numberOfCharacters The number of characters. + * @param[in] horizontalAlignment The horizontal alignment. + * @param[in,out] lines The laid-out lines. + * @param[out] alignmentOffset The alignment offset. + * @param[in] layoutDirection The direction of the system language. + * @param[in] matchSystemLanguageDirection Whether match align for system language direction or not. + */ + void Align( const Size& size, + CharacterIndex startIndex, + Length numberOfCharacters, + Text::HorizontalAlignment::Type horizontalAlignment, + Vector& lines, + float& alignmentOffset, + Dali::LayoutDirection::Type layoutDirection, + bool matchSystemLanguageDirection ); + + /** + * @brief Sets the default line spacing. + * + * @param[in] lineSpacing The line spacing. + */ + void SetDefaultLineSpacing( float lineSpacing ); + + /** + * @brief Retrieves the default line spacing. + * + * @return The line spacing. */ - void Align( const LayoutParameters& layoutParameters, - const Size& layoutSize, - const Vector& lines, - Vector& glyphPositions ); + float GetDefaultLineSpacing() const; private: // Undefined - LayoutEngine( const LayoutEngine& handle ); + Engine( const Engine& handle ); // Undefined - LayoutEngine& operator=( const LayoutEngine& handle ); + Engine& operator=( const Engine& handle ); private: struct Impl; Impl* mImpl; }; + +} // namespace Layout + } // namespace Text } // namespace Toolkit } // namespace Dali -#endif // __DALI_TOOLKIT_TEXT_LAYOUT_ENGINE_H__ +#endif // DALI_TOOLKIT_TEXT_LAYOUT_ENGINE_H