TextArray is now a Dali::Vector instead a std::vector.
Change-Id: Iafebb20da91c8f557d0b6162bb84901dadb1cd1b
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
Text text( std::string( "Hello world" ) );
- DALI_TEST_EQUALS( text.GetImplementation().GetTextArray().size(), 11u, TEST_LOCATION );
+ DALI_TEST_EQUALS( text.GetImplementation().GetTextArray().Count(), 11u, TEST_LOCATION );
END_TEST;
}
/**
* @copydoc PlatformAbstraction::GetFontFamilyForChars()
*/
-const std::string& TestPlatformAbstraction::GetFontFamilyForChars(const TextArray& charsRequested) const
+const std::string& TestPlatformAbstraction::GetFontFamilyForChars(const Integration::TextArray& charsRequested) const
{
mTrace.PushCall("GetFontFamilyForChars", "");
return mGetDefaultFontFamilyResult;
/**
* @copydoc PlatformAbstraction::AllGlyphsSupported()
*/
-bool TestPlatformAbstraction::AllGlyphsSupported(const std::string& name, const std::string& fontStyle, const TextArray& text) const
+bool TestPlatformAbstraction::AllGlyphsSupported(const std::string& name, const std::string& fontStyle, const Integration::TextArray& text) const
{
mTrace.PushCall("AllGlyphsSupported", "");
return true;
/**
* @copydoc PlatformAbstraction::GetFontFamilyForChars()
*/
- virtual const std::string& GetFontFamilyForChars(const TextArray& charsRequested) const;
+ virtual const std::string& GetFontFamilyForChars(const Integration::TextArray& charsRequested) const;
/**
* @copydoc PlatformAbstraction::AllGlyphsSupported()
*/
- virtual bool AllGlyphsSupported(const std::string& name, const std::string& fontStyle, const TextArray& text) const;
+ virtual bool AllGlyphsSupported(const std::string& name, const std::string& fontStyle, const Integration::TextArray& text) const;
/**
* @copydoc PlatformAbstraction::ValidateFontFamilyName()
*/
void DALI_TEST_EQUALS( const char* str1, const std::string &str2, const char* location);
-
/**
* Test whether two UTF32 strings are equal.
* @param[in] str1 The first string
* @param[in] location The TEST_LOCATION macro should be used here
*/
template<>
-inline void DALI_TEST_EQUALS<const TextArray&>( const TextArray& str1, const TextArray& str2, const char* location)
+inline void DALI_TEST_EQUALS<const Integration::TextArray&>( const Integration::TextArray& str1, const Integration::TextArray& str2, const char* location)
{
- if (!std::equal(str1.begin(), str1.end(), str2.begin()))
+ if( !std::equal( str1.Begin(), str1.End(), str2.Begin() ) )
{
fprintf(stderr, "%s, checking '", location);
- for( unsigned int i = 0; i < str1.size(); ++i)
+ for( unsigned int i = 0; i < str1.Count(); ++i )
{
fprintf(stderr, "%c", str1[i]);
}
fprintf(stderr, "' == '");
- for( unsigned int i = 0; i < str2.size(); ++i)
+ for( unsigned int i = 0; i < str2.Count(); ++i )
{
fprintf(stderr, "%c", str2[i]);
}
/**
* @copydoc PlatformAbstraction::GetFontFamilyForChars()
*/
-const std::string& TestPlatformAbstraction::GetFontFamilyForChars(const TextArray& charsRequested) const
+const std::string& TestPlatformAbstraction::GetFontFamilyForChars(const Integration::TextArray& charsRequested) const
{
mTrace.PushCall("GetFontFamilyForChars", "");
return mGetDefaultFontFamilyResult;
/**
* @copydoc PlatformAbstraction::AllGlyphsSupported()
*/
-bool TestPlatformAbstraction::AllGlyphsSupported(const std::string& name, const std::string& fontStyle, const TextArray& text) const
+bool TestPlatformAbstraction::AllGlyphsSupported(const std::string& name, const std::string& fontStyle, const Integration::TextArray& text) const
{
mTrace.PushCall("AllGlyphsSupported", "");
return true;
/**
* @copydoc PlatformAbstraction::GetFontFamilyForChars()
*/
- virtual const std::string& GetFontFamilyForChars(const TextArray& charsRequested) const;
+ virtual const std::string& GetFontFamilyForChars(const Integration::TextArray& charsRequested) const;
/**
* @copydoc PlatformAbstraction::AllGlyphsSupported()
*/
- virtual bool AllGlyphsSupported(const std::string& name, const std::string& fontStyle, const TextArray& text) const;
+ virtual bool AllGlyphsSupported(const std::string& name, const std::string& fontStyle, const Integration::TextArray& text) const;
/**
* @copydoc PlatformAbstraction::ValidateFontFamilyName()
catch( DaliException& e )
{
tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
- DALI_TEST_EQUALS( e.mCondition, "position < mString.size() && \"Text::operator[]: Character position is out of bounds\"", TEST_LOCATION );
+ DALI_TEST_EQUALS( e.mCondition, "position < mString.Count() && \"Text::operator[]: Character position is out of bounds\"", TEST_LOCATION );
assert2 = true;
}
catch( DaliException& e )
{
tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
- DALI_TEST_EQUALS( e.mCondition, "position < mString.size() && \"Text::Remove: Character position is out of bounds\"", TEST_LOCATION );
+ DALI_TEST_EQUALS( e.mCondition, "position < mString.Count() && \"Text::Remove: Character position is out of bounds\"", TEST_LOCATION );
assert1 = true;
}
catch( DaliException& e )
{
tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
- DALI_TEST_EQUALS( e.mCondition, "position + numberOfCharacters <= mString.size() && \"Text::Remove: Character position + numberOfCharacters is out of bounds\"", TEST_LOCATION );
+ DALI_TEST_EQUALS( e.mCondition, "position + numberOfCharacters <= mString.Count() && \"Text::Remove: Character position + numberOfCharacters is out of bounds\"", TEST_LOCATION );
assert2 = true;
}
$(platform_abstraction_src_dir)/platform-abstraction.h \
$(platform_abstraction_src_dir)/shader-data.h \
$(platform_abstraction_src_dir)/system-overlay.h \
- $(platform_abstraction_src_dir)/common/lockless-buffer.h
+ $(platform_abstraction_src_dir)/common/lockless-buffer.h \
+ $(platform_abstraction_src_dir)/text-array.h
platform_abstraction_dynamics_header_files = \
$(platform_abstraction_src_dir)/dynamics/dynamics-body-intf.h \
*
*/
-// EXTERNAL INCLUDES
-#include <stdint.h>
-
// INTERNAL INCLUDES
-#include <dali/integration-api/resource-cache.h>
#include <dali/integration-api/glyph-set.h>
+#include <dali/integration-api/resource-cache.h>
+#include <dali/integration-api/text-array.h>
namespace Dali
{
-typedef std::vector<uint32_t> TextArray;
-
namespace Integration
{
#include <stdint.h>
// INTERNAL INCLUDES
-#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/common/dali-vector.h>
namespace Dali
{
-namespace Internal
+namespace Integration
{
/**
* array of UTF-32 codes.
*/
-typedef std::vector<uint32_t> TextArray;
+typedef Vector<uint32_t> TextArray;
-} // namespace Internal
+} // namespace Integration
} // namespace Dali
namespace Internal
{
-TextAttachmentPtr TextAttachment::New( const SceneGraph::Node& parentNode, const TextArray& text, FontPointer font )
+TextAttachmentPtr TextAttachment::New( const SceneGraph::Node& parentNode, const Integration::TextArray& text, FontPointer font )
{
StagePtr stage = Stage::GetCurrent();
delete mTextColor;
}
-void TextAttachment::SetText(const TextArray& text)
+void TextAttachment::SetText( const Integration::TextArray& text )
{
// return if the text hasn't changed
- if( (text.size() == mText.size() ) &&
- std::equal(mText.begin(), mText.end(), text.begin ()) )
+ if( ( text.Count() == mText.Count() ) &&
+ std::equal( mText.Begin(), mText.End(), text.Begin () ) )
{
return;
}
void TextAttachment::TextChanged()
{
- DALI_LOG_INFO(Debug::Filter::gResource, Debug::Verbose, "TextAttachment::TextChanged() TextModified:%s TextEmpty:%s\n", IsTextModified()?"Y":"N", mText.empty()?"Y":"N");
+ DALI_LOG_INFO(Debug::Filter::gResource, Debug::Verbose, "TextAttachment::TextChanged() TextModified:%s TextEmpty:%s\n", IsTextModified()?"Y":"N", ( 0u == mText.Count() )?"Y":"N");
if( !IsTextModified() )
{
#include <dali/internal/event/actor-attachments/renderable-attachment-impl.h>
#include <dali/internal/event/actor-attachments/actor-attachment-declarations.h>
#include <dali/internal/event/text/font-declarations.h>
-#include <dali/internal/common/text-array.h>
#include <dali/internal/event/text/text-request-helper.h>
#include <dali/internal/event/text/resource/glyph-texture-observer.h>
#include <dali/internal/common/owner-pointer.h>
+#include <dali/integration-api/text-array.h>
namespace Dali
{
* @param [in] font The font which will be used for the text.
* @return A smart-pointer to the newly allocated TextAttachment.
*/
- static TextAttachmentPtr New( const SceneGraph::Node& parentNode, const TextArray& text, FontPointer font );
+ static TextAttachmentPtr New( const SceneGraph::Node& parentNode, const Integration::TextArray& text, FontPointer font );
/**
* Set the text label displayed by the attachment
* @param [in] text The new text label
*/
- void SetText(const TextArray& text);
+ void SetText(const Integration::TextArray& text);
/**
* Get the text label displayed by the attachment
* @return The text label
*/
- const TextArray& GetText() const
+ const Integration::TextArray& GetText() const
{
// This is not animatable; the cached value is up-to-date.
return mText;
///< Font parameters are stored in the FontPointer member. Inside the TextStyle, font parameters and color are allocated in the same struct,
///< so store the text color in the style will allocate space for the font parameters as well, wasting space.
// Cached values for public getters
- TextArray mText;
+ Integration::TextArray mText;
bool mTextChanged:1; ///< whether the text has changed
bool mFontChanged:1; ///< whether the font has changed
}
-TextActorPtr TextActor::New( const TextArray& utfCodes, const TextActorParameters& parameters )
+TextActorPtr TextActor::New( const Integration::TextArray& utfCodes, const TextActorParameters& parameters )
{
// first stage construction
TextActorPtr actor ( new TextActor( parameters.IsAutomaticFontDetectionEnabled() ) );
actor->Initialize();
//create the attachment
- actor->mTextAttachment = TextAttachment::New( *actor->mNode, TextArray(), fontPtr );
+ actor->mTextAttachment = TextAttachment::New( *actor->mNode, Integration::TextArray(), fontPtr );
// Note: SetTextStyle() MUST be called before SetText(), to ensure
// that a single ResourceRequest for the glyphs is made. Calling
const std::string TextActor::GetText() const
{
- const TextArray& utfCodes = mTextAttachment->GetText();
+ const Integration::TextArray& utfCodes = mTextAttachment->GetText();
std::string text;
+ const std::size_t length = utfCodes.Count();
// minimize allocations for ascii strings
- text.reserve(utfCodes.size());
+ text.reserve( length );
- for (unsigned int i = 0; i < utfCodes.size(); ++i)
+ for (unsigned int i = 0; i < length; ++i)
{
unsigned char utf8Data[4];
unsigned int utf8Length;
}
}
-void TextActor::SetText(const TextArray& utfCodes)
+void TextActor::SetText(const Integration::TextArray& utfCodes)
{
StopObservingTextLoads();
#include <dali/internal/event/actors/renderable-actor-impl.h>
#include <dali/internal/event/text/text-observer.h>
#include <dali/internal/event/actor-attachments/actor-attachment-declarations.h>
-#include <dali/internal/common/text-array.h>
+#include <dali/integration-api/text-array.h>
namespace Dali
* @see Dali::TextActor::New( const Text& text, const TextActorParameters& parameters )
* @return A pointer to a new TextActor.
*/
- static TextActorPtr New( const TextArray& utfCodes, const TextActorParameters& parameters );
+ static TextActorPtr New( const Integration::TextArray& utfCodes, const TextActorParameters& parameters );
/**
* @copydoc Dali::Internal::Actor::OnInitialize
* @copybrief Dali::TextActor::SetText(const std::string&)
* @param[in] utfCodes An std::vector containing the UTF-32 codes
*/
- void SetText(const TextArray& utfCodes);
+ void SetText(const Integration::TextArray& utfCodes);
/**
* @copydoc Dali::TextActor::SetToNaturalSize()
} // un-named namespace
-AtlasRanking GetAtlasRanking( const TextArray& text,
+AtlasRanking GetAtlasRanking( const Integration::TextArray& text,
FontId fontId,
const GlyphStatusContainer& container,
bool atlasResizable)
// find if the text will fit or not, and how many characters are missing
container.GetTextStatus( text, fontId, charsNotLoaded, canFit);
- AtlasRanking::CharacterMatch charMatchStatus = GetTextMatchStatus( text.size(), charsNotLoaded );
+ AtlasRanking::CharacterMatch charMatchStatus = GetTextMatchStatus( text.Count(), charsNotLoaded );
AtlasRanking::SpaceStatus spaceStatus = GetAtlasSpaceStatus( canFit, atlasResizable);
* @param[in] atlasResizable whether the atlas is resizable
* @return atlas ranking
*/
- AtlasRanking GetAtlasRanking( const TextArray& text,
+ AtlasRanking GetAtlasRanking( const Integration::TextArray& text,
FontId fontId,
const GlyphStatusContainer& container,
bool atlasResizable);
*/
// INTERNAL INCLUDES
-#include <dali/internal/common/text-array.h>
#include <dali/internal/common/text-vertex-buffer.h>
#include <dali/internal/event/text/font-metrics-interface.h>
#include <dali/internal/event/text/text-format.h>
#include <dali/internal/event/text/text-observer.h>
#include <dali/internal/event/text/resource/glyph-texture-observer.h>
+#include <dali/integration-api/text-array.h>
namespace Dali
{
* @param[in] metric interface to get metric information for the text
* @return text vertex buffer
*/
- virtual TextVertexBuffer* TextRequired( const TextArray& text,
+ virtual TextVertexBuffer* TextRequired( const Integration::TextArray& text,
const TextFormat& format,
FontMetricsInterface& metrics ) = 0;
* @param[in] fontId font id
* @param[in] textureId texture id (each atlas has a single texture)
*/
- virtual void TextNotRequired( const TextArray& text,
+ virtual void TextNotRequired( const Integration::TextArray& text,
const TextFormat& format,
FontId fontId,
unsigned int textureId ) = 0;
* @param[in] textureId texture id (each atlas has a single texture)
* @return true if all characters are available, false if not
*/
- virtual bool IsTextLoaded( const TextArray& text,
- const TextFormat& format,
- FontId fontId,
- unsigned int textureId) const = 0;
+ virtual bool IsTextLoaded( const Integration::TextArray& text,
+ const TextFormat& format,
+ FontId fontId,
+ unsigned int textureId) const = 0;
/**
#include <dali/internal/event/text/atlas/atlas-ranking.h>
#include <dali/internal/event/text/atlas/atlas-size.h>
#include <dali/internal/event/text/atlas/debug/atlas-debug.h>
-#include <dali/internal/common/text-array.h>
#include <dali/integration-api/resource-declarations.h>
namespace Dali
// Atlases automatically get destroyed.
}
-TextVertexBuffer* GlyphAtlasManager::TextRequired( const TextArray& text ,
+TextVertexBuffer* GlyphAtlasManager::TextRequired( const Integration::TextArray& text ,
const TextFormat& format,
FontMetricsInterface& metrics )
{
// get the font id
FontId fontId = metrics.GetFontId();
- AtlasRanking bestRank( text.size() );
+ AtlasRanking bestRank( text.Count() );
// find the atlas which is best suited to displaying the text string
GlyphAtlas* atlas = FindAtlas( text, format, fontId, bestRank);
return atlas->AssignText( text, format, fontId, metrics );
}
-void GlyphAtlasManager::TextNotRequired( const TextArray& text,
+void GlyphAtlasManager::TextNotRequired( const Integration::TextArray& text,
const TextFormat& format,
FontId fontId,
unsigned int textureId )
}
-bool GlyphAtlasManager::IsTextLoaded( const TextArray& text,
+bool GlyphAtlasManager::IsTextLoaded( const Integration::TextArray& text,
const TextFormat& format,
FontId fontId,
unsigned int textureId ) const
return atlas;
}
-GlyphAtlas* GlyphAtlasManager::FindAtlas( const TextArray& text,
+GlyphAtlas* GlyphAtlasManager::FindAtlas( const Integration::TextArray& text,
const TextFormat& format,
FontId fontId,
AtlasRanking &bestRank )
{
// if the text is underlined, add the underline character to the text string
- TextArray searchText( text );
+ Integration::TextArray searchText( text );
if( format.IsUnderLined() )
{
- searchText.push_back( format.GetUnderLineCharacter() );
+ searchText.PushBack( format.GetUnderLineCharacter() );
}
if( mAtlasList.Count() == 0 )
{
// make sure the initial atlas size holds the requested text.
- unsigned int size = GlyphAtlasSize::GetInitialSize( searchText.size() );
+ unsigned int size = GlyphAtlasSize::GetInitialSize( searchText.Count() );
return CreateAtlas( size );
}
*/
// INTERNAL INCLUDES
-#include <dali/internal/common/text-array.h>
#include <dali/internal/common/owner-container.h>
#include <dali/internal/event/text/font-metrics-interface.h>
#include <dali/internal/event/text/atlas/glyph-atlas.h>
/**
* @copydoc GlyphAtlasManagerInterface::TextRequired()
*/
- virtual TextVertexBuffer* TextRequired( const TextArray& text,
+ virtual TextVertexBuffer* TextRequired( const Integration::TextArray& text,
const TextFormat& format,
FontMetricsInterface& metrics );
/**
* @copydoc GlyphAtlasManagerInterface::TextNotRequired()
*/
- virtual void TextNotRequired( const TextArray& text,
+ virtual void TextNotRequired( const Integration::TextArray& text,
const TextFormat& format,
FontId font,
unsigned int textureId );
/**
* @copydoc GlyphAtlasManagerInterface::IsTextLoaded()
*/
- virtual bool IsTextLoaded( const TextArray& text,
+ virtual bool IsTextLoaded( const Integration::TextArray& text,
const TextFormat& format,
FontId fontId,
unsigned int textureId) const;
* @param[in,out] the ranking for the atlas that is found
* @return atlas
*/
- GlyphAtlas* FindAtlas( const TextArray& text ,
+ GlyphAtlas* FindAtlas( const Integration::TextArray& text ,
const TextFormat& format,
FontId fontId,
AtlasRanking& bestRank);
{
}
-TextVertexBuffer* GlyphAtlas::AssignText( const TextArray& text,
+TextVertexBuffer* GlyphAtlas::AssignText( const Integration::TextArray& text,
const TextFormat &format,
FontId fontId,
FontMetricsInterface& metrics )
return textBuffer;
}
-void GlyphAtlas::TextNoLongerUsed( const TextArray& text, const TextFormat &format, FontId fontId )
+void GlyphAtlas::TextNoLongerUsed( const Integration::TextArray& text, const TextFormat &format, FontId fontId )
{
// go through each character un-referencing it
- for( std::size_t i = 0, size = text.size(); i < size; ++i)
+ for( Integration::TextArray::ConstIterator it = text.Begin(), endIt = text.End(); it != endIt; ++it )
{
- mGlyphContainer.DecreaseRefCount( text[i], fontId );
+ mGlyphContainer.DecreaseRefCount( *it, fontId );
}
if( format.IsUnderLined() )
}
}
-AtlasRanking GlyphAtlas::GetRanking( const TextArray& text , FontId fontId ) const
+AtlasRanking GlyphAtlas::GetRanking( const Integration::TextArray& text , FontId fontId ) const
{
return GetAtlasRanking( text, fontId, mGlyphContainer, Resizable() );
}
mRequestList.clear();
}
-bool GlyphAtlas::IsTextLoaded( const TextArray& text, const TextFormat &format, FontId fontId) const
+bool GlyphAtlas::IsTextLoaded( const Integration::TextArray& text, const TextFormat &format, FontId fontId) const
{
// check the underline character is needed / loaded first
if( format.IsUnderLined() )
{
- TextArray tempText;
- tempText.push_back( format.GetUnderLineCharacter() );
+ Integration::TextArray tempText;
+ tempText.PushBack( format.GetUnderLineCharacter() );
bool loaded = mGlyphContainer.IsTextLoaded( tempText, fontId );
if( !loaded )
// but have a reference count of zero.
// go through each dead character, marking them as de-allocated in the atlas
- std::vector< unsigned int > deadCharacters;
+ Integration::TextArray deadCharacters;
mGlyphContainer.GetDeadCharacters( deadCharacters );
- for( std::size_t i = 0; i < deadCharacters.size() ; ++i )
+ for( Integration::TextArray::ConstIterator it = deadCharacters.Begin(), endIt = deadCharacters.End(); it != endIt; ++it )
{
- mAtlas.Remove( deadCharacters[i]);
+ mAtlas.Remove( *it );
}
// clear the dead characters from the glyph container
mTextureIdOfReplacedAtlases.clear();
}
-void GlyphAtlas::ReferenceText( const TextArray& text,
- const TextFormat &format,
- FontId fontId)
+void GlyphAtlas::ReferenceText( const Integration::TextArray& text,
+ const TextFormat &format,
+ FontId fontId)
{
// go through each character, if it exists increase it's ref count.
- for( std::size_t i = 0, size = text.size(); i < size; ++i)
+ for( Integration::TextArray::ConstIterator it = text.Begin(), endIt = text.End(); it != endIt; ++it )
{
// this will automatically load the character if it doesn't exist
- IncreaseGlyphRefCount( text[i], fontId );
+ IncreaseGlyphRefCount( *it, fontId );
}
if( format.IsUnderLined() )
// INTERNAL INCLUDES
#include <dali/internal/event/text/atlas/atlas.h>
#include <dali/internal/event/text/atlas/atlas-ranking.h>
-#include <dali/internal/common/text-array.h>
#include <dali/internal/event/text/glyph-status/glyph-status.h>
#include <dali/internal/event/text/glyph-status/glyph-status-container.h>
#include <dali/internal/event/text/resource/glyph-resource-observer.h>
#include <dali/internal/event/text/resource/glyph-resource-request.h>
#include <dali/internal/event/text/font-metrics-interface.h>
+#include <dali/integration-api/text-array.h>
namespace Dali
{
* @param[in] fontId the font id
* @param[in] metrics font metrics interface
*/
- TextVertexBuffer* AssignText( const TextArray& text, const TextFormat &format, FontId fontId, FontMetricsInterface& metrics );
+ TextVertexBuffer* AssignText( const Integration::TextArray& text, const TextFormat &format, FontId fontId, FontMetricsInterface& metrics );
/**
* Inform the atlas that text is no longer used
* @param[in] format the text format
* @param[in] fontId the font id
*/
- void TextNoLongerUsed( const TextArray& text, const TextFormat &format, FontId fontId );
+ void TextNoLongerUsed( const Integration::TextArray& text, const TextFormat &format, FontId fontId );
/**
* Given a text string, returns an atlas ranking.
* @param[in] fontId the font id
* @return atlas ranking
*/
- AtlasRanking GetRanking( const TextArray& text , FontId fontId ) const;
+ AtlasRanking GetRanking( const Integration::TextArray& text , FontId fontId ) const;
/**
* Get the atlas size
* @param[in] fontId the font id
* @return true if the text is loaded
*/
- bool IsTextLoaded( const TextArray& text, const TextFormat &format, FontId fontId) const;
+ bool IsTextLoaded( const Integration::TextArray& text, const TextFormat &format, FontId fontId) const;
/**
* Clone the contents of the atlas into this atlas
* @param[in] format the text format
* @param[in] fontId font id
*/
- void ReferenceText( const TextArray& text,
- const TextFormat &format,
- FontId fontId);
+ void ReferenceText( const Integration::TextArray& text,
+ const TextFormat &format,
+ FontId fontId);
/**
* Increase glyph reference count.
#include <dali/internal/event/text/atlas/glyph-atlas-manager-interface.h>
#include <dali/internal/event/text/font-metrics.h>
#include <dali/internal/event/text/resource/font-lookup-interface.h>
-#include <dali/internal/common/text-array.h>
namespace Dali
{
return ( font.GetResourceId() == GetResourceId() ) && ( fabsf( font.GetPointSize() - GetPointSize() ) < Math::MACHINE_EPSILON_1000 );
}
-const std::string Font::GetFamilyForText(const TextArray& text)
+const std::string Font::GetFamilyForText(const Integration::TextArray& text)
{
Integration::PlatformAbstraction& platform = ThreadLocalStorage::Get().GetPlatformAbstraction();
// this is a synchronous request
- return platform.GetFontFamilyForChars(text);
+ return platform.GetFontFamilyForChars( text );
}
PixelSize Font::GetLineHeightFromCapsHeight(const std::string& fontFamily, const std::string& fontStyle, const CapsHeight& capsHeight)
platform.GetFontList( listMode, fontList );
}
-bool Font::AllGlyphsSupported(const TextArray& text) const
+bool Font::AllGlyphsSupported(const Integration::TextArray& text) const
{
// this is a synchronous request
return mPlatform.AllGlyphsSupported(mName, mStyle, text);
return mMetrics->GetFontId();
}
-float Font::MeasureTextWidth(const TextArray& text, float textHeightPx) const
+float Font::MeasureTextWidth(const Integration::TextArray& text, float textHeightPx) const
{
Vector3 size = MeasureText(text);
return width;
}
-float Font::MeasureTextHeight(const TextArray& text, float textWidthPx) const
+float Font::MeasureTextHeight(const Integration::TextArray& text, float textWidthPx) const
{
Vector3 size = MeasureText(text);
return height;
}
-Vector3 Font::MeasureText(const TextArray& text) const
+Vector3 Font::MeasureText(const Integration::TextArray& text) const
{
if (mMetrics)
{
void Font::GetMetrics(const Dali::Character& character, Dali::Font::Metrics::Impl& metricsImpl) const
{
- TextArray text;
- text.push_back( character.GetImplementation().GetCharacter() );
+ Integration::TextArray text;
+ text.PushBack( character.GetImplementation().GetCharacter() );
mMetrics->GetMetrics( character, metricsImpl );
mAtlasManager.RemoveTextObserver(observer);
}
-TextVertexBuffer* Font::TextRequired( const TextArray& text, const TextFormat& format)
+TextVertexBuffer* Font::TextRequired( const Integration::TextArray& text, const TextFormat& format)
{
// make sure the metrics are loaded for the text string, along with underline character if required
if( format.IsUnderLined() )
{
- TextArray underline;
- underline.push_back( SpecialCharacters::UNDERLINE_CHARACTER );
+ Integration::TextArray underline;
+ underline.PushBack( SpecialCharacters::UNDERLINE_CHARACTER );
mMetrics->LoadMetricsSynchronously( underline );
}
return mAtlasManager.TextRequired(text, format, *(mMetrics.Get()));
}
-void Font::TextNotRequired( const TextArray& text, const TextFormat& format, unsigned int mTextureId )
+void Font::TextNotRequired( const Integration::TextArray& text, const TextFormat& format, unsigned int mTextureId )
{
// let the atlas manager we no longer need the text
mAtlasManager.TextNotRequired( text, format, mMetrics->GetFontId(), mTextureId );
mAtlasManager.RemoveTextureObserver( observer );
}
-bool Font::IsTextLoaded( const TextArray& text, const TextFormat& format, unsigned int textureId ) const
+bool Font::IsTextLoaded( const Integration::TextArray& text, const TextFormat& format, unsigned int textureId ) const
{
return mAtlasManager.IsTextLoaded( text, format, mMetrics->GetFontId(), textureId );
}
#include <dali/public-api/text/font.h>
#include <dali/public-api/object/base-object.h>
#include <dali/internal/event/text/font-metrics.h>
-#include <dali/internal/common/text-array.h>
#include <dali/internal/common/text-vertex-buffer.h>
#include <dali/internal/event/text/text-observer.h>
#include <dali/internal/event/text/resource/glyph-texture-observer.h>
#include <dali/internal/event/text/atlas/glyph-atlas-manager-interface.h>
-
#include <dali/internal/common/message.h>
+#include <dali/integration-api/text-array.h>
namespace Dali
{
/**
* @copydoc Dali::Font::GetFamilyForText()
*/
- static const std::string GetFamilyForText(const TextArray& text);
+ static const std::string GetFamilyForText(const Integration::TextArray& text);
/**
* @copydoc Dali::Font::GetLineHeightFromCapsHeight()
/**
* @copydoc Dali::Font::AllGlyphsSupported()
*/
- bool AllGlyphsSupported(const TextArray& text) const;
+ bool AllGlyphsSupported(const Integration::TextArray& text) const;
/**
* returns the Id used for lookups
/**
* @copydoc Dali::Font::MeasureTextWidth()
*/
- float MeasureTextWidth(const TextArray& text, float textHeightPx) const;
+ float MeasureTextWidth(const Integration::TextArray& text, float textHeightPx) const;
/**
* @copydoc Dali::Font::MeasureTextHeight()
*/
- float MeasureTextHeight(const TextArray& text, float textWidthPx) const;
+ float MeasureTextHeight(const Integration::TextArray& text, float textWidthPx) const;
/**
* @copydoc Dali::Font::MeasureText(const Text& text) const
*/
- Vector3 MeasureText(const TextArray& text) const;
+ Vector3 MeasureText(const Integration::TextArray& text) const;
/**
* @copydoc Dali::Font::IsDefaultSystemFont()
/**
* @copydoc GlyphAtlasManagerInterface::TextRequired()
*/
- TextVertexBuffer* TextRequired( const TextArray& text, const TextFormat& format );
+ TextVertexBuffer* TextRequired( const Integration::TextArray& text, const TextFormat& format );
/**
* @copydoc GlyphAtlasManagerInterface::TextNotRequired()
*/
- void TextNotRequired( const TextArray& text, const TextFormat& format, unsigned int textureId );
+ void TextNotRequired( const Integration::TextArray& text, const TextFormat& format, unsigned int textureId );
/**
* Add a glyph texture observer
* @param[in] textureId texture ID of the atlas
* @return true if all characters are available, false if not
*/
- bool IsTextLoaded( const TextArray& text, const TextFormat& format, unsigned int textureId ) const;
+ bool IsTextLoaded( const Integration::TextArray& text, const TextFormat& format, unsigned int textureId ) const;
private:
// INTERNAL INCLUDES
#include <dali/internal/event/text/resource/font-id.h>
#include <dali/internal/event/text/glyph-metric.h>
-#include <dali/internal/common/text-array.h>
+#include <dali/integration-api/text-array.h>
// EXTERNAL INCLUDES
#include <string>
* Ensures the metrics for each character in the text are loaded and cached.
* @param[in] text The text string to load the metrics for.
*/
- virtual void LoadMetricsSynchronously( const TextArray& text ) = 0;
+ virtual void LoadMetricsSynchronously( const Integration::TextArray& text ) = 0;
/**
* Gets the metrics for a single character.
const uint32_t LINE_SEPARATOR( '\n' );
-TextArray GetUniqueCharacters( const TextArray &text )
+Integration::TextArray GetUniqueCharacters( const Integration::TextArray& text )
{
- TextArray utfCodes(text.begin(), text.end());
- std::sort( utfCodes.begin(), utfCodes.end() );
- TextArray::iterator it = std::unique( utfCodes.begin(), utfCodes.end() );
- utfCodes.resize(it - utfCodes.begin());
+ Integration::TextArray utfCodes = text;
+ std::sort( utfCodes.Begin(), utfCodes.End() );
+ Integration::TextArray::Iterator it = std::unique( utfCodes.Begin(), utfCodes.End() );
+ utfCodes.Resize( it - utfCodes.Begin() );
return utfCodes;
}
}
}
-Vector3 FontMetrics::MeasureText( const TextArray& text )
+Vector3 FontMetrics::MeasureText( const Integration::TextArray& text )
{
- if( text.empty() )
+ if( 0u == text.Count() )
{
return Vector3::ZERO;
}
- TextArray utfCodes = GetUniqueCharacters( text );
+
+ Integration::TextArray utfCodes = GetUniqueCharacters( text );
// ensure all the metrics are loaded for the characters
LoadMetricsSynchronously( utfCodes );
float xPos = 0.0f;
- for( TextArray::const_iterator it = text.begin(), endIt = text.end(); it != endIt; ++it )
+ for( Integration::TextArray::ConstIterator it = text.Begin(), endIt = text.End(); it != endIt; ++it )
{
const uint32_t utfCode( *it );
return measurement;
}
-bool FontMetrics::TextAvailable( const TextArray& text ) const
+bool FontMetrics::TextAvailable( const Integration::TextArray& text ) const
{
TCharMap::const_iterator endIter = mCharMap.end();
- for( TextArray::const_iterator it = text.begin(), endIt = text.end(); it != endIt; ++it )
+ for( Integration::TextArray::ConstIterator it = text.Begin(), endIt = text.End(); it != endIt; ++it )
{
const uint32_t utfCode( *it );
return true;
}
-unsigned int FontMetrics::GetMissingText( const TextArray& text, CharacterList& missingText ) const
+unsigned int FontMetrics::GetMissingText( const Integration::TextArray& text, CharacterList& missingText ) const
{
// sort and remove duplicate character codes
- TextArray utfCodes( GetUniqueCharacters(text) );
+ Integration::TextArray utfCodes( GetUniqueCharacters(text) );
// scan through the metrics cache, making a list of characters that are missing
TCharMap::const_iterator endIter = mCharMap.end();
- for( TextArray::const_iterator it = utfCodes.begin(), endIt = utfCodes.end(); it != endIt; ++it )
+ for( Integration::TextArray::ConstIterator it = utfCodes.Begin(), endIt = utfCodes.End(); it != endIt; ++it )
{
const uint32_t utfCode( *it );
return missingText.size();
}
-void FontMetrics::LoadMetricsSynchronously( const TextArray& text )
+void FontMetrics::LoadMetricsSynchronously( const Integration::TextArray& text )
{
// check to make sure the metrics cache has loaded
CheckMetricsLoaded();
void FontMetrics::GetMetrics( const Dali::Character& character, Dali::Font::Metrics::Impl& metrics )
{
- TextArray utfCodes;
- utfCodes.push_back( character.GetImplementation().GetCharacter() );
+ Integration::TextArray utfCodes;
+ utfCodes.PushBack( character.GetImplementation().GetCharacter() );
LoadMetricsSynchronously( utfCodes );
#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/text/font.h>
#include <dali/internal/event/resources/resource-ticket.h>
-#include <dali/internal/common/text-array.h>
#include <dali/internal/event/text/font-metrics-interface.h>
#include <dali/internal/event/text/resource/font-id.h>
#include <dali/internal/event/text/font-layout.h>
#include <dali/integration-api/glyph-set.h>
+#include <dali/integration-api/text-array.h>
namespace Dali
{
* @param[in] text The text string to measure.
* @return The natural size of the text.
*/
- Vector3 MeasureText(const TextArray& text);
+ Vector3 MeasureText(const Integration::TextArray& text);
/**
* Check if all characters in a string are currently in the font
* @param[in] text The string to check
* @return true if all characters are currently in the font
*/
- bool TextAvailable (const TextArray& text) const;
+ bool TextAvailable (const Integration::TextArray& text) const;
/**
* Given a text array, checks which characters have their metrics loaded.
* @param[out] missingText Characters from text not contained in this font.
* @return number of characters that have not had their metrics loaded
*/
- unsigned int GetMissingText(const TextArray& text, CharacterList& missingText ) const;
+ unsigned int GetMissingText(const Integration::TextArray& text, CharacterList& missingText ) const;
public: // for FontMetricsInterface
/**
* @copydoc FontMetricsInterface::LoadMetricsSynchronously
*/
- virtual void LoadMetricsSynchronously( const TextArray& text );
+ virtual void LoadMetricsSynchronously( const Integration::TextArray& text );
/**
* @copydoc FontMetricsInterface::GetGlyph()
} // unnamed namespace
-TextVertexBuffer* TextVertexGenerator::Generate( const TextArray& text,
+TextVertexBuffer* TextVertexGenerator::Generate( const Integration::TextArray& text,
const TextFormat& format,
const FontMetricsInterface& metrics,
const AtlasUvInterface& uvInterface,
const float tileWidth( metrics.GetMaxWidth() * scalar );
const float tileHeight( metrics.GetMaxHeight() * scalar );
- for( TextArray::const_iterator it = text.begin(), endIt = text.end(); it != endIt; ++it )
+ for( Integration::TextArray::ConstIterator it = text.Begin(), endIt = text.End(); it != endIt; ++it )
{
const uint32_t charIndex = *it;
#endif
DALI_LOG_INFO(gTextVertsLogFilter, Debug::General, "TextVertexBuffer for %c%c%c...: Calculated Extents:(%5.2f, %5.2f)\n Geometry Extents:(%5.2f, %5.2f )\n",
- text.size()>0?(char)text[0]:' ', text.size()>1?(char)text[1]:' ', text.size()>2?(char)text[2]:' ',
+ text.Count()>0?(char)text[0]:' ', text.Count()>1?(char)text[1]:' ', text.Count()>2?(char)text[2]:' ',
textVertexBuffer->mVertexMax.x,textVertexBuffer->mVertexMax.y,
textVertexBuffer->mGeometryExtent.width,textVertexBuffer->mGeometryExtent.height);
// EXTERNAL INCLUDES
// INTERNAL INCLUDES
-#include <dali/internal/common/text-array.h>
#include <dali/internal/event/text/text-format.h>
#include <dali/internal/common/text-vertex-buffer.h>
#include <dali/internal/event/text/font-metrics-interface.h>
#include <dali/internal/event/text/atlas/atlas-uv-interface.h>
#include <dali/internal/event/text/resource/font-id.h>
+#include <dali/integration-api/text-array.h>
namespace Dali
{
* @param[in] fontId the font id
* @return text vertex buffer
*/
- TextVertexBuffer* Generate(const TextArray& text,
+ TextVertexBuffer* Generate(const Integration::TextArray& text,
const TextFormat& format,
const FontMetricsInterface& metrics,
const AtlasUvInterface& uvInterface,
/**
* @return the unique characters in a text array
*/
-TextArray GetUniqueCharacters( const TextArray &text )
+Integration::TextArray GetUniqueCharacters( const Integration::TextArray &text )
{
- TextArray utfCodes( text );
+ Integration::TextArray utfCodes( text );
- std::sort( utfCodes.begin(), utfCodes.end() );
- TextArray::iterator it = std::unique( utfCodes.begin(), utfCodes.end() );
- utfCodes.resize(it - utfCodes.begin());
+ std::sort( utfCodes.Begin(), utfCodes.End() );
+ Integration::TextArray::Iterator it = std::unique( utfCodes.Begin(), utfCodes.End() );
+ utfCodes.Resize(it - utfCodes.Begin());
return utfCodes;
}
return mCharacterLookup;
}
-bool GlyphStatusContainer::IsTextLoaded( const TextArray& text, FontId fontId) const
+bool GlyphStatusContainer::IsTextLoaded( const Integration::TextArray& text, FontId fontId ) const
{
- for( std::size_t n = 0, size = text.size(); n < size; ++n)
+ for( Integration::TextArray::ConstIterator it = text.Begin(), endIt = text.End(); it != endIt; ++it )
{
- uint32_t charCode = text[n];
+ const uint32_t charCode = *it;
// ignore invisible characters
if( charCode < SpecialCharacters::FIRST_VISIBLE_CHAR )
return true;
}
-void GlyphStatusContainer::GetTextStatus( const TextArray& text,
+void GlyphStatusContainer::GetTextStatus( const Integration::TextArray& text,
FontId fontId,
unsigned int& charsNotLoaded,
bool& fitsInContainer ) const
charsNotLoaded = 0;
fitsInContainer = false;
- TextArray uniqueText = GetUniqueCharacters( text );
+ Integration::TextArray uniqueText = GetUniqueCharacters( text );
- for( std::size_t n = 0, size = uniqueText.size(); n < size; ++n)
+ for( Integration::TextArray::ConstIterator it = text.Begin(), endIt = text.End(); it != endIt; ++it )
{
- uint32_t charCode = uniqueText[n];
+ const uint32_t charCode = *it;
// ignore invisible characters
if( charCode < SpecialCharacters::FIRST_VISIBLE_CHAR )
}
-void GlyphStatusContainer::GetDeadCharacters( std::vector< unsigned int >& deadList )
+void GlyphStatusContainer::GetDeadCharacters( Integration::TextArray& deadList )
{
- deadList.reserve( mDeadCharacters.size() );
+ deadList.Reserve( mDeadCharacters.size() );
// iterate through the dead character list
for( StatusPointerSet::iterator iter = mDeadCharacters.begin(); iter != endIter; ++iter )
{
const GlyphStatus* glyphStatus(*iter);
- deadList.push_back( glyphStatus->GetUniqueId());
+ deadList.PushBack( glyphStatus->GetUniqueId());
}
}
// INTERNAL INCLUDES
#include <dali/public-api/common/set-wrapper.h>
#include <dali/internal/event/text/glyph-status/glyph-status.h>
-#include <dali/internal/common/text-array.h>
+#include <dali/integration-api/text-array.h>
namespace Dali
{
* @param[in] fontId font id
* @return true if all characters are loaded false if not
*/
- bool IsTextLoaded( const TextArray& text, FontId fontId) const;
+ bool IsTextLoaded( const Integration::TextArray& text, FontId fontId) const;
/**
* Given a text array, find how many character are loaded and
* @param[out] charsNotLoaded how many characters are not loaded
* @param[out] fitsInContainer whether the text fits in the container
*/
- void GetTextStatus( const TextArray& text,
+ void GetTextStatus( const Integration::TextArray& text,
FontId fontId,
unsigned int& charsNotLoaded,
bool& fitsInContainer ) const;
* Get the list of dead characters
* @param[out] deadList to be filled with a list of dead characters
*/
- void GetDeadCharacters( std::vector< unsigned int >& deadList );
+ void GetDeadCharacters( Integration::TextArray& deadList );
/**
* Clear dead characters.
#include <dali/internal/event/text/text-impl.h>
// INTERNAL INCLUDES
-
-#include <dali/internal/common/text-array.h>
#include <dali/internal/event/text/character-impl.h>
#include <dali/internal/event/text/utf8-impl.h>
+// EXTERNAL INCLUDES
+#include <algorithm>
+
namespace Dali
{
namespace
{
-static const TextArray VOID_TEXT_ARRAY; ///< A void text array to be used in the helper Internal::GetTextArray() function.
+static const Integration::TextArray VOID_TEXT_ARRAY; ///< A void text array to be used in the helper Internal::GetTextArray() function.
} // namespace
Text::Text()
Text::Text( const std::string& text )
: mString()
{
+ const std::size_t length = text.size();
+
// minimize allocations for ascii strings
- mString.reserve( text.size() );
+ mString.Reserve( length );
// break string into UTF-8 tokens
- UTF8Tokenize( reinterpret_cast<const unsigned char*>( text.c_str() ), text.size(), mString );
+ UTF8Tokenize( reinterpret_cast<const unsigned char*>( text.c_str() ), length, mString );
}
Text::Text( const Character& character )
: mString()
{
- mString.push_back( character.GetCharacter() );
+ mString.PushBack( character.GetCharacter() );
}
Text::Text( const Text& text )
void Text::GetText( std::string& text ) const
{
// minimize allocations for ascii strings
- text.reserve( mString.size() );
+ text.reserve( mString.Count() );
- for( TextArray::const_iterator it = mString.begin(), endIt = mString.end(); it != endIt; ++it )
+ for( Integration::TextArray::ConstIterator it = mString.Begin(), endIt = mString.End(); it != endIt; ++it )
{
unsigned char utf8Data[4];
unsigned int utf8Length;
Text::~Text()
{
Clear();
+ mString.Release();
}
void Text::Clear()
{
- mString.clear();
+ mString.Clear();
}
Dali::Character Text::operator[]( size_t position ) const
{
- DALI_ASSERT_ALWAYS( position < mString.size() && "Text::operator[]: Character position is out of bounds" );
+ DALI_ASSERT_ALWAYS( position < mString.Count() && "Text::operator[]: Character position is out of bounds" );
- const uint32_t c = *( mString.begin() + position );
+ const uint32_t c = *( mString.Begin() + position );
Dali::Character character( new Character( c ) );
bool Text::IsEmpty() const
{
- return mString.empty();
+ return 0u == mString.Count();
}
size_t Text::GetLength() const
{
- return mString.size();
+ return mString.Count();
}
void Text::Append( const Dali::Text& text )
{
- const TextArray& utfCodes = text.GetImplementation().GetTextArray();
+ const Integration::TextArray& utfCodes = text.GetImplementation().GetTextArray();
- mString.insert( mString.end(), utfCodes.begin(), utfCodes.end() );
+ mString.Insert( mString.End(), utfCodes.Begin(), utfCodes.End() );
}
void Text::Remove( size_t position, size_t numberOfCharacters )
{
- DALI_ASSERT_ALWAYS( position < mString.size() && "Text::Remove: Character position is out of bounds" );
- DALI_ASSERT_ALWAYS( position + numberOfCharacters <= mString.size() && "Text::Remove: Character position + numberOfCharacters is out of bounds" );
+ DALI_ASSERT_ALWAYS( position < mString.Count() && "Text::Remove: Character position is out of bounds" );
+ DALI_ASSERT_ALWAYS( position + numberOfCharacters <= mString.Count() && "Text::Remove: Character position + numberOfCharacters is out of bounds" );
- mString.erase( mString.begin() + position, mString.begin() + position + numberOfCharacters );
+ mString.Erase( mString.Begin() + position, mString.Begin() + position + numberOfCharacters );
}
void Text::Find( uint32_t character, std::size_t from, std::size_t to, Vector<std::size_t>& positions ) const
{
std::size_t position = from;
- for( TextArray::const_iterator it = mString.begin() + from, endIt = mString.begin() + to + 1u; it != endIt; ++position, ++it )
+ for( Integration::TextArray::ConstIterator it = mString.Begin() + from, endIt = mString.Begin() + to + 1u; it != endIt; ++position, ++it )
{
if( *it == character )
{
{
std::size_t position = from;
- for( TextArray::const_iterator it = mString.begin() + from, endIt = mString.begin() + to + 1u; it != endIt; ++position, ++it )
+ for( Integration::TextArray::ConstIterator it = mString.Begin() + from, endIt = mString.Begin() + to + 1u; it != endIt; ++position, ++it )
{
if( Character::IsWhiteSpace( *it ) )
{
{
std::size_t position = from;
- for( TextArray::const_iterator it = mString.begin() + from, endIt = mString.begin() + to + 1u; it != endIt; ++position, ++it )
+ for( Integration::TextArray::ConstIterator it = mString.Begin() + from, endIt = mString.Begin() + to + 1u; it != endIt; ++position, ++it )
{
if( Character::IsNewLine( *it ) )
{
{
if( to < from )
{
- const std::size_t length = mString.size();
- const std::size_t rfrom = length - ( from + 1u );
- const std::size_t rto = length - to;
- subText->mString.insert( subText->mString.end(), mString.rbegin() + rfrom, mString.rbegin() + rto );
+ std::swap( from, to );
+ subText->mString.Insert( subText->mString.End(), mString.Begin() + from, mString.Begin() + to + 1u );
+ std::reverse( subText->mString.Begin(), subText->mString.End() );
}
else
{
- subText->mString.insert( subText->mString.end(), mString.begin() + from, mString.begin() + to + 1u );
+ subText->mString.Insert( subText->mString.End(), mString.Begin() + from, mString.Begin() + to + 1u );
}
}
bool Text::IsWhiteSpace( std::size_t index ) const
{
- if( index < mString.size() )
+ if( index < mString.Count() )
{
- return Character::IsWhiteSpace( *( mString.begin() + index ) );
+ return Character::IsWhiteSpace( *( mString.Begin() + index ) );
}
return false;
bool Text::IsNewLine( std::size_t index ) const
{
- if( index < mString.size() )
+ if( index < mString.Count() )
{
- return Character::IsNewLine( *( mString.begin() + index ) );
+ return Character::IsNewLine( *( mString.Begin() + index ) );
}
return false;
}
-const TextArray& Text::GetTextArray() const
+const Integration::TextArray& Text::GetTextArray() const
{
return mString;
}
-const TextArray& GetTextArray( const Dali::Text& text )
+const Integration::TextArray& GetTextArray( const Dali::Text& text )
{
if( text.IsEmpty() )
{
// INTERNAL INCLUDES
#include <dali/public-api/text/text.h>
-#include <dali/internal/common/text-array.h>
+#include <dali/integration-api/text-array.h>
namespace Dali
{
* Retrieves a reference to the UTF-32 encoded string.
* @return A reference to the UTF-32 encoded string.
*/
- const TextArray& GetTextArray() const;
+ const Integration::TextArray& GetTextArray() const;
private:
- TextArray mString; ///< Stores an array of unicodes.
+ Integration::TextArray mString; ///< Stores an array of unicodes.
};
/**
- * @brief Helper function to get the TextArray from a Dali::Text.
+ * @brief Helper function to get the Integration::TextArray from a Dali::Text.
*
* @param[in] text A Dali::Text.
*
- * @return The Text's TextArray.
+ * @return The Text's Integration::TextArray.
*/
- const TextArray& GetTextArray( const Dali::Text& text );
+ const Integration::TextArray& GetTextArray( const Dali::Text& text );
} // namespace Internal
}
}
-TextVertexBuffer* TextRequestHelper::SetText(const TextArray& text, const TextFormat& format)
+TextVertexBuffer* TextRequestHelper::SetText(const Integration::TextArray& text, const TextFormat& format)
{
// current text no longer required.
TextNotRequired();
return TextRequired( format );
}
-TextVertexBuffer* TextRequestHelper::SetTextAndFont( const TextArray& text,
+TextVertexBuffer* TextRequestHelper::SetTextAndFont( const Integration::TextArray& text,
const FontPointer& font,
const TextFormat& format )
{
void TextRequestHelper::TextNotRequired()
{
- if( mFont && !mText.empty() )
+ if( mFont && ( 0u < mText.Count() ) )
{
mFont->TextNotRequired( mText, mFormat, mTextureId );
}
{
mFormat = format;
- if( mFont && !mText.empty() )
+ if( mFont && ( 0u < mText.Count() ) )
{
// watch out for texture resizes / splits
AddTextureObserver();
return buffer;
}
- else if( mText.empty() )
+ else if( 0u == mText.Count() )
{
// create an empty vertex buffer
TextVertexBuffer* buffer = new TextVertexBuffer;
bool TextRequestHelper::IsTextLoaded() const
{
- if( mTextureId == 0 || (!mFont) || mText.empty() )
+ if( mTextureId == 0 || (!mFont) || ( 0u == mText.Count() ) )
{
return false;
}
// INTERNAL INCLUDES
#include <dali/public-api/object/ref-object.h>
-#include <dali/internal/common/text-array.h>
#include <dali/internal/event/text/font-declarations.h>
#include <dali/internal/event/text/text-format.h>
#include <dali/internal/common/text-vertex-buffer.h>
#include <dali/internal/event/text/resource/glyph-texture-observer.h>
+#include <dali/integration-api/text-array.h>
namespace Dali
{
* @param [in] format text format
* @return the vertex data required to draw the text
*/
- TextVertexBuffer* SetText(const TextArray& text, const TextFormat& format );
+ TextVertexBuffer* SetText(const Integration::TextArray& text, const TextFormat& format );
/**
* Set the font
* @param [in] format text format
* @return the vertex data required to draw the text
*/
- TextVertexBuffer* SetTextAndFont(const TextArray& text, const FontPointer& font, const TextFormat& format );
+ TextVertexBuffer* SetTextAndFont(const Integration::TextArray& text, const FontPointer& font, const TextFormat& format );
/**
* Called when the texture id has changed
void AddTextureObserver();
unsigned int mTextureId; ///< the texture id of the glyph atlas being used
- TextArray mText; ///< text string
+ Integration::TextArray mText; ///< text string
TextFormat mFormat; ///< text format
FontPointer mFont; ///< the font
bool mTextureObserverInstalled:1; ///< whether texture observer is installed
return sequenceLength;
}
-size_t UTF8Tokenize(const unsigned char* utf8Data, const size_t utf8DataLength, TextArray& tokens)
+size_t UTF8Tokenize(const unsigned char* utf8Data, const size_t utf8DataLength, Integration::TextArray& tokens)
{
size_t dataLength = utf8DataLength;
}
code = UTF8Read(utf8Data, sequenceLength);
- tokens.push_back(code);
+ tokens.PushBack(code);
utf8Data += sequenceLength;
dataLength -= sequenceLength;
}
- return tokens.size();
+ return tokens.Count();
}
} // namespace Internal
*/
// INTERNAL INCLUDES
-#include <dali/internal/common/text-array.h>
+#include <dali/integration-api/text-array.h>
namespace Dali
{
* @param[out] tokens A vector which will receive the converted UTF-32 codes
* @return The number of UTF-32 codes.
*/
-size_t UTF8Tokenize(const unsigned char* utf8Data, const size_t utf8DataLength, TextArray& tokens);
+size_t UTF8Tokenize(const unsigned char* utf8Data, const size_t utf8DataLength, Integration::TextArray& tokens);
} // namespace Internal
TextActor TextActor::New()
{
TextActorParameters parameters;
- Internal::TextActorPtr internal = Internal::TextActor::New( Internal::TextArray(), parameters );
+ Internal::TextActorPtr internal = Internal::TextActor::New( Integration::TextArray(), parameters );
return TextActor( internal.Get() );
}