X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Fdevel-api%2Ftext%2Ftext-utils-devel.cpp;h=41d7126d4f69f28cfd84d1af222968eecc9f16e1;hb=HEAD;hp=b4abff29bbb546b997ad48cb6c5a649af9076fd8;hpb=aea5add7a82f4bd507d31526074238f2b641fcd8;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 b4abff2..98c37ab 100644 --- a/dali-toolkit/devel-api/text/text-utils-devel.cpp +++ b/dali-toolkit/devel-api/text/text-utils-devel.cpp @@ -31,10 +31,12 @@ #include #include #include +#include #include #include -#include +#include #include +#include #include #include #include @@ -176,11 +178,15 @@ void ShapeTextPreprocess(const RendererParameters& textParameters, TextAbstracti textModel->mLogicalModel->mAnchors, textModel->mLogicalModel->mUnderlinedCharacterRuns, textModel->mLogicalModel->mBackgroundColorRuns, - textModel->mLogicalModel->mStrikethroughCharacterRuns); + textModel->mLogicalModel->mStrikethroughCharacterRuns, + textModel->mLogicalModel->mBoundedParagraphRuns, + textModel->mLogicalModel->mCharacterSpacingCharacterRuns); if(textParameters.markupEnabled) { - ProcessMarkupString(textParameters.text, markupProcessData); + MarkupPropertyData markupPropertyData(Color::MEDIUM_BLUE, Color::DARK_MAGENTA); + + ProcessMarkupString(textParameters.text, markupPropertyData, markupProcessData); textSize = markupProcessData.markupProcessedText.size(); // This is a bit horrible but std::string returns a (signed) char* @@ -289,6 +295,7 @@ void ShapeTextPreprocess(const RendererParameters& textParameters, TextAbstracti fontDescriptionRuns, defaultFontDescription, defaultPointSize, + 1.0f, 0u, numberOfCharacters, validFonts); @@ -814,9 +821,17 @@ void Ellipsis(const RendererParameters& textParameters, TextAbstraction::TextRen Text::ModelPtr& textModel = internalDataModel.textModel; FontClient& fontClient = internalDataModel.fontClient; - Vector& lines = textModel->mVisualModel->mLines; // The laid out lines. - Vector& isEmoji = internalDataModel.isEmoji; - const Size textLayoutArea = internalDataModel.textLayoutArea; + Vector& lines = textModel->mVisualModel->mLines; // The laid out lines. + Vector& isEmoji = internalDataModel.isEmoji; + const Size textLayoutArea = internalDataModel.textLayoutArea; + 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. //////////////////////////////////////////////////////////////////////////////// @@ -829,7 +844,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. @@ -902,7 +917,9 @@ void Ellipsis(const RendererParameters& textParameters, TextAbstraction::TextRen firstPenSet = true; } - removedGlypsWidth += std::min(glyphToRemove.advance, (glyphToRemove.xBearing + glyphToRemove.width)); + 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. const float ellipsisGlyphWidth = ellipsisGlyph.width + ellipsisGlyph.xBearing; @@ -1051,11 +1068,16 @@ Size LayoutText(const RendererParameters& textParameters, TextAbstraction::TextR // Update the visual model. Size newLayoutSize; - bool isAutoScrollEnabled = false; + bool isAutoScrollEnabled = false; + bool isAutoScrollMaxTextureExceeded = false; + bool isHiddenInputEnabled = false; + layoutEngine.LayoutText(layoutParameters, newLayoutSize, textParameters.ellipsisEnabled, isAutoScrollEnabled, + isAutoScrollMaxTextureExceeded, + isHiddenInputEnabled, ellipsisPosition); return newLayoutSize; @@ -1521,12 +1543,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) {