/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
{
whiteSpaceLengthEndOfLine = 0.f;
}
- length = std::max(length, penX + glyphMetrics.xBearing + glyphMetrics.width);
+
+ if(parameters.textModel->mRemoveBackInset)
+ {
+ length = std::max(length, penX + glyphMetrics.xBearing + glyphMetrics.width);
+ }
+ else
+ {
+ length = std::max(length, penX + glyphMetrics.advance);
+ }
+
penX += (glyphMetrics.advance + parameters.interGlyphExtraAdvance);
}
}
{
whiteSpaceLengthEndOfLine = 0.f;
}
- length = std::max(length, penX + glyphMetrics.xBearing + glyphMetrics.width);
+
+ if(parameters.textModel->mRemoveBackInset)
+ {
+ length = std::max(length, penX + glyphMetrics.xBearing + glyphMetrics.width);
+ }
+ else
+ {
+ length = std::max(length, penX + glyphMetrics.advance);
+ }
penX += (glyphMetrics.advance + parameters.interGlyphExtraAdvance);
}
}
* @param[out] lineLayout The line layout.
* @param[in] completelyFill Whether to completely fill the line ( even if the last word exceeds the boundaries ).
* @param[in] ellipsisPosition Where is the location the text elide
+ * @param[in] hiddenInputEnabled Whether the hidden input is enabled.
*/
void GetLineLayoutForBox(const Parameters& parameters,
LayoutBidiParameters& bidiParameters,
bool completelyFill,
DevelText::EllipsisPosition::Type ellipsisPosition,
bool enforceEllipsisInSingleLine,
- bool elideTextEnabled)
+ bool elideTextEnabled,
+ bool hiddenInputEnabled)
{
DALI_LOG_INFO(gLogFilter, Debug::Verbose, "-->GetLineLayoutForBox\n");
DALI_LOG_INFO(gLogFilter, Debug::Verbose, " initial glyph index : %d\n", lineLayout.glyphIndex);
// The initial start point is zero. However it needs a correction according the 'x' bearing of the first glyph.
// i.e. if the bearing of the first glyph is negative it may exceed the boundaries of the text area.
// It needs to add as well space for the cursor if the text is in edit mode and extra space in case the text is outlined.
- tmpLineLayout.penX = -glyphMetrics.xBearing + mCursorWidth + outlineWidth;
+
+ tmpLineLayout.penX = mCursorWidth + outlineWidth;
+ if(parameters.textModel->mRemoveFrontInset)
+ {
+ tmpLineLayout.penX -= glyphMetrics.xBearing;
+ }
tmpLineLayout.relativeLineSize = lineLayout.relativeLineSize;
const float previousTmpLength = tmpLineLayout.length;
const float previousTmpWhiteSpaceLengthEndOfLine = tmpLineLayout.whiteSpaceLengthEndOfLine;
- if(isWhiteSpace)
+ // The calculated text size is used in atlas renderer.
+ // When the text is all white space, partial render issue occurs because the width is 0.
+ // To avoid issue, do not remove the white space size in hidden input mode.
+ if(isWhiteSpace && !hiddenInputEnabled)
{
// Add the length to the length of white spaces at the end of the line.
tmpLineLayout.whiteSpaceLengthEndOfLine += glyphMetrics.advance;
tmpLineLayout.penX += tmpLineLayout.previousAdvance + tmpLineLayout.whiteSpaceLengthEndOfLine;
tmpLineLayout.previousAdvance = (glyphMetrics.advance + parameters.interGlyphExtraAdvance);
- tmpLineLayout.length = std::max(tmpLineLayout.length, tmpLineLayout.penX + glyphMetrics.xBearing + glyphMetrics.width);
+ if(parameters.textModel->mRemoveBackInset)
+ {
+ tmpLineLayout.length = std::max(tmpLineLayout.length, tmpLineLayout.penX + glyphMetrics.xBearing + glyphMetrics.width);
+ }
+ else
+ {
+ tmpLineLayout.length = std::max(tmpLineLayout.length, tmpLineLayout.penX + glyphMetrics.advance);
+ }
// Clear the white space length at the end of the line.
tmpLineLayout.whiteSpaceLengthEndOfLine = 0.f;
tmpLineLayout.numberOfGlyphs -= numberOfGLyphsInGroup;
}
- if(isRemovedGlyphWhiteSpace)
+ if(isRemovedGlyphWhiteSpace && !hiddenInputEnabled)
{
tmpLineLayout.penX -= glyphMetrics.advance;
tmpLineLayout.length -= glyphMetrics.advance;
// If it has a negative x bearing, it will exceed the boundaries of the actor,
// so the penX position needs to be moved to the right.
const GlyphInfo& glyph = *(glyphsBuffer + startIndexForGlyph);
- float penX = -glyph.xBearing + mCursorWidth + outlineWidth; //
+ float penX = mCursorWidth + outlineWidth; //
+
+ if(layoutParameters.textModel->mRemoveFrontInset)
+ {
+ penX -= glyph.xBearing;
+ }
CalculateGlyphPositionsLTR(layoutParameters.textModel->mVisualModel,
layoutParameters.textModel->mLogicalModel,
* @param[in] penY The vertical layout position.
* @param[in] currentParagraphDirection The current paragraph's direction.
* @param[in,out] isAutoScrollEnabled If the isAutoScrollEnabled is true and the height of the text exceeds the boundaries of the control the text is elided and the isAutoScrollEnabled is set to false to disable the autoscroll
+ * @param[in] isHiddenInputEnabled Whether the hidden input is enabled.
* @param[in] ellipsisPosition Where is the location the text elide
*
* return Whether the line is ellipsized.
float penY,
bool& isAutoScrollEnabled,
bool isAutoScrollMaxTextureExceeded,
+ bool isHiddenInputEnabled,
DevelText::EllipsisPosition::Type ellipsisPosition,
bool enforceEllipsisInSingleLine)
{
true,
ellipsisPosition,
enforceEllipsisInSingleLine,
- true);
+ true,
+ isHiddenInputEnabled);
if(ellipsisPosition == DevelText::EllipsisPosition::START && !isMultiline)
{
{
const Vector<GlyphInfo>& glyphs = layoutParameters.textModel->mVisualModel->mGlyphs;
+ if(glyphs.Size() == 0u)
+ {
+ // Do nothing.
+ return;
+ }
+
// Need to add a new line with no characters but with height to increase the layoutSize.height
const GlyphInfo& glyphInfo = glyphs[glyphs.Count() - 1u];
bool elideTextEnabled,
bool& isAutoScrollEnabled,
bool isAutoScrollMaxTextureExceeded,
+ bool isHiddenInputEnabled,
DevelText::EllipsisPosition::Type ellipsisPosition)
{
DALI_LOG_INFO(gLogFilter, Debug::Verbose, "-->LayoutText\n");
false,
ellipsisPosition,
false,
- elideTextEnabled);
+ elideTextEnabled,
+ isHiddenInputEnabled);
DALI_LOG_INFO(gLogFilter, Debug::Verbose, " glyph index %d\n", layout.glyphIndex);
DALI_LOG_INFO(gLogFilter, Debug::Verbose, " character index %d\n", layout.characterIndex);
penY,
isAutoScrollEnabled,
isAutoScrollMaxTextureExceeded,
+ isHiddenInputEnabled,
ellipsisPosition,
false);
}
penY,
isAutoScrollEnabled,
isAutoScrollMaxTextureExceeded,
+ isHiddenInputEnabled,
ellipsisPosition,
true);
}
bool elideTextEnabled,
bool& isAutoScrollEnabled,
bool isAutoScrollMaxTextureExceeded,
+ bool isHiddenInputEnabled,
DevelText::EllipsisPosition::Type ellipsisPosition)
{
return mImpl->LayoutText(layoutParameters,
elideTextEnabled,
isAutoScrollEnabled,
isAutoScrollMaxTextureExceeded,
+ isHiddenInputEnabled,
ellipsisPosition);
}