mCharactersPerGlyph.Resize( numberOfGlyphs );
memcpy( mCharactersPerGlyph.Begin(), charactersPerGlyph, numberOfGlyphs * sizeof( Length ) );
- // Build the characters to glyph conversion table.
- CreateCharacterToGlyphTable();
-
// Build the glyphs per character table.
CreateGlyphsPerCharacterTable();
+
+ // Build the characters to glyph conversion table.
+ CreateCharacterToGlyphTable();
}
}
}
}
mCharactersToGlyph.Reserve( numberOfCharacters );
+ DALI_ASSERT_DEBUG( mGlyphsPerCharacter.Count() != 0u ||
+ ( 0u == numberOfCharacters ) );
+
+ const Length* const glyphsPerCharacterBuffer = mGlyphsPerCharacter.Begin();
+
// 2) Traverse the glyphs and set the glyph indices per character.
// Index to the glyph.
GlyphIndex glyphIndex = 0u;
+ CharacterIndex characterIndex = 0u;
for( Vector<Length>::ConstIterator it = mCharactersPerGlyph.Begin(),
endIt = mCharactersPerGlyph.End();
it != endIt;
- ++it, ++glyphIndex )
+ ++it )
{
const Length numberOfCharactersPerGlyph = *it;
+ Length numberOfGlyphs = 0u;
// Set the glyph indices.
- for( Length index = 0u; index < numberOfCharactersPerGlyph; ++index )
+ for( Length index = 0u; index < numberOfCharactersPerGlyph; ++index, ++characterIndex )
{
mCharactersToGlyph.PushBack( glyphIndex );
+ numberOfGlyphs += *( glyphsPerCharacterBuffer + characterIndex );
}
+ glyphIndex += numberOfGlyphs;
}
}
// If no number of characters is given, just set something sensible to avoid reallocations.
numberOfCharacters = static_cast<Length> ( static_cast<float>( mGlyphs.Count() ) * 1.3f );
}
- mCharactersToGlyph.Reserve( numberOfCharacters );
+ mGlyphsPerCharacter.Reserve( numberOfCharacters );
// 2) Traverse the glyphs and set the number of glyphs per character.
return mActualSize;
}
+void VisualModel::SetTextColor( const Vector4& textColor )
+{
+ mTextColor = textColor;
+
+ if ( !mUnderlineColorSet )
+ {
+ mUnderlineColor = textColor;
+ }
+}
+
+void VisualModel::SetShadowOffset( const Vector2& shadowOffset )
+{
+ mShadowOffset = shadowOffset;
+}
+
+void VisualModel::SetShadowColor( const Vector4& shadowColor )
+{
+ mShadowColor = shadowColor;
+}
+
+void VisualModel::SetUnderlineColor( const Vector4& color )
+{
+ mUnderlineColor = color;
+ mUnderlineColorSet = true;
+}
+
+void VisualModel::SetUnderlineEnabled( bool enabled )
+{
+ mUnderlineEnabled = enabled;
+}
+
+const Vector4& VisualModel::GetTextColor() const
+{
+ return mTextColor;
+}
+
+const Vector2& VisualModel::GetShadowOffset() const
+{
+ return mShadowOffset;
+}
+
+const Vector4& VisualModel::GetShadowColor() const
+{
+ return mShadowColor;
+}
+
+const Vector4& VisualModel::GetUnderlineColor() const
+{
+ return mUnderlineColor;
+}
+
+bool VisualModel::IsUnderlineEnabled() const
+{
+ return mUnderlineEnabled;
+}
+
VisualModel::~VisualModel()
{
}
VisualModel::VisualModel()
+: mUnderlineColorSet( false )
{
}