};
Size textArea( 100.f, 50.f );
- Size layoutSize( 100.f, 60.f );
+ Size layoutSize( 100.f, 40.f );
LayoutTextData data =
{
};
Size textArea( 100.f, 50.f );
- Size layoutSize( 100.f, 60.f );
+ Size layoutSize( 100.f, 40.f );
LayoutTextData data =
{
END_TEST;
}
+int UtcDaliTextLayoutEllipsis05(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextLayoutEllipsis05");
+
+ const std::string fontLatin( "TizenSans" );
+
+ // Set a known font description
+ FontDescriptionRun fontDescriptionRun01;
+ fontDescriptionRun01.characterRun.characterIndex = 0u;
+ fontDescriptionRun01.characterRun.numberOfCharacters = 51u;
+ fontDescriptionRun01.familyLength = fontLatin.size();
+ fontDescriptionRun01.familyName = new char[fontDescriptionRun01.familyLength];
+ memcpy( fontDescriptionRun01.familyName, fontLatin.c_str(), fontDescriptionRun01.familyLength );
+ fontDescriptionRun01.familyDefined = true;
+ fontDescriptionRun01.weightDefined = false;
+ fontDescriptionRun01.widthDefined = false;
+ fontDescriptionRun01.slantDefined = false;
+ fontDescriptionRun01.sizeDefined = false;
+
+ Vector<FontDescriptionRun> fontDescriptionRuns;
+ fontDescriptionRuns.PushBack( fontDescriptionRun01 );
+
+ struct LineRun line01 =
+ {
+ { 0u, 11u },
+ { 0u, 11u },
+ 80.f,
+ 15.f,
+ -5.f,
+ 0.f,
+ 0.f,
+ false,
+ true
+ };
+ Vector<LineRun> lines;
+ lines.PushBack( line01 );
+
+ float positions[] =
+ {
+ 1.f, -12.f
+ };
+
+ Size textArea( 100.f, 19.f );
+ Size layoutSize( 100.f, 20.f );
+
+ LayoutTextData data =
+ {
+ "Not enough height.",
+ "Hello world",
+ textArea,
+ 1u,
+ fontDescriptionRuns.Begin(),
+ layoutSize,
+ 1u,
+ positions,
+ 1u,
+ lines.Begin(),
+ LayoutEngine::MULTI_LINE_BOX,
+ 0u,
+ 11u,
+ true,
+ true
+ };
+
+ if( !LayoutTextTest( data ) )
+ {
+ tet_result(TET_FAIL);
+ }
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
int UtcDaliTextReorderLayout01(void)
{
ToolkitTestApplication application;
END_TEST;
}
+
+int UtcDaliToolkitTextlabelEllipsis(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsis");
+
+ TextLabel label = TextLabel::New("Hello world");
+ DALI_TEST_CHECK( label );
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+ Stage::GetCurrent().Add( label );
+
+ // Turn on all the effects
+ label.SetAnchorPoint( AnchorPoint::CENTER );
+ label.SetParentOrigin( ParentOrigin::CENTER );
+ label.SetSize( 360.0f, 10.f );
+
+ try
+ {
+ // Render the text.
+ application.SendNotification();
+ application.Render();
+ }
+ catch( ... )
+ {
+ tet_result(TET_FAIL);
+ }
+
+ END_TEST;
+}
lineRun->ellipsis = true;
layoutSize.width = layoutParameters.boundingBox.width;
- layoutSize.height += ( lineRun->ascender + -lineRun->descender );
+ if( layoutSize.height < Math::MACHINE_EPSILON_1000 )
+ {
+ layoutSize.height += ( lineRun->ascender + -lineRun->descender );
+ }
SetGlyphPositions( layoutParameters.glyphsBuffer + lineRun->glyphRun.glyphIndex,
ellipsisLayout.numberOfGlyphs,
if( lastLine.ellipsis )
{
+ if( ( 1u == numberOfLines ) &&
+ ( lastLine.ascender - lastLine.descender > mImpl->mVisualModel->mControlSize.height ) )
+ {
+ // Get the first glyph which is going to be replaced and the ellipsis glyph.
+ GlyphInfo& glyphInfo = *glyphs;
+ const GlyphInfo& ellipsisGlyph = mImpl->mFontClient.GetEllipsisGlyph( mImpl->mFontClient.GetPointSize( glyphInfo.fontId ) );
+
+ // Change the 'x' and 'y' position of the ellipsis glyph.
+ Vector2& position = *glyphPositions;
+ position.x = ellipsisGlyph.xBearing;
+ position.y = mImpl->mVisualModel->mControlSize.height - ellipsisGlyph.yBearing;
+
+ // Replace the glyph by the ellipsis glyph.
+ glyphInfo = ellipsisGlyph;
+
+ return 1u;
+ }
+
// firstPenX, penY and firstPenSet are used to position the ellipsis glyph if needed.
float firstPenX = 0.f; // Used if rtl text is elided.
float penY = 0.f;