Merge remote-tracking branch 'origin/tizen' into new_text 09/36309/4
authorPaul Wisbey <p.wisbey@samsung.com>
Wed, 4 Mar 2015 18:08:51 +0000 (18:08 +0000)
committerPaul Wisbey <p.wisbey@samsung.com>
Wed, 4 Mar 2015 19:16:57 +0000 (19:16 +0000)
Conflicts:
build/tizen/dali-toolkit/Makefile.am
dali-toolkit/dali-toolkit.h
dali-toolkit/internal/controls/buttons/button-impl.cpp
dali-toolkit/internal/controls/buttons/push-button-impl.cpp
dali-toolkit/internal/controls/text-input/text-input-decorator-impl.cpp
dali-toolkit/internal/controls/text-input/text-input-impl.cpp
dali-toolkit/internal/controls/text-input/text-input-popup-impl.cpp
dali-toolkit/public-api/controls/text-input/text-input.h
dali-toolkit/public-api/controls/text-view/text-view.h

Change-Id: I47246662ec5ea38428d62f11f9dd5e5bc0c50dd1

17 files changed:
1  2 
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h
automated-tests/src/dali-toolkit/utc-Dali-PushButton.cpp
build/tizen/configure.ac
build/tizen/dali-toolkit/Makefile.am
dali-toolkit/dali-toolkit.h
dali-toolkit/internal/controls/buttons/button-impl.cpp
dali-toolkit/internal/controls/buttons/push-button-impl.cpp
dali-toolkit/internal/controls/buttons/radio-button-impl.h
dali-toolkit/internal/controls/popup/popup-impl.cpp
dali-toolkit/internal/controls/slider/slider-impl.cpp
dali-toolkit/internal/file.list
dali-toolkit/public-api/controls/text-controls/text-field.h
dali-toolkit/public-api/controls/text-controls/text-label.h
dali-toolkit/public-api/file.list
dali-toolkit/public-api/text/rendering/basic/text-basic-renderer.cpp
dali-toolkit/public-api/text/text-script.cpp
packaging/dali-toolkit.spec

Simple merge
Simple merge
  #include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
  #include <dali-toolkit/public-api/focus-manager/keyinput-focus-manager.h>
  
 -#include <dali-toolkit/public-api/markup-processor/markup-processor.h>
 -
+ #include <dali-toolkit/public-api/scripting/script.h>
+ #include <dali-toolkit/public-api/scripting/script-plugin.h>
  #include <dali-toolkit/public-api/shader-effects/alpha-discard-effect.h>
  #include <dali-toolkit/public-api/shader-effects/bendy-effect.h>
  #include <dali-toolkit/public-api/shader-effects/blind-effect.h>
@@@ -233,7 -229,9 +228,6 @@@ float Button::GetAnimationTime() cons
  
  void Button::SetLabel( const std::string& label )
  {
-   RelayoutRequest();
 -  Toolkit::TextView textView = Toolkit::TextView::New( label );
 -  textView.SetWidthExceedPolicy( Toolkit::TextView::ShrinkToFit ); // Make sure our text always fits inside the button
 -  SetLabel( textView );
  }
  
  void Button::SetLabel( Actor label )
@@@ -24,8 -23,7 +23,6 @@@
  #include <dali/public-api/object/type-registry.h>
  
  // INTERNAL INCLUDES
- #include "push-button-default-painter-impl.h"
 -#include <dali-toolkit/public-api/controls/text-view/text-view.h>
  #include <dali-toolkit/internal/controls/relayout-helper.h>
  
  namespace Dali
