numberOfGlyphs,
Text::HorizontalAlignment::BEGIN,
Text::LineWrap::WORD,
- outlineWidth );
+ outlineWidth,
+ true );
Vector<LineRun>& lines = visualModel->mLines;
totalNumberOfGlyphs,
Text::HorizontalAlignment::BEGIN,
Text::LineWrap::WORD,
- outlineWidth );
+ outlineWidth,
+ true );
layoutParameters.isLastNewParagraph = isLastNewParagraph;
visualModel->mGlyphs.Count(),
Text::HorizontalAlignment::BEGIN,
Text::LineWrap::WORD,
- outlineWidth );
+ outlineWidth,
+ true );
layoutParameters.numberOfBidirectionalInfoRuns = logicalModel->mBidirectionalLineInfo.Count();
layoutParameters.lineBidirectionalInfoRunsBuffer = logicalModel->mBidirectionalLineInfo.Begin();
tet_result(TET_FAIL);
}
+ label.SetProperty( TextLabel::Property::TEXT, "Hello world " );
+ label.SetProperty( DevelTextLabel::Property::IGNORE_SPACES_AFTER_TEXT, false );
+ label.SetSize( 400.0f, 10.f );
+
+ try
+ {
+ // Render the text.
+ application.SendNotification();
+ application.Render();
+ }
+ catch( ... )
+ {
+ tet_result(TET_FAIL);
+ }
+
END_TEST;
}
* | color | VECTOR4 | No | The color of the background (the default value is Color::CYAN) |
*/
BACKGROUND,
+
+ /**
+ * @brief Ignore spaces after text.
+ * @details Name "ignoreSpacesAfterText", type (Property::BOLEAN), Read/Write
+ * @note The default value is true
+ */
+ IGNORE_SPACES_AFTER_TEXT,
};
} // namespace Property
DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY( Toolkit, TextLabel, "textDirection", INTEGER, TEXT_DIRECTION )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "verticalLineAlignment", INTEGER, VERTICAL_LINE_ALIGNMENT )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "textBackground", MAP, BACKGROUND )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "ignoreSpacesAfterText", BOOLEAN, IGNORE_SPACES_AFTER_TEXT )
DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT( Toolkit, TextLabel, "textColor", Color::BLACK, TEXT_COLOR )
DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION( Toolkit, TextLabel, "textColorRed", TEXT_COLOR_RED, TEXT_COLOR, 0 )
DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION( Toolkit, TextLabel, "textColorGreen", TEXT_COLOR_GREEN, TEXT_COLOR, 1 )
}
break;
}
+ case Toolkit::DevelTextLabel::Property::IGNORE_SPACES_AFTER_TEXT:
+ {
+ impl.mController->SetIgnoreSpacesAfterText(value.Get< bool >());
+ break;
+ }
}
// Request relayout when text update is needed. It's necessary to call it
GetBackgroundProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
break;
}
+ case Toolkit::DevelTextLabel::Property::IGNORE_SPACES_AFTER_TEXT:
+ {
+ value = impl.mController->IsIgnoreSpacesAfterText();
+ break;
+ }
}
}
tmpLineLayout.wsLengthEndOfLine = 0.f;
}
+ // If calculation is end but wsLengthEndOfLine is exist, it means end of text is space.
+ // Merge remained length.
+ if ( !parameters.ignoreSpaceAfterText && glyphIndex == lastGlyphOfParagraphPlusOne-1 && tmpLineLayout.wsLengthEndOfLine > 0 )
+ {
+ tmpLineLayout.length += tmpLineLayout.wsLengthEndOfLine;
+ tmpLineLayout.wsLengthEndOfLine = 0u;
+ }
+
// Save the current extra width to compare with the next one
mPreviousCharacterExtraWidth = tmpExtraWidth;
// Check if the accumulated length fits in the width of the box.
- if( ( completelyFill || isMultiline ) && !isWhiteSpace &&
+ if( ( completelyFill || isMultiline ) && !(parameters.ignoreSpaceAfterText && isWhiteSpace) &&
( tmpExtraBearing + lineLayout.length + lineLayout.wsLengthEndOfLine + tmpLineLayout.length + tmpExtraWidth > parameters.boundingBox.width ) )
{
// Current word does not fit in the box's width.
Length totalNumberOfGlyphs,
Text::HorizontalAlignment::Type horizontalAlignment,
Text::LineWrap::Mode lineWrapMode,
- float outlineWidth )
+ float outlineWidth,
+ bool ignoreSpaceAfterText )
: boundingBox( boundingBox ),
textBuffer( textBuffer ),
lineBreakInfoBuffer( lineBreakInfoBuffer ),
startLineIndex( 0u ),
estimatedNumberOfLines( 0u ),
lineWrapMode( lineWrapMode ),
+ outlineWidth( outlineWidth ),
isLastNewParagraph( false ),
- outlineWidth( outlineWidth )
+ ignoreSpaceAfterText( ignoreSpaceAfterText )
{}
Vector2 boundingBox; ///< The size of the box containing the text.
LineIndex startLineIndex; ///< The line index where to insert the new lines.
Length estimatedNumberOfLines; ///< The estimated number of lines.
Text::LineWrap::Mode lineWrapMode; ///< The line wrap mode for moving to next line.
- bool isLastNewParagraph; ///< Whether the last character is a new paragraph character.
float outlineWidth; ///< The outline width.
+ bool isLastNewParagraph:1; ///< Whether the last character is a new paragraph character.
+ bool ignoreSpaceAfterText:1; ///< Whether ignoring spaces after text or not. Default is true.
};
} // namespace Layout
return mImpl->mModel->mVerticalAlignment;
}
+bool Controller::IsIgnoreSpacesAfterText() const
+{
+ return mImpl->mModel->mIgnoreSpacesAfterText;
+}
+
+void Controller::SetIgnoreSpacesAfterText( bool ignore )
+{
+ mImpl->mModel->mIgnoreSpacesAfterText = ignore;
+}
+
void Controller::SetLineWrapMode( Text::LineWrap::Mode lineWrapMode )
{
if( lineWrapMode != mImpl->mModel->mLineWrapMode )
totalNumberOfGlyphs,
mImpl->mModel->mHorizontalAlignment,
mImpl->mModel->mLineWrapMode,
- outlineWidth );
+ outlineWidth,
+ mImpl->mModel->mIgnoreSpacesAfterText );
// Resize the vector of positions to have the same size than the vector of glyphs.
Vector<Vector2>& glyphPositions = mImpl->mModel->mVisualModel->mGlyphPositions;
*/
void SetVerticalLineAlignment( Toolkit::DevelText::VerticalLineAlignment::Type alignment );
+ /**
+ * @brief Retrieves ignoreSpaceAfterText value from model
+ * @return The value of ignoreSpaceAfterText
+ */
+ bool IsIgnoreSpacesAfterText() const;
+
+ /**
+ * @brief Sets ignoreSpaceAfterText value to model
+ * @param[in] ignore The value of ignoreSpacesAfterText for the text
+ */
+ void SetIgnoreSpacesAfterText( bool ignore );
+
public: // Relayout.
/**
mVerticalLineAlignment( DevelText::VerticalLineAlignment::TOP ),
mLineWrapMode( Text::LineWrap::WORD ),
mAlignmentOffset( 0.0f ),
- mElideEnabled( false )
+ mElideEnabled( false ),
+ mIgnoreSpacesAfterText( true )
{
mLogicalModel = LogicalModel::New();
mVisualModel = VisualModel::New();
* 0,0 means that the top-left corner of the layout matches the top-left corner of the UI control.
* Typically this will have a negative value with scrolling occurs.
*/
- Vector2 mScrollPosition; ///< The text is offset by this position when scrolling.
- Vector2 mScrollPositionLast; ///< The last offset value of mScrollPosition
- HorizontalAlignment::Type mHorizontalAlignment; ///< The layout's horizontal alignment.
- VerticalAlignment::Type mVerticalAlignment; ///< The layout's vertical alignment.
- DevelText::VerticalLineAlignment::Type mVerticalLineAlignment; ///< The layout's vertical line alignment.
- Text::LineWrap::Mode mLineWrapMode; ///< The text wrap mode
- float mAlignmentOffset; ///< The alignment offset.
- bool mElideEnabled:1; ///< Whether the text's elide is enabled.
+ Vector2 mScrollPosition; ///< The text is offset by this position when scrolling.
+ Vector2 mScrollPositionLast; ///< The last offset value of mScrollPosition
+ HorizontalAlignment::Type mHorizontalAlignment; ///< The layout's horizontal alignment.
+ VerticalAlignment::Type mVerticalAlignment; ///< The layout's vertical alignment.
+ DevelText::VerticalLineAlignment::Type mVerticalLineAlignment; ///< The layout's vertical line alignment.
+ Text::LineWrap::Mode mLineWrapMode; ///< The text wrap mode
+ float mAlignmentOffset; ///< The alignment offset.
+ bool mElideEnabled:1; ///< Whether the text's elide is enabled.
+ bool mIgnoreSpacesAfterText:1; ///< Whether ignoring spaces after text or not. Default is true.
};
} // namespace Text
"enableAutoScroll":false,
"autoScrollLoopCount":2,
"autoScrollGap":50,
- "autoScrollSpeed":80
+ "autoScrollSpeed":80,
+ "ignoreSpacesAfterText":false
},
"TextLabelFontSize0":