From: minho.sun Date: Wed, 3 Jan 2018 07:07:01 +0000 (+0900) Subject: [4.0] Line spacing for TextLabel and vertical line alignment feature X-Git-Tag: accepted/tizen/4.0/unified/20180104.054040~2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=9817d4be0f95105f1cc8c5a211296da86af6d471 [4.0] Line spacing for TextLabel and vertical line alignment feature This reverts commit d9f52831497acf7589958206941179cca4c36b8e. Change-Id: I93283075607435849addf21c4d0ccff669be41ea --- diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp index 02f2e66..6c63ce1 100644 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp @@ -535,3 +535,125 @@ int UtcDaliTextControllerSetGetTapLongPressAction(void) END_TEST; } + +int UtcDaliTextControllerSetGetLineSpacingProperty(void) +{ + tet_infoline(" UtcDaliTextControllerSetGetLineSpacingProperty"); + ToolkitTestApplication application; + + const Size size( Dali::Stage::GetCurrent().GetSize() ); + + // single line text + const std::string textSingle("A Quick Brown Fox Jumps Over The Lazy Dog"); + + // multi-line text + const std::string textMulti("A Quick Brown\nFox Jumps Over\nThe Lazy Dog"); + + // Creates a text controller. + ControllerPtr controller = Controller::New(); + + ConfigureTextLabel(controller); + + // single line, line spacing = 0px + { + const float EXPECTED_SPACING = 0.0f; + const Vector2 EXPECTED_LAYOUT_SIZE( 326.0f, 19.0f); + const Vector3 EXPECTED_NATURAL_SIZE( 326.0f, 20.0f, 0.0f ); + + controller->SetText(textSingle); + controller->Relayout(size); + controller->SetMultiLineEnabled( false ); + + Vector3 naturalSize = controller->GetNaturalSize(); + Vector2 layoutSize = controller->GetTextModel()->GetLayoutSize(); + float lineSpacing0 = controller->GetDefaultLineSpacing(); + + DALI_TEST_EQUALS( EXPECTED_SPACING, lineSpacing0, TEST_LOCATION ); + DALI_TEST_EQUALS( EXPECTED_LAYOUT_SIZE, layoutSize, TEST_LOCATION ); + DALI_TEST_EQUALS( EXPECTED_NATURAL_SIZE, naturalSize, TEST_LOCATION ); + } + + // single line, line spacing = 20px + { + const float EXPECTED_SPACING = 20.0f; + const Vector2 EXPECTED_LAYOUT_SIZE( 326.0f, 19.0f ); + const Vector3 EXPECTED_NATURAL_SIZE( 326.0f, 40.0f, 0.0f ); + + controller->SetText(textSingle); + controller->Relayout(size); + controller->SetDefaultLineSpacing( 20 ); + controller->SetMultiLineEnabled( false ); + + Vector3 naturalSize = controller->GetNaturalSize(); + Vector2 layoutSize = controller->GetTextModel()->GetLayoutSize(); + float lineSpacing0 = controller->GetDefaultLineSpacing(); + + DALI_TEST_EQUALS( EXPECTED_SPACING, lineSpacing0, TEST_LOCATION ); + DALI_TEST_EQUALS( EXPECTED_LAYOUT_SIZE, layoutSize, TEST_LOCATION ); + DALI_TEST_EQUALS( EXPECTED_NATURAL_SIZE, naturalSize, TEST_LOCATION ); + } + + // multi-line, line spacing = 0px + { + const float EXPECTED_SPACING = 0.0f; + const Vector2 EXPECTED_LAYOUT_SIZE( 318.0f, 39.0f ); + const Vector3 EXPECTED_NATURAL_SIZE( 116.0f, 58.0f, 0.0f ); + + controller->SetText(textMulti); + controller->Relayout(size); + controller->SetMultiLineEnabled( true ); + controller->SetDefaultLineSpacing( 0 ); + + Vector3 naturalSize = controller->GetNaturalSize(); + Vector2 layoutSize = controller->GetTextModel()->GetLayoutSize(); + float lineSpacing0 = controller->GetDefaultLineSpacing(); + + DALI_TEST_EQUALS( EXPECTED_SPACING, lineSpacing0, TEST_LOCATION ); + DALI_TEST_EQUALS( EXPECTED_LAYOUT_SIZE, layoutSize, TEST_LOCATION ); + DALI_TEST_EQUALS( EXPECTED_NATURAL_SIZE, naturalSize, TEST_LOCATION ); + } + + // multi-line, line spacing = 20px + { + const float EXPECTED_SPACING = 20.0f; + const Vector2 EXPECTED_LAYOUT_SIZE( 115.0f, 57.0f ); + const Vector3 EXPECTED_NATURAL_SIZE( 116.0f, 118.0f, 0.0f ); + + controller->SetText(textMulti); + controller->Relayout(size); + controller->SetMultiLineEnabled( true ); + controller->SetDefaultLineSpacing( 20 ); + + Vector3 naturalSize = controller->GetNaturalSize(); + Vector2 layoutSize = controller->GetTextModel()->GetLayoutSize(); + float lineSpacing0 = controller->GetDefaultLineSpacing(); + + DALI_TEST_EQUALS( EXPECTED_SPACING, lineSpacing0, TEST_LOCATION ); + DALI_TEST_EQUALS( EXPECTED_LAYOUT_SIZE, layoutSize, TEST_LOCATION ); + DALI_TEST_EQUALS( EXPECTED_NATURAL_SIZE, naturalSize, TEST_LOCATION ); + } + + // multi-line, line spacing = 30px + { + const float EXPECTED_SPACING = 30.0f; + const Vector2 EXPECTED_LAYOUT_SIZE( 115.0f, 117.0f ); + const Vector3 EXPECTED_NATURAL_SIZE( 116.0f, 148.0f, 0.0f ); + + controller->SetText(textMulti); + controller->Relayout(size); + controller->SetMultiLineEnabled( true ); + controller->SetDefaultLineSpacing( 30 ); + + Vector3 naturalSize = controller->GetNaturalSize(); + Vector2 layoutSize = controller->GetTextModel()->GetLayoutSize(); + float lineSpacing0 = controller->GetDefaultLineSpacing(); + + DALI_TEST_EQUALS( EXPECTED_SPACING, lineSpacing0, TEST_LOCATION ); + DALI_TEST_EQUALS( EXPECTED_LAYOUT_SIZE, layoutSize, TEST_LOCATION ); + DALI_TEST_EQUALS( EXPECTED_NATURAL_SIZE, naturalSize, TEST_LOCATION ); + } + + + END_TEST; + +} \ No newline at end of file diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp index b521976..48c4476 100644 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp @@ -716,6 +716,7 @@ int UtcDaliTextLayoutSmallTextArea02(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -806,6 +807,7 @@ int UtcDaliTextLayoutMultilineText01(void) -5.f, 3.f, 0.f, + 0.f, false, false }; @@ -818,6 +820,7 @@ int UtcDaliTextLayoutMultilineText01(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -830,6 +833,7 @@ int UtcDaliTextLayoutMultilineText01(void) -4.f, 5.f, 0.f, + 0.f, false, false }; @@ -842,6 +846,7 @@ int UtcDaliTextLayoutMultilineText01(void) -4.f, 5.f, 0.f, + 0.f, false, false }; @@ -854,6 +859,7 @@ int UtcDaliTextLayoutMultilineText01(void) -4.f, 0.f, 0.f, + 0.f, false, false }; @@ -1001,6 +1007,7 @@ int UtcDaliTextLayoutMultilineText02(void) -5.f, 3.f, 0.f, + 0.f, false, false }; @@ -1013,6 +1020,7 @@ int UtcDaliTextLayoutMultilineText02(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -1025,6 +1033,7 @@ int UtcDaliTextLayoutMultilineText02(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -1037,6 +1046,7 @@ int UtcDaliTextLayoutMultilineText02(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -1049,6 +1059,7 @@ int UtcDaliTextLayoutMultilineText02(void) -5.f, 3.f, 0.f, + 0.f, false, false }; @@ -1061,6 +1072,7 @@ int UtcDaliTextLayoutMultilineText02(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -1142,6 +1154,7 @@ int UtcDaliTextLayoutMultilineText03(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -1154,6 +1167,7 @@ int UtcDaliTextLayoutMultilineText03(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -1166,6 +1180,7 @@ int UtcDaliTextLayoutMultilineText03(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -1253,6 +1268,7 @@ int UtcDaliTextLayoutMultilineText04(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -1355,6 +1371,7 @@ int UtcDaliTextLayoutMultilineText05(void) -8.f, 4.f, 0.f, + 0.f, false, false }; @@ -1367,6 +1384,7 @@ int UtcDaliTextLayoutMultilineText05(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -1685,6 +1703,7 @@ int UtcDaliTextUpdateLayout01(void) -5.f, 3.f, 0.f, + 0.f, false, false }; @@ -1697,6 +1716,7 @@ int UtcDaliTextUpdateLayout01(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -1709,6 +1729,7 @@ int UtcDaliTextUpdateLayout01(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -1721,6 +1742,7 @@ int UtcDaliTextUpdateLayout01(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -1733,6 +1755,7 @@ int UtcDaliTextUpdateLayout01(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -1745,6 +1768,7 @@ int UtcDaliTextUpdateLayout01(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -1757,6 +1781,7 @@ int UtcDaliTextUpdateLayout01(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -1769,6 +1794,7 @@ int UtcDaliTextUpdateLayout01(void) -5.f, 3.f, 0.f, + 0.f, false, false }; @@ -1781,6 +1807,7 @@ int UtcDaliTextUpdateLayout01(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -1793,6 +1820,7 @@ int UtcDaliTextUpdateLayout01(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -1805,6 +1833,7 @@ int UtcDaliTextUpdateLayout01(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -1817,6 +1846,7 @@ int UtcDaliTextUpdateLayout01(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -1829,6 +1859,7 @@ int UtcDaliTextUpdateLayout01(void) -5.f, 3.f, 0.f, + 0.f, false, false }; @@ -1841,6 +1872,7 @@ int UtcDaliTextUpdateLayout01(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -1853,6 +1885,7 @@ int UtcDaliTextUpdateLayout01(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -1865,6 +1898,7 @@ int UtcDaliTextUpdateLayout01(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -1877,6 +1911,7 @@ int UtcDaliTextUpdateLayout01(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -1889,6 +1924,7 @@ int UtcDaliTextUpdateLayout01(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -1901,6 +1937,7 @@ int UtcDaliTextUpdateLayout01(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -2241,6 +2278,7 @@ int UtcDaliTextUpdateLayout02(void) -5.f, 3.f, 0.f, + 0.f, false, false }; @@ -2253,6 +2291,7 @@ int UtcDaliTextUpdateLayout02(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -2265,6 +2304,7 @@ int UtcDaliTextUpdateLayout02(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -2277,6 +2317,7 @@ int UtcDaliTextUpdateLayout02(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -2289,6 +2330,7 @@ int UtcDaliTextUpdateLayout02(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -2301,6 +2343,7 @@ int UtcDaliTextUpdateLayout02(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -2313,6 +2356,7 @@ int UtcDaliTextUpdateLayout02(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -2325,6 +2369,7 @@ int UtcDaliTextUpdateLayout02(void) -5.f, 3.f, 0.f, + 0.f, false, false }; @@ -2337,6 +2382,7 @@ int UtcDaliTextUpdateLayout02(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -2349,6 +2395,7 @@ int UtcDaliTextUpdateLayout02(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -2361,6 +2408,7 @@ int UtcDaliTextUpdateLayout02(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -2373,6 +2421,7 @@ int UtcDaliTextUpdateLayout02(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -2385,6 +2434,7 @@ int UtcDaliTextUpdateLayout02(void) -5.f, 3.f, 0.f, + 0.f, false, false }; @@ -2397,6 +2447,7 @@ int UtcDaliTextUpdateLayout02(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -2409,6 +2460,7 @@ int UtcDaliTextUpdateLayout02(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -2421,6 +2473,7 @@ int UtcDaliTextUpdateLayout02(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -2433,6 +2486,7 @@ int UtcDaliTextUpdateLayout02(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -2445,6 +2499,7 @@ int UtcDaliTextUpdateLayout02(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -2457,6 +2512,7 @@ int UtcDaliTextUpdateLayout02(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -2797,6 +2853,7 @@ int UtcDaliTextUpdateLayout03(void) -5.f, 3.f, 0.f, + 0.f, false, false }; @@ -2809,6 +2866,7 @@ int UtcDaliTextUpdateLayout03(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -2821,6 +2879,7 @@ int UtcDaliTextUpdateLayout03(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -2833,6 +2892,7 @@ int UtcDaliTextUpdateLayout03(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -2845,6 +2905,7 @@ int UtcDaliTextUpdateLayout03(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -2857,6 +2918,7 @@ int UtcDaliTextUpdateLayout03(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -2869,6 +2931,7 @@ int UtcDaliTextUpdateLayout03(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -2881,6 +2944,7 @@ int UtcDaliTextUpdateLayout03(void) -5.f, 3.f, 0.f, + 0.f, false, false }; @@ -2893,6 +2957,7 @@ int UtcDaliTextUpdateLayout03(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -2905,6 +2970,7 @@ int UtcDaliTextUpdateLayout03(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -2917,6 +2983,7 @@ int UtcDaliTextUpdateLayout03(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -2929,6 +2996,7 @@ int UtcDaliTextUpdateLayout03(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -2941,6 +3009,7 @@ int UtcDaliTextUpdateLayout03(void) -5.f, 3.f, 0.f, + 0.f, false, false }; @@ -2953,6 +3022,7 @@ int UtcDaliTextUpdateLayout03(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -2965,6 +3035,7 @@ int UtcDaliTextUpdateLayout03(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -2977,6 +3048,7 @@ int UtcDaliTextUpdateLayout03(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -2989,6 +3061,7 @@ int UtcDaliTextUpdateLayout03(void) -5.f, 4.f, 0.f, + 0.f, false, false }; @@ -3001,6 +3074,7 @@ int UtcDaliTextUpdateLayout03(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -3013,6 +3087,7 @@ int UtcDaliTextUpdateLayout03(void) -5.f, 0.f, 0.f, + 0.f, false, false }; @@ -3104,6 +3179,7 @@ int UtcDaliTextLayoutEllipsis01(void) -5.f, 0.f, 0.f, + 0.f, false, true }; @@ -3180,6 +3256,7 @@ int UtcDaliTextLayoutEllipsis02(void) -5.f, 3.f, 0.f, + 0.f, false, false }; @@ -3192,6 +3269,7 @@ int UtcDaliTextLayoutEllipsis02(void) -5.f, 0.f, 0.f, + 0.f, false, true }; @@ -3336,6 +3414,7 @@ int UtcDaliTextLayoutEllipsis03(void) -5.f, 0.f, 0.f, + 0.f, false, true }; @@ -3478,6 +3557,7 @@ int UtcDaliTextLayoutEllipsis04(void) -5.f, 3.f, 0.f, + 0.f, false, false }; @@ -3490,6 +3570,7 @@ int UtcDaliTextLayoutEllipsis04(void) -5.f, 4.f, 0.f, + 0.f, false, true }; @@ -3566,6 +3647,7 @@ int UtcDaliTextLayoutEllipsis05(void) -5.f, 0.f, 0.f, + 0.f, false, true }; diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Typesetter.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Typesetter.cpp index 50ca75d..14f352c 100644 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Typesetter.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Typesetter.cpp @@ -141,3 +141,57 @@ int UtcDaliTextRenderingControllerRender(void) tet_result(TET_PASS); END_TEST; } + +int UtcDaliTextTypesetterVerticalLineAlignment(void) +{ + tet_infoline(" UtcDaliTextTypesetter"); + ToolkitTestApplication application; + + // Creates a text controller. + ControllerPtr controller = Controller::New(); + + // Configures the text controller similarly to the text-label. + ConfigureTextLabel( controller ); + + // Sets the text. + controller->SetMarkupProcessorEnabled( true ); + controller->SetText( "Hello world" ); + + // Creates the text's model and relais-out the text. + const Size relayoutSize( 120.f, 60.f ); + controller->Relayout( relayoutSize ); + + // Tests the rendering controller has been created. + TypesetterPtr renderingController = Typesetter::New( controller->GetTextModel() ); + DALI_TEST_CHECK( renderingController ); + + { + controller->SetVerticalLineAlignment(Dali::Toolkit::DevelText::VerticalLineAlignment::TOP); + controller->Relayout(relayoutSize); + + // Renders the text and creates the final bitmap. + auto bitmap = renderingController->Render(relayoutSize); + DALI_TEST_EQUALS( 60u, bitmap.GetHeight(), TEST_LOCATION ); + } + + { + controller->SetVerticalLineAlignment(Dali::Toolkit::DevelText::VerticalLineAlignment::MIDDLE); + controller->Relayout(relayoutSize); + + // Renders the text and creates the final bitmap. + auto bitmap = renderingController->Render(relayoutSize); + DALI_TEST_EQUALS( 60u, bitmap.GetHeight(), TEST_LOCATION ); + } + + { + controller->SetVerticalLineAlignment(Dali::Toolkit::DevelText::VerticalLineAlignment::BOTTOM); + controller->Relayout(relayoutSize); + + // Renders the text and creates the final bitmap. + auto bitmap = renderingController->Render(relayoutSize); + DALI_TEST_EQUALS( 60u, bitmap.GetHeight(), TEST_LOCATION ); + } + + tet_result(TET_PASS); + END_TEST; +} \ No newline at end of file diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp index f8d7497..cf36a87 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp @@ -429,14 +429,35 @@ int UtcDaliToolkitTextLabelSetPropertyP(void) label.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::FINISH_LOOP ); DALI_TEST_EQUALS( STOP_FINISH_LOOP, label.GetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE ), TEST_LOCATION ); + // test natural size with multi-line and line spacing + { + TextLabel label3 = TextLabel::New("Some text here\nend there\nend here"); + Vector3 expected0(414.f, 192.f, 0.0f); + Vector3 expected1(414.f, 252.f, 0.0f); + label3.SetProperty(TextLabel::Property::MULTI_LINE, true); + label3.SetProperty(TextLabel::Property::LINE_SPACING, 0); + DALI_TEST_EQUALS(expected0, label3.GetNaturalSize(), TEST_LOCATION); + label3.SetProperty(TextLabel::Property::LINE_SPACING, 20); + DALI_TEST_EQUALS(expected1, label3.GetNaturalSize(), TEST_LOCATION); + } + // single line, line spacing must not affect natural size + { + const Vector3 expected0(948.f, 64.f, 0.0f); + const Vector3 expected1(948.f, 84.f, 0.0f); + TextLabel label3 = TextLabel::New("Some text here end there end here"); + label3.SetProperty(TextLabel::Property::MULTI_LINE, false); + label3.SetProperty(TextLabel::Property::LINE_SPACING, 0); + DALI_TEST_EQUALS(expected0, label3.GetNaturalSize(), TEST_LOCATION); + label3.SetProperty(TextLabel::Property::LINE_SPACING, 20); + DALI_TEST_EQUALS(expected1, label3.GetNaturalSize(), TEST_LOCATION); + } // Check the line spacing property DALI_TEST_EQUALS( label.GetProperty( TextLabel::Property::LINE_SPACING ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); label.SetProperty( TextLabel::Property::LINE_SPACING, 10.f ); DALI_TEST_EQUALS( label.GetProperty( TextLabel::Property::LINE_SPACING ), 10.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); // Check the underline property - underlineMapSet.Clear(); underlineMapSet.Insert( "enable", "true" ); underlineMapSet.Insert( "color", "red" ); @@ -1220,3 +1241,26 @@ int UtcDaliToolkitTextlabelTextDirection(void) END_TEST; } + +int UtcDaliToolkitTextlabelVerticalLineAlignment(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliToolkitTextlabelVerticalLineAlignment"); + + TextLabel label = TextLabel::New(); + + label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::TOP ); + label.SetProperty( TextLabel::Property::TEXT, "Hello world" ); + label.SetProperty( TextLabel::Property::POINT_SIZE, 15 ); + label.SetProperty( TextLabel::Property::LINE_SPACING, 12 ); + Stage::GetCurrent().Add( label ); + DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::TOP ), TEST_LOCATION ); + + label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::MIDDLE ); + DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::MIDDLE ), TEST_LOCATION ); + + label.SetProperty( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT, DevelText::VerticalLineAlignment::BOTTOM ); + DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT ), static_cast< int >( Toolkit::DevelText::VerticalLineAlignment::BOTTOM ), TEST_LOCATION ); + + END_TEST; +} \ No newline at end of file diff --git a/dali-toolkit/devel-api/controls/text-controls/text-label-devel.h b/dali-toolkit/devel-api/controls/text-controls/text-label-devel.h index 2838a00..3238c61 100644 --- a/dali-toolkit/devel-api/controls/text-controls/text-label-devel.h +++ b/dali-toolkit/devel-api/controls/text-controls/text-label-devel.h @@ -67,10 +67,19 @@ namespace Property /** * @brief The direction of the layout. - * @details Name "textDirection", type Property::Integer, Read-Only. + * @details Name "textDirection", type [Type](@ref Dali::Toolkit::DevelText::TextDirection::Type) (Property::INTEGER), Read/Write + * @note The text direction can be changed only by replacing the text itself. * @see TextDirection::Type for supported values. */ TEXT_DIRECTION, + + /** + * @brief Alignment of text within area of single line + * @details Name "verticalLineAlignment", type [Type](@ref Dali::Toolkit::DevelText::VerticalLineAlignment::Type) (Property::INTEGER), Read/Write + * @note The default value is TOP + * @see VerticalLineAlignment::Type for supported values + */ + VERTICAL_LINE_ALIGNMENT, }; } // namespace Property diff --git a/dali-toolkit/devel-api/text/text-enumerations-devel.h b/dali-toolkit/devel-api/text/text-enumerations-devel.h index 5062417..4e9b278 100644 --- a/dali-toolkit/devel-api/text/text-enumerations-devel.h +++ b/dali-toolkit/devel-api/text/text-enumerations-devel.h @@ -38,6 +38,18 @@ enum Type } // namespace TextDirection +namespace VerticalLineAlignment +{ + +enum Type +{ + TOP, + MIDDLE, + BOTTOM +}; + +} // namespace VerticalLineAlignment + } // namespace DevelText } // namespace Toolkit diff --git a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp index a75d703..77974d5 100644 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp @@ -511,8 +511,14 @@ void TextEditor::SetProperty( BaseObject* object, Property::Index index, const P { if( impl.mController ) { + + // The line spacing isn't supported by the TextEditor. Since it's supported + // by the TextLabel for now it must be ignored. The property is being shadowed + // locally so its value isn't affected. const float lineSpacing = value.Get(); - impl.mController->SetDefaultLineSpacing( lineSpacing ); + impl.mLineSpacing = lineSpacing; + // set it to 0.0 due to missing implementation + impl.mController->SetDefaultLineSpacing( 0.0f ); impl.mRenderer.Reset(); } break; @@ -973,7 +979,9 @@ Property::Value TextEditor::GetProperty( BaseObject* object, Property::Index ind { if( impl.mController ) { - value = impl.mController->GetDefaultLineSpacing(); + // LINE_SPACING isn't implemented for the TextEditor. Returning + // only shadowed value, not the real one. + value = impl.mLineSpacing; } break; } @@ -1799,6 +1807,7 @@ TextEditor::TextEditor() mIdleCallback( NULL ), mAlignmentOffset( 0.f ), mScrollAnimationDuration( 0.f ), + mLineSpacing( 0.f ), mRenderingBackend( DEFAULT_RENDERING_BACKEND ), mHasBeenStaged( false ), mScrollAnimationEnabled( false ), diff --git a/dali-toolkit/internal/controls/text-controls/text-editor-impl.h b/dali-toolkit/internal/controls/text-controls/text-editor-impl.h index f121799..a3a8854 100644 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.h @@ -300,6 +300,7 @@ private: // Data float mAlignmentOffset; float mScrollAnimationDuration; + float mLineSpacing; int mRenderingBackend; bool mHasBeenStaged:1; bool mScrollAnimationEnabled:1; diff --git a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp index cd96e00..3f420b5 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -116,6 +116,7 @@ DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollStopMode", DALI_PROPERTY_REGISTRATION_READ_ONLY( Toolkit, TextLabel, "lineCount", INTEGER, LINE_COUNT ) DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "lineWrapMode", INTEGER, LINE_WRAP_MODE ) DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY( Toolkit, TextLabel, "textDirection", INTEGER, TEXT_DIRECTION ) +DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "verticalLineAlignment", INTEGER, VERTICAL_LINE_ALIGNMENT ) 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 ) @@ -410,8 +411,12 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr if( impl.mController ) { const float lineSpacing = value.Get(); - impl.mController->SetDefaultLineSpacing( lineSpacing ); - impl.mTextUpdateNeeded = true; + + // Don't trigger anything if the line spacing didn't change + if( impl.mController->SetDefaultLineSpacing( lineSpacing ) ) + { + impl.mTextUpdateNeeded = true; + } } break; } @@ -489,8 +494,37 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr } break; } + case Toolkit::DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT: + { + if( impl.mController && impl.mController->GetTextModel() ) + { + DevelText::VerticalLineAlignment::Type alignment = static_cast( value.Get() ); + + impl.mController->SetVerticalLineAlignment( alignment ); + + // Property doesn't affect the layout, only Visual must be updated + TextVisual::EnableRendererUpdate( impl.mVisual ); + + // No need to trigger full re-layout. Instead call UpdateRenderer() directly + TextVisual::UpdateRenderer( impl.mVisual ); + } + break; + } + } + + // Request relayout when text update is needed. It's necessary to call it + // as changing the property not via UI interaction brings no effect if only + // the mTextUpdateNeeded is changed. + if( impl.mTextUpdateNeeded ) + { + // need to request relayout as size of text may have changed + impl.RequestTextRelayout(); } } + + + + } Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index index ) @@ -761,6 +795,14 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde } break; } + case Toolkit::DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT: + { + if( impl.mController ) + { + value = impl.mController->GetVerticalLineAlignment(); + } + break; + } } } diff --git a/dali-toolkit/internal/text/layouts/layout-engine.cpp b/dali-toolkit/internal/text/layouts/layout-engine.cpp index 59db8b0..af831cb 100644 --- a/dali-toolkit/internal/text/layouts/layout-engine.cpp +++ b/dali-toolkit/internal/text/layouts/layout-engine.cpp @@ -70,7 +70,8 @@ struct LineLayout extraWidth( 0.f ), wsLengthEndOfLine( 0.f ), ascender( 0.f ), - descender( MAX_FLOAT ) + descender( MAX_FLOAT ), + lineSpacing( 0.f ) {} ~LineLayout() @@ -100,6 +101,7 @@ struct LineLayout float wsLengthEndOfLine; ///< The length of the white spaces at the end of the line. float ascender; ///< The maximum ascender of all fonts in the line. float descender; ///< The minimum descender of all fonts in the line. + float lineSpacing; ///< The line spacing }; struct Engine::Impl @@ -133,6 +135,9 @@ struct Engine::Impl { lineLayout.descender = fontMetrics.descender; } + + // set the line spacing + lineLayout.lineSpacing = mDefaultLineSpacing; } /** @@ -565,7 +570,7 @@ struct Engine::Impl // Get the last line and layout it again with the 'completelyFill' flag to true. lineRun = linesBuffer + ( numberOfLines - 1u ); - penY -= layout.ascender - lineRun->descender; + penY -= layout.ascender - lineRun->descender + lineRun->lineSpacing; ellipsisLayout.glyphIndex = lineRun->glyphRun.glyphIndex; } @@ -598,7 +603,7 @@ struct Engine::Impl layoutSize.width = layoutParameters.boundingBox.width; if( layoutSize.height < Math::MACHINE_EPSILON_1000 ) { - layoutSize.height += ( lineRun->ascender + -lineRun->descender ); + layoutSize.height += ( lineRun->ascender + -lineRun->descender ) + lineRun->lineSpacing; } SetGlyphPositions( layoutParameters.glyphsBuffer + lineRun->glyphRun.glyphIndex, @@ -636,6 +641,8 @@ struct Engine::Impl lineRun.glyphRun.numberOfGlyphs = layout.numberOfGlyphs; lineRun.characterRun.characterIndex = layout.characterIndex; lineRun.characterRun.numberOfCharacters = layout.numberOfCharacters; + lineRun.lineSpacing = mDefaultLineSpacing; + if( isLastLine && !layoutParameters.isLastNewParagraph ) { const float width = layout.extraBearing + layout.length + layout.extraWidth + layout.wsLengthEndOfLine; @@ -666,7 +673,7 @@ struct Engine::Impl layoutSize.width = lineRun.width; } - layoutSize.height += ( lineRun.ascender + -lineRun.descender ); + layoutSize.height += ( lineRun.ascender + -lineRun.descender ) + lineRun.lineSpacing; } /** @@ -706,8 +713,9 @@ struct Engine::Impl lineRun.alignmentOffset = 0.f; lineRun.direction = !RTL; lineRun.ellipsis = false; + lineRun.lineSpacing = mDefaultLineSpacing; - layoutSize.height += ( lineRun.ascender + -lineRun.descender ); + layoutSize.height += ( lineRun.ascender + -lineRun.descender ) + lineRun.lineSpacing; } /** @@ -731,7 +739,7 @@ struct Engine::Impl layoutSize.width = line.width; } - layoutSize.height += ( line.ascender + -line.descender ); + layoutSize.height += ( line.ascender + -line.descender ) + line.lineSpacing; } } @@ -967,7 +975,7 @@ struct Engine::Impl glyphPositionsBuffer + index - layoutParameters.startGlyphIndex ); // Updates the vertical pen's position. - penY += -layout.descender; + penY += -layout.descender + layout.lineSpacing + mDefaultLineSpacing; // Increase the glyph index. index = nextIndex; @@ -1200,6 +1208,7 @@ struct Engine::Impl line.alignmentOffset = 0.f; line.direction = !RTL; line.ellipsis = false; + line.lineSpacing = mDefaultLineSpacing; } Type mLayout; diff --git a/dali-toolkit/internal/text/line-run.h b/dali-toolkit/internal/text/line-run.h index 52df79e..9023121 100644 --- a/dali-toolkit/internal/text/line-run.h +++ b/dali-toolkit/internal/text/line-run.h @@ -43,6 +43,7 @@ struct LineRun float descender; ///< The line's descender. float extraLength; ///< The length of the white spaces at the end of the line. float alignmentOffset; ///< The horizontal alignment offset. + float lineSpacing; ///< The line's spacing CharacterDirection direction : 1; ///< Direction of the first character of the paragraph. bool ellipsis : 1; ///< Wheter ellipsis is added to the line. }; diff --git a/dali-toolkit/internal/text/rendering/text-typesetter.cpp b/dali-toolkit/internal/text/rendering/text-typesetter.cpp index 410b782..c46a8c1 100755 --- a/dali-toolkit/internal/text/rendering/text-typesetter.cpp +++ b/dali-toolkit/internal/text/rendering/text-typesetter.cpp @@ -19,12 +19,13 @@ #include // EXTERNAL INCLUDES -#include #include +#include #include // INTERNAL INCLUDES #include +#include namespace Dali { @@ -298,6 +299,29 @@ PixelData Typesetter::Render( const Vector2& size, RenderBehaviour behaviour, bo } } + // Calculate vertical line alignment + switch( mModel->GetVerticalLineAlignment() ) + { + case DevelText::VerticalLineAlignment::TOP: + { + break; + } + case DevelText::VerticalLineAlignment::MIDDLE: + { + const auto& line = *mModel->GetLines(); + penY -= line.descender; + penY += static_cast(line.lineSpacing*0.5f + line.descender); + break; + } + case DevelText::VerticalLineAlignment::BOTTOM: + { + const auto& line = *mModel->GetLines(); + const auto lineHeight = line.ascender + (-line.descender) + line.lineSpacing; + penY += static_cast(lineHeight - (line.ascender - line.descender)); + break; + } + } + // Generate the image buffers of the text for each different style first, // then combine all of them together as one final image buffer. We try to // do all of these in CPU only, so that once the final texture is generated, @@ -431,6 +455,12 @@ Devel::PixelBuffer Typesetter::CreateImageBuffer( const unsigned int bufferWidth // Increases the vertical offset with the line's ascender. glyphData.verticalOffset += static_cast( line.ascender ); + // Include line spacing after first line + if( lineIndex > 0u ) + { + glyphData.verticalOffset += static_cast( line.lineSpacing ); + } + // Retrieves the glyph's outline width float outlineWidth = mModel->GetOutlineWidth(); diff --git a/dali-toolkit/internal/text/rendering/view-model.cpp b/dali-toolkit/internal/text/rendering/view-model.cpp index 1721a1c..4d87891 100755 --- a/dali-toolkit/internal/text/rendering/view-model.cpp +++ b/dali-toolkit/internal/text/rendering/view-model.cpp @@ -71,6 +71,11 @@ VerticalAlignment::Type ViewModel::GetVerticalAlignment() const return mModel->GetVerticalAlignment(); } +DevelText::VerticalLineAlignment::Type ViewModel::GetVerticalLineAlignment() const +{ + return mModel->GetVerticalLineAlignment(); +} + bool ViewModel::IsTextElideEnabled() const { return mModel->IsTextElideEnabled(); diff --git a/dali-toolkit/internal/text/rendering/view-model.h b/dali-toolkit/internal/text/rendering/view-model.h index 0c0bb01..46c618f 100755 --- a/dali-toolkit/internal/text/rendering/view-model.h +++ b/dali-toolkit/internal/text/rendering/view-model.h @@ -24,6 +24,7 @@ // INTERNAL INCLUDES #include #include +#include namespace Dali { @@ -83,6 +84,11 @@ public: virtual Text::VerticalAlignment::Type GetVerticalAlignment() const; /** + * @copydoc ModelInterface::GetVerticalLineAlignment() + */ + virtual DevelText::VerticalLineAlignment::Type GetVerticalLineAlignment() const; + + /** * @copydoc ModelInterface::IsTextElideEnabled() */ virtual bool IsTextElideEnabled() const; diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 88940b5..a504bf6 100755 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -1253,10 +1253,15 @@ const std::string& Controller::GetDefaultOutlineProperties() const return EMPTY_STRING; } -void Controller::SetDefaultLineSpacing( float lineSpacing ) +bool Controller::SetDefaultLineSpacing( float lineSpacing ) { - //TODO finish implementation - mImpl->mLayoutEngine.SetDefaultLineSpacing( lineSpacing ); + if( std::abs(lineSpacing - mImpl->mLayoutEngine.GetDefaultLineSpacing()) > Math::MACHINE_EPSILON_1000 ) + { + mImpl->mLayoutEngine.SetDefaultLineSpacing(lineSpacing); + mImpl->mRecalculateNaturalSize = true; + return true; + } + return false; } float Controller::GetDefaultLineSpacing() const @@ -2141,6 +2146,16 @@ Toolkit::DevelText::TextDirection::Type Controller::GetTextDirection() return Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT; } +Toolkit::DevelText::VerticalLineAlignment::Type Controller::GetVerticalLineAlignment() const +{ + return mImpl->mModel->GetVerticalLineAlignment(); +} + +void Controller::SetVerticalLineAlignment( Toolkit::DevelText::VerticalLineAlignment::Type alignment ) +{ + mImpl->mModel->mVerticalLineAlignment = alignment; +} + // public : Relayout. Controller::UpdateTextType Controller::Relayout( const Size& size ) diff --git a/dali-toolkit/internal/text/text-controller.h b/dali-toolkit/internal/text/text-controller.h index dc2b4c4..defb8b5 100755 --- a/dali-toolkit/internal/text/text-controller.h +++ b/dali-toolkit/internal/text/text-controller.h @@ -891,8 +891,10 @@ public: // Default style & Input style * @brief Sets the default line spacing. * * @param[in] lineSpacing The line spacing. + * + * @return True if lineSpacing has been updated, false otherwise */ - void SetDefaultLineSpacing( float lineSpacing ); + bool SetDefaultLineSpacing( float lineSpacing ); /** * @brief Retrieves the default line spacing. @@ -1174,6 +1176,18 @@ public: // Queries & retrieves. */ Toolkit::DevelText::TextDirection::Type GetTextDirection(); + /** + * @brief Retrieves vertical line alignment + * @return The vertical line alignment + */ + Toolkit::DevelText::VerticalLineAlignment::Type GetVerticalLineAlignment() const; + + /** + * @brief Sets vertical line alignment + * @param[in] alignment The vertical line alignment for the text + */ + void SetVerticalLineAlignment( Toolkit::DevelText::VerticalLineAlignment::Type alignment ); + public: // Relayout. /** diff --git a/dali-toolkit/internal/text/text-model-interface.h b/dali-toolkit/internal/text/text-model-interface.h index ca575ce..ab21d62 100755 --- a/dali-toolkit/internal/text/text-model-interface.h +++ b/dali-toolkit/internal/text/text-model-interface.h @@ -26,6 +26,7 @@ #include #include #include +#include namespace Dali { @@ -84,6 +85,13 @@ public: virtual VerticalAlignment::Type GetVerticalAlignment() const = 0; /** + * @brief Retrieves the text's vertical line alignment. + * + * @return The vertical line alignment. + */ + virtual DevelText::VerticalLineAlignment::Type GetVerticalLineAlignment() const = 0; + + /** * @brief Whether the text elide property is enabled. * * @return @e true if the text elide property is enabled, @e false otherwise. diff --git a/dali-toolkit/internal/text/text-model.cpp b/dali-toolkit/internal/text/text-model.cpp index 7b6536d..7f23aac 100755 --- a/dali-toolkit/internal/text/text-model.cpp +++ b/dali-toolkit/internal/text/text-model.cpp @@ -57,6 +57,11 @@ VerticalAlignment::Type Model::GetVerticalAlignment() const return mVerticalAlignment; } +DevelText::VerticalLineAlignment::Type Model::GetVerticalLineAlignment() const +{ + return mVerticalLineAlignment; +} + bool Model::IsTextElideEnabled() const { return mElideEnabled; @@ -169,6 +174,7 @@ Model::Model() mScrollPositionLast(), mHorizontalAlignment( Text::HorizontalAlignment::BEGIN ), mVerticalAlignment( Text::VerticalAlignment::TOP ), + mVerticalLineAlignment( DevelText::VerticalLineAlignment::TOP ), mLineWrapMode( Text::LineWrap::WORD ), mAlignmentOffset( 0.0f ), mElideEnabled( false ) diff --git a/dali-toolkit/internal/text/text-model.h b/dali-toolkit/internal/text/text-model.h index da7fd24..9422996 100755 --- a/dali-toolkit/internal/text/text-model.h +++ b/dali-toolkit/internal/text/text-model.h @@ -84,6 +84,11 @@ public: virtual VerticalAlignment::Type GetVerticalAlignment() const; /** + * @copydoc ModelInterface::GetVerticalLineAlignment() + */ + virtual DevelText::VerticalLineAlignment::Type GetVerticalLineAlignment() const override; + + /** * @copydoc ModelInterface::IsTextElideEnabled() */ virtual bool IsTextElideEnabled() const; @@ -215,13 +220,14 @@ public: * 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. - 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. }; } // namespace Text diff --git a/dali-toolkit/internal/visuals/text/text-visual.h b/dali-toolkit/internal/visuals/text/text-visual.h index ef5890e..765b9bf 100644 --- a/dali-toolkit/internal/visuals/text/text-visual.h +++ b/dali-toolkit/internal/visuals/text/text-visual.h @@ -114,6 +114,15 @@ public: GetVisualObject( visual ).mRendererUpdateNeeded = true; }; + /** + * @brief Instantly updates the renderer + * @param[in] visual The text visual. + */ + static void UpdateRenderer( Toolkit::Visual::Base visual ) + { + GetVisualObject( visual ).UpdateRenderer(); + }; + public: // from Visual::Base /**