Simple merge
index 4d97b03,0000000..0f1b4fd
mode 100644,000000..100644
--- /dev/null
@@@ -1,134 -1,0 +1,134 @@@
-   static const Property::Index PROPERTY_RENDERING_BACKEND;       ///< name "rendering-backend",       type INT
-   static const Property::Index PROPERTY_PLACEHOLDER_TEXT;        ///< name "placeholder-text",        type STRING
-   static const Property::Index PROPERTY_TEXT;                    ///< name "text",                    type STRING
-   static const Property::Index PROPERTY_CURSOR_IMAGE;            ///< name "cursor-image",            type STRING
-   static const Property::Index PROPERTY_PRIMARY_CURSOR_COLOR;    ///< name "primary-cursor-color",    type VECTOR4
-   static const Property::Index PROPERTY_SECONDARY_CURSOR_COLOR;  ///< name "secondary-cursor-color",  type VECTOR4
-   static const Property::Index PROPERTY_ENABLE_CURSOR_BLINK;     ///< name "enable-cursor-blink",     type BOOLEAN
-   static const Property::Index PROPERTY_CURSOR_BLINK_INTERVAL;   ///< name "cursor-blink-interval",   type FLOAT
-   static const Property::Index PROPERTY_CURSOR_BLINK_DURATION;   ///< name "cursor-blink-duration",   type FLOAT
-   static const Property::Index PROPERTY_GRAB_HANDLE_IMAGE;       ///< name "grab-handle-image",       type STRING
-   static const Property::Index PROPERTY_DECORATION_BOUNDING_BOX; ///< name "decoration-bounding-box", type RECTANGLE
 +#ifndef __DALI_TOOLKIT_TEXT_FIELD_H__
 +#define __DALI_TOOLKIT_TEXT_FIELD_H__
 +
 +/*
 + * Copyright (c) 2015 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.
 + * You may obtain a copy of the License at
 + *
 + * http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + *
 + */
 +
 +// INTERNAL INCLUDES
 +#include <dali-toolkit/public-api/controls/control.h>
 +#include <dali-toolkit/public-api/text/rendering/text-renderer.h>
 +
 +namespace Dali
 +{
 +
 +namespace Toolkit
 +{
 +
 +namespace Internal DALI_INTERNAL
 +{
 +class TextField;
 +}
 +
 +/**
 + * @brief A control which provides a single-line editable text field.
 + */
 +class DALI_IMPORT_API TextField : public Control
 +{
 +public:
 +
 +  // Property indices
++  static const Dali::Property::Index PROPERTY_RENDERING_BACKEND;       ///< name "rendering-backend",       type INT
++  static const Dali::Property::Index PROPERTY_PLACEHOLDER_TEXT;        ///< name "placeholder-text",        type STRING
++  static const Dali::Property::Index PROPERTY_TEXT;                    ///< name "text",                    type STRING
++  static const Dali::Property::Index PROPERTY_CURSOR_IMAGE;            ///< name "cursor-image",            type STRING
++  static const Dali::Property::Index PROPERTY_PRIMARY_CURSOR_COLOR;    ///< name "primary-cursor-color",    type VECTOR4
++  static const Dali::Property::Index PROPERTY_SECONDARY_CURSOR_COLOR;  ///< name "secondary-cursor-color",  type VECTOR4
++  static const Dali::Property::Index PROPERTY_ENABLE_CURSOR_BLINK;     ///< name "enable-cursor-blink",     type BOOLEAN
++  static const Dali::Property::Index PROPERTY_CURSOR_BLINK_INTERVAL;   ///< name "cursor-blink-interval",   type FLOAT
++  static const Dali::Property::Index PROPERTY_CURSOR_BLINK_DURATION;   ///< name "cursor-blink-duration",   type FLOAT
++  static const Dali::Property::Index PROPERTY_GRAB_HANDLE_IMAGE;       ///< name "grab-handle-image",       type STRING
++  static const Dali::Property::Index PROPERTY_DECORATION_BOUNDING_BOX; ///< name "decoration-bounding-box", type RECTANGLE
 +
 +  // Property names
 +  static const std::string RENDERING_BACKEND_PROPERTY_NAME;      ///< Property, name "rendering-backend",       type INT
 +  static const std::string PLACEHOLDER_TEXT_PROPERTY_NAME;       ///< Property, name "placeholder-text",        type STRING
 +  static const std::string TEXT_PROPERTY_NAME;                   ///< Property, name "text",                    type STRING
 +  static const std::string CURSOR_IMAGE_PROPERTY_NAME;           ///< Property, name "cursor-image",            type STRING
 +  static const std::string PRIMARY_CURSOR_COLOR_PROPERTY_NAME;   ///< Property, name "primary-cursor-color",    type VECTOR4
 +  static const std::string SECONDARY_CURSOR_COLOR_PROPERTY_NAME; ///< Property, name "secondary-cursor-color",  type VECTOR4
 +  static const std::string ENABLE_CURSOR_BLINK_PROPERTY_NAME;    ///< Property, name "enable-cursor-blink",     type BOOLEAN
 +  static const std::string CURSOR_BLINK_INTERVAL_PROPERTY_NAME;  ///< Property, name "cursor-blink-interval",   type FLOAT
 +  static const std::string CURSOR_BLINK_DURATION_PROPERTY_NAME;  ///< Property, name "cursor-blink-duration",   type FLOAT
 +  static const std::string GRAB_HANDLE_IMAGE_PROPERTY_NAME;      ///< Property, name "grab-handle-image",       type STRING
 +  static const std::string DECORATION_BOUNDING_BOX;              ///< Property, name "decoration-bounding-box", type RECTANGLE
 +
 +  /**
 +   * Create the TextField control.
 +   * @return A handle to the TextField control.
 +   */
 +  static TextField New();
 +
 +  /**
 +   * @brief Creates an empty handle.
 +   */
 +  TextField();
 +
 +  /**
 +   * @brief Copy constructor.
 +   *
 +   * @param[in] handle The handle to copy from.
 +   */
 +  TextField( const TextField& handle );
 +
 +  /**
 +   * @brief Assignment operator.
 +   *
 +   * @param[in] handle The handle to copy from.
 +   * @return A reference to this.
 +   */
 +  TextField& operator=( const TextField& handle );
 +
 +  /**
 +   * @brief Destructor
 +   *
 +   * This is non-virtual since derived Handle types must not contain data or virtual methods.
 +   */
 +  ~TextField();
 +
 +  /**
 +   * @brief Downcast a handle to TextField.
 +   *
 +   * If the BaseHandle points is a TextField the downcast returns a valid handle.
 +   * If not the returned handle is left empty.
 +   *
 +   * @param[in] handle Handle to an object
 +   * @return handle to a TextField or an empty handle
 +   */
 +  static TextField DownCast( BaseHandle handle );
 +
 +public: // Not intended for application developers
 +
 +  /**
 +   * @brief Creates a handle using the Toolkit::Internal implementation.
 +   *
 +   * @param[in] implementation The Control implementation.
 +   */
 +  DALI_INTERNAL TextField( Internal::TextField& implementation );
 +
 +  /**
 +   * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
 +   *
 +   * @param[in]  internal  A pointer to the internal CustomActor.
 +   */
 +  explicit DALI_INTERNAL TextField( Dali::Internal::CustomActor* internal );
 +};
 +
 +} // namespace Toolkit
 +
 +} // namespace Dali
 +
 +#endif // __DALI_TOOLKIT_TEXT_FIELD_H__
