Dali-Text: Keyboard Shortcuts
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / layouts / layout-parameters.h
old mode 100644 (file)
new mode 100755 (executable)
index 238dade..b3aeaad
@@ -1,8 +1,8 @@
-#ifndef __DALI_TOOLKIT_TEXT_LAYOUT_PARAMETERS_H__
-#define __DALI_TOOLKIT_TEXT_LAYOUT_PARAMETERS_H__
+#ifndef DALI_TOOLKIT_TEXT_LAYOUT_PARAMETERS_H
+#define DALI_TOOLKIT_TEXT_LAYOUT_PARAMETERS_H
 
 /*
- * Copyright (c) 2015 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.
@@ -22,7 +22,9 @@
 #include <dali/public-api/math/vector2.h>
 
 // INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/text-enumerations.h>
 #include <dali-toolkit/internal/text/text-definitions.h>
+#include <dali-toolkit/internal/text/text-model.h>
 
 namespace Dali
 {
@@ -35,79 +37,52 @@ namespace Text
 
 struct BidirectionalLineInfoRun;
 
+namespace Layout
+{
+
 /**
  * @brief Struct used to pass parameters.
  */
-struct LayoutParameters
+struct Parameters
 {
   /**
    * Constructor with the needed parameters to layout the text.
    *
    * @param[in] boundingBox The size of the box containing the text.
-   * @param[in] textBuffer The text buffer.
-   * @param[in] lineBreakInfoBuffer The line break info.
-   * @param[in] wordBreakInfoBuffer The word break info.
-   * @param[in] characterDirectionBuffer Vector with the direction of each character.
-   * @param[in] glyphsBuffer Vector with glyphs.
-   * @param[in] glyphsToCharactersBuffer Vector with indices pointing the first character of each glyph.
-   * @param[in] charactersPerGlyphBuffer Vector with the number of characters that forms each glyph.
-   * @param[in] charactersToGlyphsBuffer Vector with indices pointing the first glyph of each character.
-   * @param[in] glyphsPerCharacterBuffer Vector with the number of glyphs shaped from the character.
-   * @param[in] totalNumberOfGlyphs The number of glyphs.
+   * @param[in,out] textModel The text's model.
    */
-  LayoutParameters( const Vector2& boundingBox,
-                    const Character* const textBuffer,
-                    const LineBreakInfo* const lineBreakInfoBuffer,
-                    const WordBreakInfo* const wordBreakInfoBuffer,
-                    const CharacterDirection* const characterDirectionBuffer,
-                    const GlyphInfo* const glyphsBuffer,
-                    const CharacterIndex* const glyphsToCharactersBuffer,
-                    const Length* const charactersPerGlyphBuffer,
-                    const GlyphIndex* const charactersToGlyphsBuffer,
-                    const Length* const glyphsPerCharacterBuffer,
-                    Length totalNumberOfGlyphs )
-  : boundingBox( boundingBox ),
-    textBuffer( textBuffer ),
-    lineBreakInfoBuffer( lineBreakInfoBuffer ),
-    wordBreakInfoBuffer( wordBreakInfoBuffer ),
-    characterDirectionBuffer( characterDirectionBuffer ),
-    glyphsBuffer( glyphsBuffer ),
-    glyphsToCharactersBuffer( glyphsToCharactersBuffer ),
-    charactersPerGlyphBuffer( charactersPerGlyphBuffer ),
-    charactersToGlyphsBuffer( charactersToGlyphsBuffer ),
-    glyphsPerCharacterBuffer( glyphsPerCharacterBuffer ),
-    lineBidirectionalInfoRunsBuffer( NULL ),
-    numberOfBidirectionalInfoRuns( 0u ),
-    startGlyphIndex( 0u ),
-    numberOfGlyphs( 0u ),
-    totalNumberOfGlyphs( totalNumberOfGlyphs ),
-    startLineIndex( 0u ),
-    isLastNewParagraph( false )
+  Parameters( const Vector2& boundingBox,
+              ModelPtr textModel )
+  : boundingBox{ boundingBox },
+    textModel{ textModel },
+    lineBidirectionalInfoRunsBuffer{ nullptr },
+    numberOfBidirectionalInfoRuns{ 0u },
+    startGlyphIndex{ 0u },
+    numberOfGlyphs{ 0u },
+    startLineIndex{ 0u },
+    estimatedNumberOfLines{ 0u },
+    interGlyphExtraAdvance{ 0.f },
+    isLastNewParagraph{ false }
   {}
 
   Vector2                         boundingBox;                     ///< The size of the box containing the text.
-  const Character* const          textBuffer;                      ///< The text buffer.
-  const LineBreakInfo* const      lineBreakInfoBuffer;             ///< The line break info.
-  const WordBreakInfo* const      wordBreakInfoBuffer;             ///< The word break info.
-  const CharacterDirection* const characterDirectionBuffer;        ///< Vector with the direction of each character.
-  const GlyphInfo* const          glyphsBuffer;                    ///< Vector with glyphs.
-  const CharacterIndex* const     glyphsToCharactersBuffer;        ///< Vector with indices pointing the first character of each glyph.
-  const Length* const             charactersPerGlyphBuffer;        ///< Vector with the number of characters that forms each glyph.
-  const GlyphIndex* const         charactersToGlyphsBuffer;        ///< Vector with indices pointing the first glyph of each character.
-  const Length* const             glyphsPerCharacterBuffer;        ///< Vector with the number of glyphs shaped from the character.
+  ModelPtr textModel;
   BidirectionalLineInfoRun*       lineBidirectionalInfoRunsBuffer; ///< Bidirectional conversion tables per line.
   Length                          numberOfBidirectionalInfoRuns;   ///< The number of lines with bidirectional info.
   GlyphIndex                      startGlyphIndex;                 ///< Index to the first glyph to layout.
   Length                          numberOfGlyphs;                  ///< The number of glyphs to layout.
-  Length                          totalNumberOfGlyphs;             ///< The number of glyphs.
   LineIndex                       startLineIndex;                  ///< The line index where to insert the new lines.
-  bool                            isLastNewParagraph;              ///< Whether the last character is a new paragraph character.
+  Length                          estimatedNumberOfLines;          ///< The estimated number of lines.
+  float                           interGlyphExtraAdvance;          ///< Extra advance added to each glyph.
+  bool                            isLastNewParagraph:1;            ///< Whether the last character is a new paragraph character.
 };
 
+} // namespace Layout
+
 } // namespace Text
 
 } // namespace Toolkit
 
 } // namespace Dali
 
-#endif // __DALI_TOOLKIT_TEXT_LAYOUT_PARAMETERS_H__
+#endif // DALI_TOOLKIT_TEXT_LAYOUT_PARAMETERS_H