From 4fce1578bed43bcf2225f9c98407cea24726f41b Mon Sep 17 00:00:00 2001 From: Joogab Yun Date: Tue, 4 Aug 2020 17:29:17 +0900 Subject: [PATCH] add minLineSize at text-utils-devel Change-Id: I1a11d35283b8f7b4cf14b0ae40487307b24e0a0a --- dali-toolkit/devel-api/text/text-utils-devel.cpp | 12 +++++++++--- dali-toolkit/devel-api/text/text-utils-devel.h | 5 ++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/dali-toolkit/devel-api/text/text-utils-devel.cpp b/dali-toolkit/devel-api/text/text-utils-devel.cpp index c39cb21..c3ca9fb 100755 --- a/dali-toolkit/devel-api/text/text-utils-devel.cpp +++ b/dali-toolkit/devel-api/text/text-utils-devel.cpp @@ -147,7 +147,6 @@ bool GetCircularAlignmentEnumeration(const Property::Value& propertyValue, Devel return Scripting::GetEnumerationProperty(propertyValue, CIRCULAR_ALIGNMENT_TYPE_TABLE, CIRCULAR_ALIGNMENT_TYPE_TABLE_COUNT, circularAlignment); } - void ShapeTextPreprocess( const RendererParameters& textParameters, TextAbstraction::TextRenderer::Parameters& rendererParameters, InternalDataModel& internalDataModel ) { @@ -1001,6 +1000,9 @@ Size LayoutText( const RendererParameters& textParameters, TextAbstraction::Text const Text::Layout::Engine::Type horizontalLayout = ( Layout::MULTILINE == layout ) ? Text::Layout::Engine::MULTI_LINE_BOX : Text::Layout::Engine::SINGLE_LINE_BOX; layoutEngine.SetLayout( horizontalLayout ); // TODO: multi-line. + // Set minimun line size + layoutEngine.SetDefaultLineSize( textParameters.minLineSize ); + // Whether the layout is circular. const bool isCircularTextLayout = (Layout::CIRCULAR == layout); const bool isClockwise = isCircularTextLayout && ( 0.f < textParameters.incrementAngle ); @@ -1536,12 +1538,16 @@ Dali::Property::Array RenderForLastIndex( RendererParameters& textParameters ) unsigned int numberOfLines = lines.Count(); int numberOfCharacters = 0; float penY = 0.f; + float lineSize = internalData.layoutEngine.GetDefaultLineSize(); + float lineOffset = 0.f; for( unsigned int index = 0u; index < numberOfLines; ++index ) { const LineRun& line = *( lines.Begin() + index ); numberOfCharacters += line.characterRun.numberOfCharacters; - penY += ( line.ascender + -line.descender ); - if( ( penY + ( line.ascender + -line.descender ) ) > boundingBox ) + + lineOffset = lineSize > 0.f ? lineSize : ( line.ascender + -line.descender ); + penY += lineOffset; + if( ( penY + lineOffset ) > boundingBox ) { offsetValues.PushBack( numberOfCharacters ); penY = 0.f; diff --git a/dali-toolkit/devel-api/text/text-utils-devel.h b/dali-toolkit/devel-api/text/text-utils-devel.h index 0670e8e..3440621 100755 --- a/dali-toolkit/devel-api/text/text-utils-devel.h +++ b/dali-toolkit/devel-api/text/text-utils-devel.h @@ -57,7 +57,8 @@ struct DALI_TOOLKIT_API RendererParameters incrementAngle{ 0.f }, ellipsisEnabled{ true }, markupEnabled{ false }, - isTextColorSet{ false } + isTextColorSet{ false }, + minLineSize{ 0.f } {} std::string text; ///< The text to be rendered encoded in utf8. @@ -86,6 +87,8 @@ struct DALI_TOOLKIT_API RendererParameters bool ellipsisEnabled:1; ///< Whether the ellipsis layout option is enabled. bool markupEnabled:1; ///< Whether the mark-up processor is enabled. bool isTextColorSet:1; ///< Whether a default color has been set. + + float minLineSize; ///< The line's minimum size (in points). }; /** -- 2.7.4