index 00398b3,0000000..e1f69c0
mode 100644,000000..100644
--- /dev/null
@@@ -1,120 -1,0 +1,120 @@@
-   static const Property::Index PROPERTY_RENDERING_BACKEND; ///< name "rendering-backend", type INT
-   static const Property::Index PROPERTY_TEXT;              ///< name "text", type STRING
-   static const Property::Index PROPERTY_MULTI_LINE;        ///< name "multi-line", type BOOLEAN
 +#ifndef __DALI_TOOLKIT_TEXT_LABEL_H__
 +#define __DALI_TOOLKIT_TEXT_LABEL_H__
 +
 +/*
 + * Copyright (c) 2015 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.
 + * You may obtain a copy of the License at
 + *
 + * http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + *
 + */
 +
 +// INTERNAL INCLUDES
 +#include <dali-toolkit/public-api/controls/control.h>
 +#include <dali-toolkit/public-api/text/rendering/text-renderer.h>
 +
 +namespace Dali
 +{
 +
 +namespace Toolkit
 +{
 +
 +namespace Internal DALI_INTERNAL
 +{
 +class TextLabel;
 +}
 +
 +/**
 + * @brief A control which renders a short text string.
 + *
 + * Text labels are lightweight, non-editable and do not respond to user input.
 + */
 +class DALI_IMPORT_API TextLabel : public Control
 +{
 +public:
 +
 +  // Property indices
++  static const Dali::Property::Index PROPERTY_RENDERING_BACKEND; ///< name "rendering-backend", type INT
++  static const Dali::Property::Index PROPERTY_TEXT;              ///< name "text", type STRING
++  static const Dali::Property::Index PROPERTY_MULTI_LINE;        ///< name "multi-line", type BOOLEAN
 +
 +  // Property names
 +  static const std::string RENDERING_BACKEND_PROPERTY_NAME; ///< Property, name "rendering-backend", type INT
 +  static const std::string TEXT_PROPERTY_NAME;              ///< Property, name "text", type STRING
 +  static const std::string MULTI_LINE_PROPERTY_NAME;        ///< Property, name "multi-line", type BOOLEAN
 +
 +  /**
 +   * Create the TextLabel control.
 +   * @return A handle to the TextLabel control.
 +   */
 +  static TextLabel New();
 +
 +  /**
 +   * @brief Creates an empty handle.
 +   */
 +  TextLabel();
 +
 +  /**
 +   * @brief Copy constructor.
 +   *
 +   * @param[in] handle The handle to copy from.
 +   */
 +  TextLabel( const TextLabel& handle );
 +
 +  /**
 +   * @brief Assignment operator.
 +   *
 +   * @param[in] handle The handle to copy from.
 +   * @return A reference to this.
 +   */
 +  TextLabel& operator=( const TextLabel& handle );
 +
 +  /**
 +   * @brief Destructor
 +   *
 +   * This is non-virtual since derived Handle types must not contain data or virtual methods.
 +   */
 +  ~TextLabel();
 +
 +  /**
 +   * @brief Downcast a handle to TextLabel.
 +   *
 +   * If the BaseHandle points is a TextLabel the downcast returns a valid handle.
 +   * If not the returned handle is left empty.
 +   *
 +   * @param[in] handle Handle to an object
 +   * @return handle to a TextLabel or an empty handle
 +   */
 +  static TextLabel DownCast( BaseHandle handle );
 +
 +public: // Not intended for application developers
 +
 +  /**
 +   * @brief Creates a handle using the Toolkit::Internal implementation.
 +   *
 +   * @param[in] implementation The Control implementation.
 +   */
 +  DALI_INTERNAL TextLabel( Internal::TextLabel& implementation );
 +
 +  /**
 +   * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
 +   *
 +   * @param[in]  internal  A pointer to the internal CustomActor.
 +   */
 +  explicit DALI_INTERNAL TextLabel( Dali::Internal::CustomActor* internal );
 +};
 +
 +} // namespace Toolkit
 +
 +} // namespace Dali
 +
 +#endif // __DALI_TOOLKIT_TEXT_LABEL_H__
