/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali-toolkit/internal/text/bidirectional-support.h>
#include <dali-toolkit/internal/text/character-set-conversion.h>
#include <dali-toolkit/internal/text/color-segmentation.h>
+#include <dali-toolkit/internal/text/glyph-metrics-helper.h>
#include <dali-toolkit/internal/text/layouts/layout-engine.h>
#include <dali-toolkit/internal/text/layouts/layout-parameters.h>
#include <dali-toolkit/internal/text/markup-processor.h>
textModel->mLogicalModel->mEmbeddedItems,
textModel->mLogicalModel->mAnchors,
textModel->mLogicalModel->mUnderlinedCharacterRuns,
- textModel->mLogicalModel->mBackgroundColorRuns);
+ textModel->mLogicalModel->mBackgroundColorRuns,
+ textModel->mLogicalModel->mStrikethroughCharacterRuns,
+ textModel->mLogicalModel->mBoundedParagraphRuns);
if(textParameters.markupEnabled)
{
Text::ModelPtr& textModel = internalDataModel.textModel;
FontClient& fontClient = internalDataModel.fontClient;
- Vector<LineRun>& lines = textModel->mVisualModel->mLines; // The laid out lines.
- Vector<bool>& isEmoji = internalDataModel.isEmoji;
- const Size textLayoutArea = internalDataModel.textLayoutArea;
+ Vector<LineRun>& lines = textModel->mVisualModel->mLines; // The laid out lines.
+ Vector<bool>& isEmoji = internalDataModel.isEmoji;
+ const Size textLayoutArea = internalDataModel.textLayoutArea;
+ const float characterSpacing = textModel->mVisualModel->GetCharacterSpacing();
+ float calculatedAdvance = 0.f;
+ Vector<CharacterIndex>& glyphToCharacterMap = textModel->mVisualModel->mGlyphsToCharacters;
+ const CharacterIndex* glyphToCharacterMapBuffer = glyphToCharacterMap.Begin();
////////////////////////////////////////////////////////////////////////////////
// Ellipsis the text.
////////////////////////////////////////////////////////////////////////////////
{
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.
firstPenSet = true;
}
- removedGlypsWidth += std::min(glyphToRemove.advance, (glyphToRemove.xBearing + glyphToRemove.width));
+ 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;
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)
{