// INTERNAL INCLUDES
#include <dali-toolkit/internal/text/bidirectional-support.h>
#include <dali-toolkit/internal/text/character-set-conversion.h>
-#include <dali-toolkit/internal/text/layouts/layout-parameters.h>
#include <dali-toolkit/internal/text/multi-language-support.h>
-#include <dali-toolkit/internal/text/script-run.h>
#include <dali-toolkit/internal/text/segmentation.h>
#include <dali-toolkit/internal/text/shaper.h>
-#include <dali-toolkit/internal/text/text-io.h>
-#include <dali-toolkit/internal/text/text-view.h>
namespace
{
{
// Retrieves the scripts used in the text.
multilanguageSupport.SetScripts( utf32Characters,
- lineBreakInfo,
scripts );
}
Vector<Character> mirroredUtf32Characters;
bool textMirrored = false;
+ Length numberOfParagraphs = 0u;
if( BIDI_INFO & operations )
{
// Count the number of LINE_NO_BREAK to reserve some space for the vector of paragraph's
// bidirectional info.
- Length numberOfParagraphs = 0u;
-
const TextAbstraction::LineBreakInfo* lineBreakInfoBuffer = lineBreakInfo.Begin();
for( Length index = 0u; index < numberOfCharacters; ++index )
{
// This paragraph has right to left text. Some characters may need to be mirrored.
// TODO: consider if the mirrored string can be stored as well.
- textMirrored = GetMirroredText( utf32Characters, mirroredUtf32Characters );
+ textMirrored = GetMirroredText( utf32Characters,
+ mirroredUtf32Characters,
+ bidirectionalInfo );
// Only set the character directions if there is right to left characters.
Vector<CharacterDirection>& directions = mLogicalModel->mCharacterDirections;
Vector<GlyphInfo>& glyphs = mVisualModel->mGlyphs;
Vector<CharacterIndex>& glyphsToCharactersMap = mVisualModel->mGlyphsToCharacters;
Vector<Length>& charactersPerGlyph = mVisualModel->mCharactersPerGlyph;
+ Vector<GlyphIndex> newParagraphGlyphs;
+ newParagraphGlyphs.Reserve( numberOfParagraphs );
+
if( SHAPE_TEXT & operations )
{
const Vector<Character>& textToShape = textMirrored ? mirroredUtf32Characters : utf32Characters;
validFonts,
glyphs,
glyphsToCharactersMap,
- charactersPerGlyph );
+ charactersPerGlyph,
+ newParagraphGlyphs );
// Create the 'number of glyphs' per character and the glyph to character conversion tables.
mVisualModel->CreateGlyphsPerCharacterTable( numberOfCharacters );
if( GET_GLYPH_METRICS & operations )
{
- mFontClient.GetGlyphMetrics( glyphs.Begin(), numberOfGlyphs );
+ GlyphInfo* glyphsBuffer = glyphs.Begin();
+ mFontClient.GetGlyphMetrics( glyphsBuffer, numberOfGlyphs );
+
+ // Update the width and advance of all new paragraph characters.
+ for( Vector<GlyphIndex>::ConstIterator it = newParagraphGlyphs.Begin(), endIt = newParagraphGlyphs.End(); it != endIt; ++it )
+ {
+ const GlyphIndex index = *it;
+ GlyphInfo& glyph = *( glyphsBuffer + index );
+
+ glyph.xBearing = 0.f;
+ glyph.width = 0.f;
+ glyph.advance = 0.f;
+ }
}
}
Vector2 position = mEventData->mDecorator->GetPosition( GRAB_HANDLE );
// Position the grag handle close to either the left or right edge.
- position.x = scrollRightDirection ? 0.f : mControlSize.width;
+ position.x = scrollRightDirection ? 0.f : mVisualModel->mControlSize.width;
// Get the new handle position.
// The grab handle's position is in decorator coords. Need to transforms to text coords.
Vector2 position = mEventData->mDecorator->GetPosition( leftSelectionHandleEvent ? Text::LEFT_SELECTION_HANDLE : Text::RIGHT_SELECTION_HANDLE );
// Position the selection handle close to either the left or right edge.
- position.x = scrollRightDirection ? 0.f : mControlSize.width;
+ position.x = scrollRightDirection ? 0.f : mVisualModel->mControlSize.width;
// Get the new handle position.
// The selection handle's position is in decorator coords. Need to transforms to text coords.
mEventData->mDecorator->AddHighlight( xPosition,
offset.y,
xPosition + static_cast<float>( numberOfCharacters ) * glyphAdvance,
- height );
+ offset.y + height );
splitStartGlyph = false;
continue;
mEventData->mDecorator->AddHighlight( xPosition,
offset.y,
xPosition + static_cast<float>( interGlyphIndex ) * glyphAdvance,
- height );
+ offset.y + height );
splitEndGlyph = false;
continue;
}
const float xPosition = position.x - glyph.xBearing + offset.x;
- mEventData->mDecorator->AddHighlight( xPosition, offset.y, xPosition + glyph.advance, height );
+ mEventData->mDecorator->AddHighlight( xPosition,
+ offset.y,
+ xPosition + glyph.advance,
+ offset.y + height );
}
CursorInfo primaryCursorInfo;
cursorInfo.lineHeight = GetDefaultFontLineHeight();
cursorInfo.primaryCursorHeight = cursorInfo.lineHeight;
- cursorInfo.primaryPosition.x = 1.f;
+ cursorInfo.primaryPosition.x = mEventData->mDecorator->GetCursorWidth();
cursorInfo.primaryPosition.y = 0.f;
// Nothing else to do.
{
case LayoutEngine::HORIZONTAL_ALIGN_BEGIN:
{
- cursorPosition.x = 1.f;
+ cursorPosition.x = mEventData->mDecorator->GetCursorWidth();
break;
}
case LayoutEngine::HORIZONTAL_ALIGN_CENTER:
{
- cursorPosition.x = floor( 0.5f * mControlSize.width );
+ cursorPosition.x = floor( 0.5f * mVisualModel->mControlSize.width );
break;
}
case LayoutEngine::HORIZONTAL_ALIGN_END:
{
- cursorPosition.x = mControlSize.width;
+ cursorPosition.x = mVisualModel->mControlSize.width;
break;
}
}
}
case LayoutEngine::VERTICAL_ALIGN_CENTER:
{
- cursorPosition.y = floorf( 0.5f * ( mControlSize.height - lineHeight ) );
+ cursorPosition.y = floorf( 0.5f * ( mVisualModel->mControlSize.height - lineHeight ) );
break;
}
case LayoutEngine::VERTICAL_ALIGN_BOTTOM:
{
- cursorPosition.y = mControlSize.height - lineHeight;
+ cursorPosition.y = mVisualModel->mControlSize.height - lineHeight;
break;
}
}
void Controller::Impl::ClampHorizontalScroll( const Vector2& actualSize )
{
// Clamp between -space & 0 (and the text alignment).
- if( actualSize.width > mControlSize.width )
+ if( actualSize.width > mVisualModel->mControlSize.width )
{
- const float space = ( actualSize.width - mControlSize.width ) + mAlignmentOffset.x;
+ const float space = ( actualSize.width - mVisualModel->mControlSize.width ) + mAlignmentOffset.x;
mEventData->mScrollPosition.x = ( mEventData->mScrollPosition.x < -space ) ? -space : mEventData->mScrollPosition.x;
mEventData->mScrollPosition.x = ( mEventData->mScrollPosition.x > -mAlignmentOffset.x ) ? -mAlignmentOffset.x : mEventData->mScrollPosition.x;
void Controller::Impl::ClampVerticalScroll( const Vector2& actualSize )
{
// Clamp between -space & 0 (and the text alignment).
- if( actualSize.height > mControlSize.height )
+ if( actualSize.height > mVisualModel->mControlSize.height )
{
- const float space = ( actualSize.height - mControlSize.height ) + mAlignmentOffset.y;
+ const float space = ( actualSize.height - mVisualModel->mControlSize.height ) + mAlignmentOffset.y;
mEventData->mScrollPosition.y = ( mEventData->mScrollPosition.y < -space ) ? -space : mEventData->mScrollPosition.y;
mEventData->mScrollPosition.y = ( mEventData->mScrollPosition.y > -mAlignmentOffset.y ) ? -mAlignmentOffset.y : mEventData->mScrollPosition.y;
mEventData->mScrollPosition.x += offset.x;
updateDecorator = true;
}
- else if( position.x > mControlSize.width )
+ else if( position.x > mVisualModel->mControlSize.width )
{
- offset.x = mControlSize.width - position.x;
+ offset.x = mVisualModel->mControlSize.width - position.x;
mEventData->mScrollPosition.x += offset.x;
updateDecorator = true;
}
}
// Set which cursors are active according the state.
- if( ( EventData::EDITING == mEventData->mState ) ||
- ( EventData::EDITING_WITH_POPUP == mEventData->mState ) ||
+ if( ( EventData::EDITING == mEventData->mState ) ||
+ ( EventData::EDITING_WITH_POPUP == mEventData->mState ) ||
+ ( EventData::EDITING_WITH_GRAB_HANDLE == mEventData->mState ) ||
( EventData::GRAB_HANDLE_PANNING == mEventData->mState ) )
{
if( cursorInfo.isSecondaryCursor )