@@@ -94,24 -95,6 +94,24 @@@ public_api_src_files = 
    $(public_api_src_dir)/shader-effects/swirl-effect.cpp \
    $(public_api_src_dir)/shader-effects/water-effect.cpp \
    $(public_api_src_dir)/styling/style-manager.cpp \
-   $(public_api_src_dir)/text/script.cpp \
 +  $(public_api_src_dir)/text/bidirectional-support.cpp \
 +  $(public_api_src_dir)/text/character-set-conversion.cpp \
 +  $(public_api_src_dir)/text/logical-model.cpp \
 +  $(public_api_src_dir)/text/multi-language-support.cpp \
++  $(public_api_src_dir)/text/text-script.cpp \
 +  $(public_api_src_dir)/text/segmentation.cpp \
 +  $(public_api_src_dir)/text/shaper.cpp \
 +  $(public_api_src_dir)/text/text-control-interface.cpp \
 +  $(public_api_src_dir)/text/text-controller.cpp \
 +  $(public_api_src_dir)/text/text-view.cpp \
 +  $(public_api_src_dir)/text/text-view-interface.cpp \
 +  $(public_api_src_dir)/text/visual-model.cpp \
 +  $(public_api_src_dir)/text/decorator/text-decorator.cpp \
 +  $(public_api_src_dir)/text/layouts/layout-engine.cpp \
 +  $(public_api_src_dir)/text/rendering/text-backend.cpp \
 +  $(public_api_src_dir)/text/rendering/text-renderer.cpp \
 +  $(public_api_src_dir)/text/rendering/basic/text-basic-renderer.cpp \
 +  $(public_api_src_dir)/text/rendering/shaders/text-basic-shader.cpp \
    $(public_api_src_dir)/transition-effects/cube-transition-cross-effect.cpp \
    $(public_api_src_dir)/transition-effects/cube-transition-effect.cpp \
    $(public_api_src_dir)/transition-effects/cube-transition-fold-effect.cpp \
