X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Fdevel-api%2Ftext%2Ftext-utils-devel.cpp;h=c9ab7b54614175a37b01f88947a2c4ba0397644e;hb=702cdc29b907688eef62afbc63f0edb9e2dfb7d2;hp=81b82d821126d08bf868c17558aa898ed0668971;hpb=5151d2e631f0173f3ad7a5600b7286317741a596;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/devel-api/text/text-utils-devel.cpp b/dali-toolkit/devel-api/text/text-utils-devel.cpp index 81b82d8..c9ab7b5 100644 --- a/dali-toolkit/devel-api/text/text-utils-devel.cpp +++ b/dali-toolkit/devel-api/text/text-utils-devel.cpp @@ -31,16 +31,17 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include #include #include -#include namespace Dali { @@ -178,7 +179,8 @@ void ShapeTextPreprocess(const RendererParameters& textParameters, TextAbstracti textModel->mLogicalModel->mUnderlinedCharacterRuns, textModel->mLogicalModel->mBackgroundColorRuns, textModel->mLogicalModel->mStrikethroughCharacterRuns, - textModel->mLogicalModel->mBoundedParagraphRuns); + textModel->mLogicalModel->mBoundedParagraphRuns, + textModel->mLogicalModel->mCharacterSpacingCharacterRuns); if(textParameters.markupEnabled) { @@ -819,10 +821,14 @@ void Ellipsis(const RendererParameters& textParameters, TextAbstraction::TextRen Vector& lines = textModel->mVisualModel->mLines; // The laid out lines. Vector& isEmoji = internalDataModel.isEmoji; const Size textLayoutArea = internalDataModel.textLayoutArea; - const float characterSpacing = textModel->mVisualModel->GetCharacterSpacing(); + const float modelCharacterSpacing = textModel->mVisualModel->GetCharacterSpacing(); float calculatedAdvance = 0.f; Vector& glyphToCharacterMap = textModel->mVisualModel->mGlyphsToCharacters; const CharacterIndex* glyphToCharacterMapBuffer = glyphToCharacterMap.Begin(); + + // Get the character-spacing runs. + const Vector& characterSpacingGlyphRuns = textModel->mVisualModel->GetCharacterSpacingGlyphRuns(); + //////////////////////////////////////////////////////////////////////////////// // Ellipsis the text. //////////////////////////////////////////////////////////////////////////////// @@ -835,7 +841,7 @@ void Ellipsis(const RendererParameters& textParameters, TextAbstraction::TextRen { Length finalNumberOfGlyphs = 0u; - if((GetLineHeight(line)) > textLayoutArea.height) + if((GetLineHeight(line, (lines.Size() == 1))) > textLayoutArea.height) { // The height of the line is bigger than the height of the text area. // Show the ellipsis glyph even if it doesn't fit in the text area. @@ -908,7 +914,8 @@ void Ellipsis(const RendererParameters& textParameters, TextAbstraction::TextRen firstPenSet = true; } - calculatedAdvance = GetCalculatedAdvance(*(textModel->mLogicalModel->mText.Begin() + (*(glyphToCharacterMapBuffer + index))), characterSpacing, glyphToRemove.advance); + const float characterSpacing = GetGlyphCharacterSpacing(index, characterSpacingGlyphRuns, modelCharacterSpacing); + calculatedAdvance = GetCalculatedAdvance(*(textModel->mLogicalModel->mText.Begin() + (*(glyphToCharacterMapBuffer + index))), characterSpacing, glyphToRemove.advance); removedGlypsWidth += std::min(calculatedAdvance, (glyphToRemove.xBearing + glyphToRemove.width)); // Calculate the width of the ellipsis glyph and check if it fits. @@ -1528,12 +1535,14 @@ Dali::Property::Array RenderForLastIndex(RendererParameters& textParameters) float penY = 0.f; float lineSize = internalData.layoutEngine.GetDefaultLineSize(); float lineOffset = 0.f; + bool isLastLine; for(unsigned int index = 0u; index < numberOfLines; ++index) { const LineRun& line = *(lines.Begin() + index); numberOfCharacters += line.characterRun.numberOfCharacters; + isLastLine = (index == numberOfLines - 1); - lineOffset = lineSize > 0.f ? lineSize : GetLineHeight(line); + lineOffset = lineSize > 0.f ? lineSize : GetLineHeight(line, isLastLine); penY += lineOffset; if((penY + lineOffset) > boundingBox) {