index 5cd608f,0000000..b4b8515
mode 100644,000000..100644
--- /dev/null
@@@ -1,321 -1,0 +1,320 @@@
-       BitmapImage bitmap = mFontClient.CreateBitmap( glyph.fontId, glyph.index );
 +/*
 + * Copyright (c) 2015 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.
 + * You may obtain a copy of the License at
 + *
 + * http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + *
 + */
 +
 +// CLASS HEADER
 +#include <dali-toolkit/public-api/text/rendering/basic/text-basic-renderer.h>
 +
 +// INTERNAL INCLUDES
 +#include <dali/public-api/text-abstraction/font-client.h>
 +#include <dali/public-api/actors/mesh-actor.h>
 +#include <dali/public-api/images/atlas.h>
 +#include <dali/public-api/geometry/mesh.h>
 +#include <dali-toolkit/public-api/text/rendering/shaders/text-basic-shader.h>
 +
 +using namespace Dali;
 +using namespace Dali::Toolkit;
 +using namespace Dali::Toolkit::Text;
 +
 +namespace
 +{
 +
 +const std::size_t PADDING = 2; //< To avoid GL filtering artefacts
 +
 +struct TextureCoordinates
 +{
 +  TextureCoordinates()
 +  : topLeft( 0.0f, 0.0f ),
 +    topRight( 1.0f, 0.0f ),
 +    bottomLeft( 0.0f, 1.0f ),
 +    bottomRight( 1.0f, 1.0f )
 +  {
 +  }
 +
 +  Vector2 topLeft;
 +  Vector2 topRight;
 +  Vector2 bottomLeft;
 +  Vector2 bottomRight;
 +};
 +
 +struct AtlasHelperGlyph
 +{
 +  AtlasHelperGlyph()
 +  : fontId( 0 ),
 +    index( 0 ),
 +    xOffset( 0 ),
 +    width( 0 ),
 +    height( 0 )
 +  {
 +  }
 +
 +  AtlasHelperGlyph( FontId id,
 +                    GlyphIndex glyphIndex,
 +                    std::size_t offset,
 +                    std::size_t widthPixels,
 +                    std::size_t heightPixels )
 +  : fontId( id ),
 +    index( glyphIndex ),
 +    xOffset( offset ),
 +    width( widthPixels ),
 +    height( heightPixels )
 +  {
 +  }
 +
 +  FontId fontId;
 +  GlyphIndex index;
 +  std::size_t xOffset;
 +  std::size_t width;
 +  std::size_t height;
 +  TextureCoordinates coords;
 +};
 +
 +struct AtlasHelper
 +{
 +  AtlasHelper()
 +  : mWidth( 0.0f ),
 +    mHeight( 0.0f )
 +  {
 +    mFontClient = TextAbstraction::FontClient::Get();
 +  }
 +
 +  void Reset()
 +  {
 +    mWidth = 0.0f;
 +    mHeight = 0.0f;
 +    mGlyphs.clear();
 +  }
 +
 +  void Reserve( std::size_t size )
 +  {
 +    mGlyphs.reserve( size );
 +  }
 +
 +  bool GlyphFound( FontId fontId, GlyphIndex index ) const
 +  {
 +    for( unsigned int i=0; i<mGlyphs.size(); ++i )
 +    {
 +      const AtlasHelperGlyph& glyph = mGlyphs[i];
 +
 +      if( fontId == glyph.fontId &&
 +          index  == glyph.index )
 +      {
 +        return true;
 +      }
 +    }
 +
 +    return false;
 +  }
 +
 +  void AddGlyph( const GlyphInfo& glyphInfo )
 +  {
 +    mGlyphs.push_back( AtlasHelperGlyph( glyphInfo.fontId, glyphInfo.index, mWidth, glyphInfo.width, glyphInfo.height ) );
 +
 +    mWidth += glyphInfo.width + PADDING;
 +    if( mHeight < glyphInfo.height + PADDING )
 +    {
 +      mHeight = glyphInfo.height + PADDING;
 +    }
 +  }
 +
 +  Atlas CreateAtlas()
 +  {
 +    Atlas atlas = Atlas::New( mWidth, mHeight, Pixel::L8 );
 +
 +    for( unsigned int i=0; i<mGlyphs.size(); ++i )
 +    {
 +      AtlasHelperGlyph& glyph = mGlyphs[i];
-     actor.SetAffectedByLighting( false );
++      BufferImage bitmap = mFontClient.CreateBitmap( glyph.fontId, glyph.index );
 +      atlas.Upload( bitmap, glyph.xOffset, 0 );
 +
 +      TextureCoordinates& coords = glyph.coords;
 +      coords.topLeft.x     = static_cast<float>(glyph.xOffset) / static_cast<float>(mWidth);
 +      coords.topLeft.y     = 0.0f;
 +      coords.topRight.x    = static_cast<float>(glyph.xOffset + glyph.width) / static_cast<float>(mWidth);
 +      coords.topRight.y    = 0.0f;
 +      coords.bottomLeft.x  = static_cast<float>(glyph.xOffset) / static_cast<float>(mWidth);
 +      coords.bottomLeft.y  = static_cast<float>(glyph.height) / static_cast<float>(mHeight);
 +      coords.bottomRight.x = static_cast<float>(glyph.xOffset + glyph.width) / static_cast<float>(mWidth);
 +      coords.bottomRight.y = static_cast<float>(glyph.height) / static_cast<float>(mHeight);
 +    }
 +
 +    return atlas;
 +  }
 +
 +  void GetTextureCoordinates( FontId fontId, GlyphIndex index, TextureCoordinates& coords )
 +  {
 +    for( unsigned int i=0; i<mGlyphs.size(); ++i )
 +    {
 +      const AtlasHelperGlyph& glyph = mGlyphs[i];
 +
 +      if( fontId == glyph.fontId &&
 +          index  == glyph.index )
 +      {
 +        coords = glyph.coords;
 +        return;
 +      }
 +    }
 +  }
 +
 +private: // Data
 +
 +  std::size_t mWidth;
 +  std::size_t mHeight;
 +
 +  std::vector<AtlasHelperGlyph> mGlyphs;
 +
 +  TextAbstraction::FontClient mFontClient;
 +};
 +
 +} // unnamed namespace
 +
 +struct BasicRenderer::Impl
 +{
 +  /**
 +   * @brief Ccreate an Atlas, uploading the necessary glyph bitmaps
 +   *
 +   * @param[in] glyphs The glyphs to upload.
 +   */
 +  Atlas CreateAtlas( const Vector<GlyphInfo>& glyphs )
 +  {
 +    AtlasHelper& helper = mAtlasHelper;
 +
 +    // Clear previous atlas
 +    helper.Reset();
 +    helper.Reserve( glyphs.Count() );
 +
 +    for( unsigned int i=0; i<glyphs.Count(); ++i )
 +    {
 +      float width  = glyphs[i].width;
 +      float height = glyphs[i].height;
 +
 +      if( width > 0 &&
 +          height > 0 ) // skip whitespace
 +      {
 +        if( !helper.GlyphFound( glyphs[i].fontId, glyphs[i].index ) )
 +        {
 +          helper.AddGlyph( glyphs[i] );
 +        }
 +      }
 +    }
 +
 +    // Uploads the bitmaps to Dali
 +    return helper.CreateAtlas();
 +  }
 +
 +  /**
 +   * @brief Helper method to create a mesh with one quad per glyph.
 +   *
 +   * @param[in] glyphs The glyphs to display.
 +   * @param[in] positions The 2D positions of the glyphs.
 +   * @param[in] image The material uses this as a diffuse texture.
 +   */
 +  Mesh CreateMesh( const Vector<GlyphInfo>& glyphs, const std::vector<Vector2>& positions, Image image )
 +  {
 +    MeshData::VertexContainer vertices( 4 * glyphs.Count() ); // 1 quad per glyph
 +
 +    MeshData::FaceIndices faces;
 +    faces.reserve( 6 * glyphs.Count() ); // 2 triangles per quad
 +
 +    for( unsigned int i=0; i<glyphs.Count(); ++i )
 +    {
 +      float width  = glyphs[i].width;
 +      float height = glyphs[i].height;
 +
 +      if( width > 0 &&
 +          height > 0 ) // skip whitespace
 +      {
 +        const Vector2& position = positions[i];
 +
 +        TextureCoordinates coords;
 +        mAtlasHelper.GetTextureCoordinates( glyphs[i].fontId, glyphs[i].index, coords );
 +
 +        vertices[ i*4 + 0 ] = MeshData::Vertex( Vector3( position.x + 0.0f*width, position.y + 0.0f*height, 0.0f ), coords.topLeft,     Vector3( 1.0f, 0.0f, 0.0f ) );
 +        vertices[ i*4 + 1 ] = MeshData::Vertex( Vector3( position.x + 1.0f*width, position.y + 0.0f*height, 0.0f ), coords.topRight,    Vector3( 1.0f, 1.0f, 0.0f ) );
 +        vertices[ i*4 + 2 ] = MeshData::Vertex( Vector3( position.x + 0.0f*width, position.y + 1.0f*height, 0.0f ), coords.bottomLeft,  Vector3( 0.0f, 1.0f, 0.0f ) );
 +        vertices[ i*4 + 3 ] = MeshData::Vertex( Vector3( position.x + 1.0f*width, position.y + 1.0f*height, 0.0f ), coords.bottomRight, Vector3( 0.0f, 0.0f, 1.0f ) );
 +
 +        faces.push_back( i*4 + 0 ); faces.push_back( i*4 + 3 ); faces.push_back( i*4 + 1 );
 +        faces.push_back( i*4 + 0 ); faces.push_back( i*4 + 2 ); faces.push_back( i*4 + 3 );
 +      }
 +    }
 +
 +    Material material = Material::New( "Material" );
 +    material.SetDiffuseTexture( image );
 +
 +    // Create the mesh data from the vertices and faces
 +    MeshData meshData;
 +    meshData.SetHasColor( false );
 +    meshData.SetMaterial( material );
 +    meshData.SetVertices( vertices );
 +    meshData.SetFaceIndices( faces );
 +
 +    // Create a mesh from the data
 +    Dali::Mesh mesh = Mesh::New( meshData );
 +    return mesh;
 +  }
 +
 +  RenderableActor mActor; ///< The actor which renders the text
 +
 +  AtlasHelper mAtlasHelper; ///< A helper class for storing atlas positions etc.
 +};
 +
 +Text::RendererPtr BasicRenderer::New()
 +{
 +  return Text::RendererPtr( new BasicRenderer() );
 +}
 +
 +RenderableActor BasicRenderer::Render( Text::ViewInterface& view )
 +{
 +  UnparentAndReset( mImpl->mActor );
 +
 +  Text::Length numberOfGlyphs = view.GetNumberOfGlyphs();
 +
 +  if( numberOfGlyphs > 0 )
 +  {
 +    Vector<GlyphInfo> glyphs;
 +    glyphs.Resize( numberOfGlyphs );
 +
 +    view.GetGlyphs( &glyphs[0], 0, numberOfGlyphs );
 +
 +    std::vector<Vector2> positions;
 +    positions.resize( numberOfGlyphs );
 +    view.GetGlyphPositions( &positions[0], 0, numberOfGlyphs );
 +
 +    Atlas atlas = mImpl->CreateAtlas( glyphs );
 +
 +    MeshActor actor = MeshActor::New( mImpl->CreateMesh( glyphs, positions, atlas ) );
 +    actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
 +    actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
 +
 +    ShaderEffect shader = BasicShader::New();
 +    actor.SetShaderEffect( shader );
 +
 +    mImpl->mActor = actor;
 +  }
 +
 +  return mImpl->mActor;
 +}
 +
 +BasicRenderer::BasicRenderer()
 +{
 +  mImpl = new Impl();
 +}
 +
 +BasicRenderer::~BasicRenderer()
 +{
 +  delete mImpl;
 +}
Simple merge