// Set the layout parameters.
textModel->mHorizontalAlignment = Text::HorizontalAlignment::BEGIN;
textModel->mIgnoreSpacesAfterText = true;
- textModel->mMatchSystemLanguageDirection = false;
Layout::Parameters layoutParameters( textArea,
textModel );
controller->SetTextElideEnabled( true );
// Disable match system language direction
- controller->SetMatchSystemLanguageDirection(false);
+ controller->SetMatchLayoutDirection(DevelText::MatchLayoutDirection::CONTENTS);
}
void ConfigureTextField( ControllerPtr controller )
controller->SetTextElideEnabled( false );
// Disable match system language direction
- controller->SetMatchSystemLanguageDirection(false);
+ controller->SetMatchLayoutDirection(DevelText::MatchLayoutDirection::CONTENTS);
}
void ConfigureTextEditor( ControllerPtr controller )
controller->SetTextElideEnabled( false );
// Disable match system language direction
- controller->SetMatchSystemLanguageDirection(false);
+ controller->SetMatchLayoutDirection(DevelText::MatchLayoutDirection::CONTENTS);
}
} // namespace Text
textModel->mHorizontalAlignment = Text::HorizontalAlignment::BEGIN;
textModel->mLineWrapMode = LineWrap::WORD;
textModel->mIgnoreSpacesAfterText = true;
- textModel->mMatchSystemLanguageDirection = false;
Layout::Parameters layoutParameters( data.textArea,
textModel );
return true;
}
-std::vector<Dali::Graphics::UniformInfo> TestGraphicsReflection::GetSamplers() const
+const std::vector<Dali::Graphics::UniformInfo>& TestGraphicsReflection::GetSamplers() const
{
- return std::vector<Dali::Graphics::UniformInfo>{};
+ static std::vector<Dali::Graphics::UniformInfo> samplers{};
+ return samplers;
}
Graphics::ShaderLanguage TestGraphicsReflection::GetLanguage() const
public:
TestGraphicsReflection(TestGlAbstraction& gl, Property::Array& vertexFormats, const Graphics::ProgramCreateInfo& createInfo, std::vector<UniformData>& customUniforms);
- uint32_t GetVertexAttributeLocation(const std::string& name) const override;
- Dali::Graphics::VertexInputAttributeFormat GetVertexAttributeFormat(uint32_t location) const override;
- std::string GetVertexAttributeName(uint32_t location) const override;
- std::vector<uint32_t> GetVertexAttributeLocations() const override;
- uint32_t GetUniformBlockCount() const override;
- uint32_t GetUniformBlockBinding(uint32_t index) const override;
- uint32_t GetUniformBlockSize(uint32_t index) const override;
- bool GetUniformBlock(uint32_t index, Dali::Graphics::UniformBlockInfo& out) const override;
- std::vector<uint32_t> GetUniformBlockLocations() const override;
- std::string GetUniformBlockName(uint32_t blockIndex) const override;
- uint32_t GetUniformBlockMemberCount(uint32_t blockIndex) const override;
- std::string GetUniformBlockMemberName(uint32_t blockIndex, uint32_t memberLocation) const override;
- uint32_t GetUniformBlockMemberOffset(uint32_t blockIndex, uint32_t memberLocation) const override;
- bool GetNamedUniform(const std::string& name, Dali::Graphics::UniformInfo& out) const override;
- std::vector<Dali::Graphics::UniformInfo> GetSamplers() const override;
- Graphics::ShaderLanguage GetLanguage() const override;
+ uint32_t GetVertexAttributeLocation(const std::string& name) const override;
+ Dali::Graphics::VertexInputAttributeFormat GetVertexAttributeFormat(uint32_t location) const override;
+ std::string GetVertexAttributeName(uint32_t location) const override;
+ std::vector<uint32_t> GetVertexAttributeLocations() const override;
+ uint32_t GetUniformBlockCount() const override;
+ uint32_t GetUniformBlockBinding(uint32_t index) const override;
+ uint32_t GetUniformBlockSize(uint32_t index) const override;
+ bool GetUniformBlock(uint32_t index, Dali::Graphics::UniformBlockInfo& out) const override;
+ std::vector<uint32_t> GetUniformBlockLocations() const override;
+ std::string GetUniformBlockName(uint32_t blockIndex) const override;
+ uint32_t GetUniformBlockMemberCount(uint32_t blockIndex) const override;
+ std::string GetUniformBlockMemberName(uint32_t blockIndex, uint32_t memberLocation) const override;
+ uint32_t GetUniformBlockMemberOffset(uint32_t blockIndex, uint32_t memberLocation) const override;
+ bool GetNamedUniform(const std::string& name, Dali::Graphics::UniformInfo& out) const override;
+ const std::vector<Dali::Graphics::UniformInfo>& GetSamplers() const override;
+ Graphics::ShaderLanguage GetLanguage() const override;
public: // Test methods
void SetAttributes(std::vector<std::string> locations)
controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
controlProperty1.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
controlProperty1.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 50.f);
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 50.f);
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, 1.f);
control1.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty1);
Control control2 = Control::New();
controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 30.f);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 30.f);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, -1.f);
control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
application.GetScene().Add(control1);
controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
controlProperty1.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
controlProperty1.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, Vector4(50.0f, 30.0f, 40.0f, 20.0f));
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 50.f);
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, -1.f);
control1.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty1);
Control control2 = Control::New();
controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, Vector4(32.f, 54.0f, 24.0f, 42.0f));
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 30.f);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, -1.f);
control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
application.GetScene().Add(control1);
Vector4 destinationColor(1.0f, 0.5f, 1.0f, 0.8f);
float destinationOpacity(0.8f);
float destinationRadius(50.f);
+ float destinationBorderlineWidth(80.0f);
+ Vector4 destinationBorderlineColor(0.5f, 1.0f, 0.5f, 0.3f);
+ float destinationBorderlineOffset(-1.0f);
Vector4 destinationRadiusV4 = Vector4(destinationRadius, destinationRadius, destinationRadius, destinationRadius);
Control control1 = Control::New();
controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
controlProperty1.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
controlProperty1.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 30.f);
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 60.f);
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, 1.f);
control1.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty1);
Control control2 = Control::New();
controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, destinationRadius);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, destinationBorderlineWidth);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, destinationBorderlineColor);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, destinationBorderlineOffset);
control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
DALI_TEST_EQUALS(destinationPosition, control2.GetProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
Property::Map backgroundMap = control2.GetProperty<Property::Map>(Toolkit::Control::Property::BACKGROUND);
Vector4 cornerRadius = backgroundMap.Find(Toolkit::DevelVisual::Property::CORNER_RADIUS)->Get<Vector4>();
DALI_TEST_EQUALS(destinationRadiusV4, cornerRadius, TEST_LOCATION);
+ float borderlineWidth = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH)->Get<float>();
+ DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
+ Vector4 borderlineColor = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_COLOR)->Get<Vector4>();
+ DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
+ float borderlineOffset = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET)->Get<float>();
+ DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
application.GetScene().Add(control1);
application.GetScene().Add(control2);
Property::Index index = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
cornerRadius = renderer.GetCurrentProperty<Vector4>(index);
DALI_TEST_NOT_EQUALS(destinationRadiusV4, cornerRadius, 0.00001f, TEST_LOCATION);
+ index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
+ borderlineWidth = renderer.GetCurrentProperty<float>(index);
+ DALI_TEST_NOT_EQUALS(destinationBorderlineWidth, borderlineWidth, 0.00001f, TEST_LOCATION);
+ index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
+ borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
+ DALI_TEST_NOT_EQUALS(destinationBorderlineColor, borderlineColor, 0.00001f, TEST_LOCATION);
+ index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
+ borderlineOffset = renderer.GetCurrentProperty<float>(index);
+ DALI_TEST_NOT_EQUALS(destinationBorderlineOffset, borderlineOffset, 0.00001f, TEST_LOCATION);
application.SendNotification();
application.Render(700);
index = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
cornerRadius = renderer.GetCurrentProperty<Vector4>(index);
DALI_TEST_EQUALS(destinationRadiusV4, cornerRadius, TEST_LOCATION);
+ index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
+ borderlineWidth = renderer.GetCurrentProperty<float>(index);
+ DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
+ index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
+ borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
+ DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
+ index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
+ borderlineOffset = renderer.GetCurrentProperty<float>(index);
+ DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
END_TEST;
}
tet_infoline(" UtcDaliTransitionBetweenControlPair");
Vector4 destinationRadius(50.f, 30.f, 40.f, 0.f);
+ float destinationBorderlineWidth(40.f);
+ Vector4 destinationBorderlineColor(1.0f, 0.5f, 0.2f, 0.8f);
+ float destinationBorderlineOffset(1.f);
Control control1 = Control::New();
control1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, destinationRadius);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, destinationBorderlineWidth);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, destinationBorderlineColor);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, destinationBorderlineOffset);
control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
Property::Map backgroundMap = control2.GetProperty<Property::Map>(Toolkit::Control::Property::BACKGROUND);
Vector4 cornerRadius = backgroundMap.Find(Toolkit::DevelVisual::Property::CORNER_RADIUS)->Get<Vector4>();
DALI_TEST_EQUALS(destinationRadius, cornerRadius, TEST_LOCATION);
+ float borderlineWidth = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH)->Get<float>();
+ DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
+ Vector4 borderlineColor = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_COLOR)->Get<Vector4>();
+ DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
+ float borderlineOffset = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET)->Get<float>();
+ DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
application.GetScene().Add(control1);
application.GetScene().Add(control2);
backgroundMap = control2.GetProperty<Property::Map>(Toolkit::Control::Property::BACKGROUND);
cornerRadius = backgroundMap.Find(Toolkit::DevelVisual::Property::CORNER_RADIUS)->Get<Vector4>();
DALI_TEST_EQUALS(destinationRadius, cornerRadius, TEST_LOCATION);
+ borderlineWidth = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH)->Get<float>();
+ DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
+ borderlineColor = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_COLOR)->Get<Vector4>();
+ DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
+ borderlineOffset = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET)->Get<float>();
+ DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
application.SendNotification();
application.Render(700);
backgroundMap = control2.GetProperty<Property::Map>(Toolkit::Control::Property::BACKGROUND);
cornerRadius = backgroundMap.Find(Toolkit::DevelVisual::Property::CORNER_RADIUS)->Get<Vector4>();
DALI_TEST_EQUALS(destinationRadius, cornerRadius, TEST_LOCATION);
+ borderlineWidth = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH)->Get<float>();
+ DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
+ borderlineColor = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_COLOR)->Get<Vector4>();
+ DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
+ borderlineOffset = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET)->Get<float>();
+ DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
END_TEST;
}
controlProperty1.Insert(Toolkit::ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME);
controlProperty1.Insert(Toolkit::Visual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.5f, 0.5f));
controlProperty1.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 50.f);
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 50.f);
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, 1.f);
control1.SetProperty(Toolkit::ImageView::Property::IMAGE, controlProperty1);
ImageView control2 = ImageView::New();
controlProperty2.Insert(Toolkit::ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME);
controlProperty2.Insert(Toolkit::Visual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 30.f);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 30.f);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(0.0f, 1.0f, 1.0f, 0.5f));
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, -1.f);
control2.SetProperty(Toolkit::ImageView::Property::IMAGE, controlProperty2);
DALI_TEST_EQUALS(destinationPosition, control2.GetProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
controlProperty1.Insert(Toolkit::ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME);
controlProperty1.Insert(Toolkit::Visual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.5f, 0.5f));
controlProperty1.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 50.f);
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 50.f);
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, 1.f);
control1.SetProperty(Toolkit::ImageView::Property::IMAGE, controlProperty1);
ImageView control2 = ImageView::New();
controlProperty2.Insert(Toolkit::ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME);
controlProperty2.Insert(Toolkit::Visual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 30.f);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 30.f);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(0.0f, 1.0f, 1.0f, 0.5f));
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, -1.f);
control2.SetProperty(Toolkit::ImageView::Property::IMAGE, controlProperty2);
DALI_TEST_EQUALS(destinationPosition, control2.GetProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
/**
* @brief Modifies the default text alignment to match the direction of the system language.
* @details Name "matchSystemLanguageDirection", type (Property::BOOLEAN), Read/Write
- * @note The default value is false
+ * @note The default value is true
*/
MATCH_SYSTEM_LANGUAGE_DIRECTION,
/**
* @brief Modifies the default text alignment to match the direction of the system language.
* @details Name "matchSystemLanguageDirection", type (Property::BOOLEAN), Read/Write
- * @note The default value is false
+ * @note The default value is true
*/
MATCH_SYSTEM_LANGUAGE_DIRECTION = ELLIPSIS + 3,
/**
* @brief Modifies the default text alignment to match the direction of the system language.
* @details Name "matchSystemLanguageDirection", type (Property::BOLEAN), Read/Write
- * @note The default value is false
+ * @note The default value is true
*
* If MATCH_SYSTEM_LANGUAGE_DIRECTION property set true, the default text alignment to match the direction of the system language.
*
*
* | TextLabel::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION |
* |-----------------------------------------------------------------------
- * | false (default) | true |
+ * | false | true (default) |
* |-----------------------------------|----------------------------------|
* | Hello world | Hello world |
- * | ﻡﺮﺤﺑﺍ. | ﻡﺮﺤﺑﺍ. |
+ * | ﻡﺮﺤﺑﺍ. | ﻡﺮﺤﺑﺍ. |
*
*/
MATCH_SYSTEM_LANGUAGE_DIRECTION,
* - fontSize: 10pt, fontSizeScale: 1.5
*/
FONT_SIZE_SCALE,
+
};
} // namespace Property
} // namespace LineWrap
+/**
+ * A enum for defining text layout directions.
+ * It can also be inherited (from a parent) or deduced from the default language script of a locale.
+ * And it can be the direction of the text ifself.
+ */
+enum class MatchLayoutDirection
+{
+ INHERIT, // The text layout direction is inherited. If you change the layout direction, it will be aligned with the changed layout direction.
+ LOCALE, // The text layout direction is determined by the locale of the system language.
+ CONTENTS // The text layout direction is determined by the text itself.
+};
+
} // namespace DevelText
} // namespace Toolkit
// Resize the vector of positions to have the same size than the vector of glyphs.
rendererParameters.positions.Resize(numberOfGlyphs);
- textModel->mLineWrapMode = Text::LineWrap::WORD;
- textModel->mIgnoreSpacesAfterText = false;
- textModel->mMatchSystemLanguageDirection = false;
+ textModel->mLineWrapMode = Text::LineWrap::WORD;
+ textModel->mIgnoreSpacesAfterText = false;
Text::Layout::Parameters layoutParameters(internalDataModel.textLayoutArea,
textModel);
Vector4 mixColor(1.0f, 1.0f, 1.0f, 1.0f);
Vector4 cornerRadius(0.0f, 0.0f, 0.0f, 0.0f);
+ float borderlineWidth(0.0f);
+ Vector4 borderlineColor(0.0f, 0.0f, 0.0f, 1.0f);
+ float borderlineOffset(0.0f);
if(!destinationMap.Empty())
{
- static auto findValue = [](const Property::Map& map, Property::Index index) -> Vector4 {
+ static auto findValueVector4 = [](const Property::Map& map, Property::Index index, const Vector4& defaultValue = Vector4()) -> Vector4 {
Property::Value* propertyValue = map.Find(index);
if(propertyValue)
{
return propertyValue->Get<Vector4>();
}
- return Vector4{};
+ return defaultValue;
};
- mixColor = findValue(destinationMap, Dali::Toolkit::Visual::Property::MIX_COLOR);
- cornerRadius = findValue(destinationMap, Toolkit::DevelVisual::Property::CORNER_RADIUS);
+ static auto findValueFloat = [](const Property::Map& map, Property::Index index, const float& defaultValue = 0.0f) -> float {
+ Property::Value* propertyValue = map.Find(index);
+ if(propertyValue)
+ {
+ return propertyValue->Get<float>();
+ }
+ return defaultValue;
+ };
+
+ mixColor = findValueVector4(destinationMap, Dali::Toolkit::Visual::Property::MIX_COLOR, mixColor);
+ cornerRadius = findValueVector4(destinationMap, Toolkit::DevelVisual::Property::CORNER_RADIUS, cornerRadius);
+ borderlineWidth = findValueFloat(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, borderlineWidth);
+ borderlineColor = findValueVector4(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_COLOR, borderlineColor);
+ borderlineOffset = findValueFloat(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, borderlineOffset);
if(sourceMap.Empty())
{
sourceMap.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
sourceMap.Insert(Dali::Toolkit::Visual::Property::MIX_COLOR, Color::TRANSPARENT);
sourceMap.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, cornerRadius);
+ sourceMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, borderlineWidth);
+ sourceMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, borderlineColor);
+ sourceMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, borderlineOffset);
}
- Vector4 sourceMixColor = findValue(sourceMap, Dali::Toolkit::Visual::Property::MIX_COLOR);
- Vector4 sourceCornerRadius = findValue(sourceMap, Toolkit::DevelVisual::Property::CORNER_RADIUS);
+ Vector4 sourceMixColor = findValueVector4(sourceMap, Dali::Toolkit::Visual::Property::MIX_COLOR, mixColor);
+ Vector4 sourceCornerRadius = findValueVector4(sourceMap, Toolkit::DevelVisual::Property::CORNER_RADIUS, cornerRadius);
+ float sourceBorderlineWidth = findValueFloat(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, borderlineWidth);
+ Vector4 sourceBorderlineColor = findValueVector4(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_COLOR, borderlineColor);
+ float sourceBorderlineOffset = findValueFloat(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, borderlineOffset);
std::vector<Dali::Property> properties;
std::vector<std::pair<Property::Value, Property::Value>> values;
values.push_back(std::make_pair(sourceCornerRadius, cornerRadius));
}
+ if(sourceBorderlineWidth != borderlineWidth)
+ {
+ properties.push_back(GetVisualProperty(visualIndex, Dali::Toolkit::DevelVisual::Property::BORDERLINE_WIDTH));
+ values.push_back(std::make_pair(sourceBorderlineWidth, borderlineWidth));
+ }
+
+ if(sourceBorderlineColor != borderlineColor)
+ {
+ properties.push_back(GetVisualProperty(visualIndex, Dali::Toolkit::DevelVisual::Property::BORDERLINE_COLOR));
+ values.push_back(std::make_pair(sourceBorderlineColor, borderlineColor));
+ }
+
+ if(sourceBorderlineOffset != borderlineOffset)
+ {
+ properties.push_back(GetVisualProperty(visualIndex, Dali::Toolkit::DevelVisual::Property::BORDERLINE_OFFSET));
+ values.push_back(std::make_pair(sourceBorderlineOffset, borderlineOffset));
+ }
+
for(uint32_t i = 0; i < properties.size(); ++i)
{
if(timePeriod.delaySeconds > 0.0f)
destinationVisual.CreatePropertyMap(destinationMap);
- static auto findValue = [](const Property::Map& map, Property::Index index) -> Vector4 {
+ static auto findValueVector4 = [](const Property::Map& map, Property::Index index, const Vector4& defaultValue = Vector4()) -> Vector4 {
Property::Value* propertyValue = map.Find(index);
if(propertyValue)
{
return propertyValue->Get<Vector4>();
}
- return Vector4{};
+ return defaultValue;
+ };
+
+ static auto findValueFloat = [](const Property::Map& map, Property::Index index, const float& defaultValue = 0.0f) -> float {
+ Property::Value* propertyValue = map.Find(index);
+ if(propertyValue)
+ {
+ return propertyValue->Get<float>();
+ }
+ return defaultValue;
};
Vector4 sourceMixColor(0.0f, 0.0f, 0.0f, 0.0f);
Vector4 sourceCornerRadius(0.0f, 0.0f, 0.0f, 0.0f);
- Vector4 destinationMixColor = findValue(destinationMap, Dali::Toolkit::Visual::Property::MIX_COLOR);
- Vector4 destinationCornerRadius = findValue(destinationMap, Toolkit::DevelVisual::Property::CORNER_RADIUS);
+ float sourceBorderlineWidth(0.0f);
+ Vector4 sourceBorderlineColor(0.0f, 0.0f, 0.0f, 1.0f);
+ float sourceBorderlineOffset(0.0f);
+ Vector4 destinationMixColor = findValueVector4(destinationMap, Dali::Toolkit::Visual::Property::MIX_COLOR, sourceMixColor);
+ Vector4 destinationCornerRadius = findValueVector4(destinationMap, Toolkit::DevelVisual::Property::CORNER_RADIUS, sourceCornerRadius);
+ float destinationBorderlineWidth = findValueFloat(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, sourceBorderlineWidth);
+ Vector4 destinationBorderlineColor = findValueVector4(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_COLOR, sourceBorderlineColor);
+ float destinationBorderlineOffset = findValueFloat(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, sourceBorderlineOffset);
Dali::Toolkit::ImageView sourceHandle = Dali::Toolkit::ImageView::DownCast(source);
Toolkit::Visual::Base sourceVisual;
if(sourceVisual)
{
sourceVisual.CreatePropertyMap(sourceMap);
- sourceMixColor = findValue(sourceMap, Dali::Toolkit::Visual::Property::MIX_COLOR);
- sourceCornerRadius = findValue(sourceMap, Toolkit::DevelVisual::Property::CORNER_RADIUS);
+ sourceMixColor = findValueVector4(sourceMap, Dali::Toolkit::Visual::Property::MIX_COLOR, sourceMixColor);
+ sourceCornerRadius = findValueVector4(sourceMap, Toolkit::DevelVisual::Property::CORNER_RADIUS, sourceCornerRadius);
+ sourceBorderlineWidth = findValueFloat(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, sourceBorderlineWidth);
+ sourceBorderlineColor = findValueVector4(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_COLOR, sourceBorderlineColor);
+ sourceBorderlineOffset = findValueFloat(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, sourceBorderlineOffset);
}
std::vector<Dali::Property> properties;
properties.push_back(DevelControl::GetVisualProperty(destinationHandle, Toolkit::ImageView::Property::IMAGE, Toolkit::DevelVisual::Property::CORNER_RADIUS));
values.push_back(std::make_pair(sourceCornerRadius, destinationCornerRadius));
}
+ if(sourceBorderlineWidth != destinationBorderlineWidth)
+ {
+ properties.push_back(DevelControl::GetVisualProperty(destinationHandle, Toolkit::ImageView::Property::IMAGE, Toolkit::DevelVisual::Property::BORDERLINE_WIDTH));
+ values.push_back(std::make_pair(sourceBorderlineWidth, destinationBorderlineWidth));
+ }
+ if(sourceBorderlineColor != destinationBorderlineColor)
+ {
+ properties.push_back(DevelControl::GetVisualProperty(destinationHandle, Toolkit::ImageView::Property::IMAGE, Toolkit::DevelVisual::Property::BORDERLINE_COLOR));
+ values.push_back(std::make_pair(sourceBorderlineColor, destinationBorderlineColor));
+ }
+ if(sourceBorderlineOffset != destinationBorderlineOffset)
+ {
+ properties.push_back(DevelControl::GetVisualProperty(destinationHandle, Toolkit::ImageView::Property::IMAGE, Toolkit::DevelVisual::Property::BORDERLINE_OFFSET));
+ values.push_back(std::make_pair(sourceBorderlineOffset, destinationBorderlineOffset));
+ }
for(uint32_t i = 0; i < properties.size(); ++i)
{
// EXTERNAL INCLUDES
#include <dali/devel-api/actors/actor-devel.h>
-#include <dali/devel-api/adaptor-framework/window-devel.h>
#include <dali/devel-api/common/stage.h>
#include <dali/devel-api/object/property-helper-devel.h>
#include <dali/integration-api/adaptor-framework/adaptor.h>
}
case Toolkit::DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION:
{
- impl.mController->SetMatchSystemLanguageDirection(value.Get<bool>());
+ impl.mController->SetMatchLayoutDirection(value.Get<bool>() ? DevelText::MatchLayoutDirection::LOCALE : DevelText::MatchLayoutDirection::CONTENTS);
break;
}
case Toolkit::DevelTextEditor::Property::MAX_LENGTH:
}
case Toolkit::DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION:
{
- value = impl.mController->IsMatchSystemLanguageDirection();
+ value = impl.mController->GetMatchLayoutDirection() != DevelText::MatchLayoutDirection::CONTENTS;
break;
}
case Toolkit::DevelTextEditor::Property::MAX_LENGTH:
Dali::LayoutDirection::Type layoutDirection = static_cast<Dali::LayoutDirection::Type>(stage.GetRootLayer().GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get<int>());
mController->SetLayoutDirection(layoutDirection);
+ self.LayoutDirectionChangedSignal().Connect(this, &TextEditor::OnLayoutDirectionChanged);
+
// Forward input events to controller
EnableGestureDetection(static_cast<GestureType::Value>(GestureType::TAP | GestureType::PAN | GestureType::LONG_PRESS));
GetTapGestureDetector().SetMaximumTapsRequired(2);
Vector2 contentSize(size.x - (padding.start + padding.end), size.y - (padding.top + padding.bottom));
// Support Right-To-Left of padding
- Dali::LayoutDirection::Type layoutDirection;
- if(mController->IsMatchSystemLanguageDirection())
- {
- layoutDirection = static_cast<Dali::LayoutDirection::Type>(DevelWindow::Get(self).GetRootLayer().GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get<int>());
- }
- else
- {
- layoutDirection = static_cast<Dali::LayoutDirection::Type>(self.GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get<int>());
- }
+ Dali::LayoutDirection::Type layoutDirection = mController->GetLayoutDirection(self);
+
if(Dali::LayoutDirection::RIGHT_TO_LEFT == layoutDirection)
{
std::swap(padding.start, padding.end);
}
}
+void TextEditor::OnLayoutDirectionChanged(Actor actor, LayoutDirection::Type type)
+{
+ mController->ChangedLayoutDirection();
+}
+
TextEditor::TextEditor()
: Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT)),
mAnimationPeriod(0.0f, 0.0f),
void OnScrollIndicatorAnimationFinished(Animation& animation);
/**
+ * @brief Callback function for when the layout is changed.
+ * @param[in] actor The actor whose layoutDirection is changed.
+ * @param[in] type The layoutDirection.
+ */
+ void OnLayoutDirectionChanged(Actor actor, LayoutDirection::Type type);
+
+ /**
* Construct a new TextEditor.
*/
TextEditor();
// EXTERNAL INCLUDES
#include <dali/devel-api/actors/actor-devel.h>
#include <dali/devel-api/adaptor-framework/key-devel.h>
-#include <dali/devel-api/adaptor-framework/window-devel.h>
#include <dali/devel-api/common/stage.h>
#include <dali/devel-api/object/property-helper-devel.h>
#include <dali/integration-api/debug.h>
}
case Toolkit::DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION:
{
- impl.mController->SetMatchSystemLanguageDirection(value.Get<bool>());
+ impl.mController->SetMatchLayoutDirection(value.Get<bool>() ? DevelText::MatchLayoutDirection::LOCALE : DevelText::MatchLayoutDirection::CONTENTS);
break;
}
case Toolkit::DevelTextField::Property::ENABLE_GRAB_HANDLE_POPUP:
}
case Toolkit::DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION:
{
- value = impl.mController->IsMatchSystemLanguageDirection();
+ value = impl.mController->GetMatchLayoutDirection() != DevelText::MatchLayoutDirection::CONTENTS;
break;
}
case Toolkit::DevelTextField::Property::ENABLE_GRAB_HANDLE_POPUP:
Dali::LayoutDirection::Type layoutDirection = static_cast<Dali::LayoutDirection::Type>(stage.GetRootLayer().GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get<int>());
mController->SetLayoutDirection(layoutDirection);
+ self.LayoutDirectionChangedSignal().Connect(this, &TextField::OnLayoutDirectionChanged);
+
// Forward input events to controller
EnableGestureDetection(static_cast<GestureType::Value>(GestureType::TAP | GestureType::PAN | GestureType::LONG_PRESS));
GetTapGestureDetector().SetMaximumTapsRequired(2);
Vector2 contentSize(size.x - (padding.start + padding.end), size.y - (padding.top + padding.bottom));
// Support Right-To-Left of padding
- Dali::LayoutDirection::Type layoutDirection;
- if(mController->IsMatchSystemLanguageDirection())
- {
- layoutDirection = static_cast<Dali::LayoutDirection::Type>(DevelWindow::Get(self).GetRootLayer().GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get<int>());
- }
- else
- {
- layoutDirection = static_cast<Dali::LayoutDirection::Type>(self.GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get<int>());
- }
+ Dali::LayoutDirection::Type layoutDirection = mController->GetLayoutDirection(self);
+
if(Dali::LayoutDirection::RIGHT_TO_LEFT == layoutDirection)
{
std::swap(padding.start, padding.end);
return false;
}
+void TextField::OnLayoutDirectionChanged(Actor actor, LayoutDirection::Type type)
+{
+ mController->ChangedLayoutDirection();
+}
+
void TextField::OnIdleSignal()
{
// Emits the change of input style signals.
void EmitTextChangedSignal();
/**
+ * @brief Callback function for when the layout is changed.
+ * @param[in] actor The actor whose layoutDirection is changed.
+ * @param[in] type The layoutDirection.
+ */
+ void OnLayoutDirectionChanged(Actor actor, LayoutDirection::Type type);
+
+ /**
* Construct a new TextField.
*/
TextField();
// EXTERNAL INCLUDES
#include <dali/devel-api/actors/actor-devel.h>
#include <dali/devel-api/adaptor-framework/image-loading.h>
-#include <dali/devel-api/adaptor-framework/window-devel.h>
#include <dali/devel-api/common/stage.h>
#include <dali/devel-api/object/property-helper-devel.h>
#include <dali/integration-api/debug.h>
}
case Toolkit::DevelTextLabel::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION:
{
- impl.mController->SetMatchSystemLanguageDirection(value.Get<bool>());
+ impl.mController->SetMatchLayoutDirection(value.Get<bool>() ? DevelText::MatchLayoutDirection::LOCALE : DevelText::MatchLayoutDirection::CONTENTS);
break;
}
case Toolkit::DevelTextLabel::Property::TEXT_FIT:
}
case Toolkit::DevelTextLabel::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION:
{
- value = impl.mController->IsMatchSystemLanguageDirection();
+ value = impl.mController->GetMatchLayoutDirection() != DevelText::MatchLayoutDirection::CONTENTS;
break;
}
case Toolkit::DevelTextLabel::Property::TEXT_FIT:
Dali::LayoutDirection::Type layoutDirection = static_cast<Dali::LayoutDirection::Type>(stage.GetRootLayer().GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get<int>());
mController->SetLayoutDirection(layoutDirection);
+ self.LayoutDirectionChangedSignal().Connect(this, &TextLabel::OnLayoutDirectionChanged);
+
// Forward input events to controller
EnableGestureDetection(static_cast<GestureType::Value>(GestureType::TAP));
GetTapGestureDetector().SetMaximumTapsRequired(1);
{
DALI_LOG_INFO(gLogFilter, Debug::General, "TextLabel::OnRelayout\n");
+ Actor self = Self();
+
Extents padding;
- padding = Self().GetProperty<Extents>(Toolkit::Control::Property::PADDING);
+ padding = self.GetProperty<Extents>(Toolkit::Control::Property::PADDING);
Vector2 contentSize(size.x - (padding.start + padding.end), size.y - (padding.top + padding.bottom));
}
// Support Right-To-Left
- Dali::LayoutDirection::Type layoutDirection;
- if(mController->IsMatchSystemLanguageDirection())
- {
- layoutDirection = static_cast<Dali::LayoutDirection::Type>(DevelWindow::Get(Self()).GetRootLayer().GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get<int>());
- }
- else
- {
- layoutDirection = static_cast<Dali::LayoutDirection::Type>(Self().GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get<int>());
- }
+ Dali::LayoutDirection::Type layoutDirection = mController->GetLayoutDirection(self);
+
const Text::Controller::UpdateTextType updateTextType = mController->Relayout(contentSize, layoutDirection);
if((Text::Controller::NONE_UPDATED != (Text::Controller::MODEL_UPDATED & updateTextType)) || mTextUpdateNeeded)
RequestTextRelayout();
}
+void TextLabel::OnLayoutDirectionChanged(Actor actor, LayoutDirection::Type type)
+{
+ mController->ChangedLayoutDirection();
+}
+
TextLabel::TextLabel()
: Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT)),
mRenderingBackend(DEFAULT_RENDERING_BACKEND),
return mTextScroller;
}
+ /**
+ * @brief Callback function for when the layout is changed.
+ * @param[in] actor The actor whose layoutDirection is changed.
+ * @param[in] type The layoutDirection.
+ */
+ void OnLayoutDirectionChanged(Actor actor, LayoutDirection::Type type);
+
private: // Data
Text::ControllerPtr mController;
Text::TextScrollerPtr mTextScroller;
textureColor = mix(textureColor, vec4(borderlineColor.xyz, 0.0), smoothstep(MinTexturelinePotential, MaxTexturelinePotential, potential));
}
borderlineOpacity *= borderlineColor.a;
+ return mix(textureColor, vec4(borderlineColor.xyz, 1.0), borderlineOpacity);
}
- return mix(textureColor, vec4(borderlineColor.xyz, 1.0), borderlineOpacity);
+ return mix(textureColor, borderlineColor, borderlineOpacity);
}
#endif
void main()
{
- lowp vec4 targetColor = vec4(mixColor, 1.0) * uColor;
+ lowp vec4 targetColor = vec4(mixColor, 1.0);
#if IS_REQUIRED_BLUR || IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
// skip most potential calculate for performance
if(abs(vPosition.x) < vOptRectSize.x && abs(vPosition.y) < vOptRectSize.y)
{
- OUT_COLOR = targetColor;
+ OUT_COLOR = targetColor * uColor;
return;
}
PreprocessPotential();
#if !IS_REQUIRED_BLUR && IS_REQUIRED_BORDERLINE
targetColor = convertBorderlineColor(targetColor);
#endif
- OUT_COLOR = targetColor;
+ OUT_COLOR = targetColor * uColor;
#if IS_REQUIRED_BLUR
mediump float opacity = calculateBlurOpacity();
textureColor = mix(textureColor, vec4(borderlineColor.xyz, 0.0), smoothstep(MinTexturelinePotential, MaxTexturelinePotential, potential));
}
borderlineOpacity *= borderlineColor.a;
+ return mix(textureColor, vec4(borderlineColor.xyz, 1.0), borderlineOpacity);
}
- return mix(textureColor, vec4(borderlineColor.xyz, 1.0), borderlineOpacity);
+ return mix(textureColor, borderlineColor, borderlineOpacity);
}
#endif
void main()
{
#if RADIAL
- lowp vec4 textureColor = TEXTURE(sTexture, vec2(length(vTexCoord), 0.5)) * vec4(mixColor, 1.0) * uColor;
+ lowp vec4 textureColor = TEXTURE(sTexture, vec2(length(vTexCoord), 0.5)) * vec4(mixColor, 1.0);
#else
- lowp vec4 textureColor = TEXTURE(sTexture, vec2(vTexCoord.y, 0.5)) * vec4(mixColor, 1.0) * uColor;
+ lowp vec4 textureColor = TEXTURE(sTexture, vec2(vTexCoord.y, 0.5)) * vec4(mixColor, 1.0);
#endif
#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
// skip most potential calculate for performance
if(abs(vPosition.x) < vOptRectSize.x && abs(vPosition.y) < vOptRectSize.y)
{
- OUT_COLOR = textureColor;
+ OUT_COLOR = textureColor * uColor;
return;
}
PreprocessPotential();
#if IS_REQUIRED_BORDERLINE
textureColor = convertBorderlineColor(textureColor);
#endif
- OUT_COLOR = textureColor;
+ OUT_COLOR = textureColor * uColor;
#if IS_REQUIRED_ROUNDED_CORNER
mediump float opacity = calculateCornerOpacity();
mediump float tCornerRadius = -gCenterPosition;
mediump float MaxTexturelinePotential = tCornerRadius + gPotentialRange;
mediump float MinTexturelinePotential = tCornerRadius - gPotentialRange;
+ lowp vec3 BorderlineColorRGB = borderlineColor.xyz;
+ BorderlineColorRGB *= mix(1.0, borderlineColor.a, preMultipliedAlpha);
if(potential > MaxTexturelinePotential)
{
// potential is out of texture range. use borderline color instead of texture
- textureColor = vec4(borderlineColor.xyz, 0.0);
+ textureColor = vec4(BorderlineColorRGB, 0.0);
}
else if(potential > MinTexturelinePotential)
{
// potential is in texture range
- textureColor = mix(textureColor, vec4(borderlineColor.xyz, 0.0), smoothstep(MinTexturelinePotential, MaxTexturelinePotential, potential));
+ textureColor = mix(textureColor, vec4(BorderlineColorRGB, 0.0), smoothstep(MinTexturelinePotential, MaxTexturelinePotential, potential));
}
borderlineOpacity *= borderlineColor.a;
+ return mix(textureColor, vec4(BorderlineColorRGB, 1.0), borderlineOpacity);
}
- return mix(textureColor, vec4(borderlineColor.xyz, 1.0), borderlineOpacity);
+ return mix(textureColor, borderlineColor, borderlineOpacity);
}
#endif
mediump vec2 texCoord = vTexCoord;
#endif
- lowp vec4 textureColor = TEXTURE( sTexture, texCoord ) * uColor * vec4( mixColor, 1.0 );
+ lowp vec4 textureColor = TEXTURE( sTexture, texCoord ) * vec4( mixColor, 1.0 );
#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
// skip most potential calculate for performance
if(abs(vPosition.x) < vOptRectSize.x && abs(vPosition.y) < vOptRectSize.y)
{
- OUT_COLOR = textureColor;
+ OUT_COLOR = textureColor * uColor;
return;
}
PreprocessPotential();
#if IS_REQUIRED_BORDERLINE
textureColor = convertBorderlineColor(textureColor);
#endif
- OUT_COLOR = textureColor;
+ OUT_COLOR = textureColor * uColor;
#if IS_REQUIRED_ROUNDED_CORNER
mediump float opacity = calculateCornerOpacity();
CharacterIndex startIndex,
Length numberOfCharacters,
Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
- bool matchSystemLanguageDirection,
+ bool matchLayoutDirection,
Dali::LayoutDirection::Type layoutDirection)
{
// Find where to insert the new paragraphs.
// Create the bidirectional info for the whole paragraph and store the index to the table with this info in the run.
bidirectionalRun.bidirectionalInfoIndex = bidirectionalSupport.CreateInfo(textBuffer + bidirectionalRun.characterRun.characterIndex,
bidirectionalRun.characterRun.numberOfCharacters,
- matchSystemLanguageDirection,
+ matchLayoutDirection,
layoutDirection);
bidirectionalRun.direction = bidirectionalSupport.GetParagraphDirection(bidirectionalRun.bidirectionalInfoIndex);
* @param[in] startIndex The character from where the bidirectional info is set.
* @param[in] numberOfCharacters The number of characters.
* @param[out] bidirectionalInfo Vector with the bidirectional infor for each paragraph.
- * @param[in] matchSystemLanguageDirection Whether match for system language direction or not.
- * @param[in] layoutDirection The direction of the system language.
+ * @param[in] matchLayoutDirection Whether match for layout direction or not.
+ * @param[in] layoutDirection The direction of the layout.
*/
void SetBidirectionalInfo(const Vector<Character>& text,
const Vector<ScriptRun>& scripts,
CharacterIndex startIndex,
Length numberOfCharacters,
Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
- bool matchSystemLanguageDirection = false,
- Dali::LayoutDirection::Type layoutDirection = LayoutDirection::LEFT_TO_RIGHT);
+ bool matchLayoutDirection = false,
+ Dali::LayoutDirection::Type layoutDirection = LayoutDirection::LEFT_TO_RIGHT);
/**
* @brief Sets the visual to logical map table for a given line.
Vector<LineRun>& lines,
float& alignmentOffset,
Dali::LayoutDirection::Type layoutDirection,
- bool matchSystemLanguageDirection)
+ bool matchLayoutDirection)
{
const CharacterIndex lastCharacterPlusOne = startIndex + numberOfCharacters;
horizontalAlignment,
line,
layoutDirection,
- matchSystemLanguageDirection);
+ matchLayoutDirection);
// Updates the alignment offset.
alignmentOffset = std::min(alignmentOffset, line.alignmentOffset);
HorizontalAlignment::Type horizontalAlignment,
LineRun& line,
Dali::LayoutDirection::Type layoutDirection,
- bool matchSystemLanguageDirection)
+ bool matchLayoutDirection)
{
line.alignmentOffset = 0.f;
const bool isLineRTL = RTL == line.direction;
float lineLength = line.width;
// match align for system language direction
- if(matchSystemLanguageDirection)
+ if(matchLayoutDirection)
{
// Swap the alignment type if the line is right to left.
isLayoutRTL = layoutDirection == LayoutDirection::RIGHT_TO_LEFT;
Vector<LineRun>& lines,
float& alignmentOffset,
Dali::LayoutDirection::Type layoutDirection,
- bool matchSystemLanguageDirection)
+ bool matchLayoutDirection)
{
mImpl->Align(size,
startIndex,
lines,
alignmentOffset,
layoutDirection,
- matchSystemLanguageDirection);
+ matchLayoutDirection);
}
void Engine::SetDefaultLineSpacing(float lineSpacing)
* @param[in] horizontalAlignment The horizontal alignment.
* @param[in,out] lines The laid-out lines.
* @param[out] alignmentOffset The alignment offset.
- * @param[in] layoutDirection The direction of the system language.
- * @param[in] matchSystemLanguageDirection Whether match align for system language direction or not.
+ * @param[in] layoutDirection The direction of the layout.
+ * @param[in] matchLayoutDirection Whether match align for layout direction or not.
*/
void Align(const Size& size,
CharacterIndex startIndex,
Vector<LineRun>& lines,
float& alignmentOffset,
Dali::LayoutDirection::Type layoutDirection,
- bool matchSystemLanguageDirection);
+ bool matchLayoutDirection);
/**
* @brief Sets the default line spacing.
return mModel;
}
+Devel::PixelBuffer Typesetter::CreateImageBuffer(const unsigned int bufferWidth, const unsigned int bufferHeight, Pixel::Format pixelFormat)
+{
+ Devel::PixelBuffer imageBuffer = Devel::PixelBuffer::New(bufferWidth, bufferHeight, pixelFormat);
+
+ if(Pixel::RGBA8888 == pixelFormat)
+ {
+ const unsigned int bufferSizeInt = bufferWidth * bufferHeight;
+ const unsigned int bufferSizeChar = 4u * bufferSizeInt;
+ memset(imageBuffer.GetBuffer(), 0u, bufferSizeChar);
+ }
+ else
+ {
+ memset(imageBuffer.GetBuffer(), 0, bufferWidth * bufferHeight);
+ }
+
+ return imageBuffer;
+}
+
PixelData Typesetter::Render(const Vector2& size, Toolkit::DevelText::TextDirection::Type textDirection, RenderBehaviour behaviour, bool ignoreHorizontalAlignment, Pixel::Format pixelFormat)
{
// @todo. This initial implementation for a TextLabel has only one visible page.
}
else
{
- backgroundImageBuffer = Devel::PixelBuffer::New(bufferWidth, bufferHeight, pixelFormat);
+ backgroundImageBuffer = CreateImageBuffer(bufferWidth, bufferHeight, pixelFormat);
}
if(backgroundMarkupSet)
glyphData.verticalOffset = verticalOffset;
glyphData.width = bufferWidth;
glyphData.height = bufferHeight;
- glyphData.bitmapBuffer = Devel::PixelBuffer::New(bufferWidth, bufferHeight, pixelFormat);
+ glyphData.bitmapBuffer = CreateImageBuffer(bufferWidth, bufferHeight, pixelFormat);
glyphData.horizontalOffset = 0;
- if(Pixel::RGBA8888 == pixelFormat)
- {
- const unsigned int bufferSizeInt = bufferWidth * bufferHeight;
- const unsigned int bufferSizeChar = 4u * bufferSizeInt;
- memset(glyphData.bitmapBuffer.GetBuffer(), 0u, bufferSizeChar);
- }
- else
- {
- memset(glyphData.bitmapBuffer.GetBuffer(), 0, bufferWidth * bufferHeight);
- }
-
// Get a handle of the font client. Used to retrieve the bitmaps of the glyphs.
TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
Length hyphenIndex = 0;
Typesetter& operator=(const Typesetter& handle);
/**
- * @brief Create the image buffer for the given range of the glyphs in the given style.
+ * @brief Create & draw the image buffer for the given range of the glyphs in the given style.
*
* Does the following operations:
* - Retrieves the data buffers from the text model.
Devel::PixelBuffer CreateImageBuffer(const unsigned int bufferWidth, const unsigned int bufferHeight, Typesetter::Style style, bool ignoreHorizontalAlignment, Pixel::Format pixelFormat, int horizontalOffset, int verticalOffset, TextAbstraction::GlyphIndex fromGlyphIndex, TextAbstraction::GlyphIndex toGlyphIndex);
/**
+ * @brief Create an initialized image buffer.
+ *
+ * Creates the pixel data used to generate the final image with the given size.
+ *
+ * @param[in] bufferWidth The width of the image buffer.
+ * @param[in] bufferHeight The height of the image buffer.
+ * @param[in] pixelFormat The format of the pixel in the image that the text is rendered as (i.e. either Pixel::BGRA8888 or Pixel::L8).
+ *
+ * @return An image buffer.
+ */
+ Devel::PixelBuffer CreateImageBuffer(const unsigned int bufferWidth, const unsigned int bufferHeight, Pixel::Format pixelFormat);
+
+ /**
* @brief Combine the two RGBA image buffers together.
*
* The top layer buffer will blend over the bottom layer buffer:
startIndex,
requestedNumberOfCharacters,
bidirectionalInfo,
- mModel->mMatchSystemLanguageDirection,
+ (mModel->mMatchLayoutDirection != DevelText::MatchLayoutDirection::CONTENTS),
mLayoutDirection);
if(0u != bidirectionalInfo.Count())
cursorInfo.primaryCursorHeight = cursorInfo.lineHeight;
bool isRTL = false;
- if(mModel->mMatchSystemLanguageDirection)
+ if(mModel->mMatchLayoutDirection != DevelText::MatchLayoutDirection::CONTENTS)
{
isRTL = mLayoutDirection == LayoutDirection::RIGHT_TO_LEFT;
}
// Get the background color of the character.
// The color index zero is reserved for the default background color (i.e. Color::TRANSPARENT)
- const ColorIndex backgroundColorIndex = (nullptr == backgroundColorsBuffer) ? 0u : *(backgroundColorIndicesBuffer + i);
- const Vector4& backgroundColor = (0u == backgroundColorIndex) ? defaultBackgroundColor : *(backgroundColorsBuffer + backgroundColorIndex - 1u);
+ const bool isMarkupBackground = mView.IsMarkupBackgroundColorSet();
+ const ColorIndex backgroundColorIndex = isMarkupBackground ? *(backgroundColorIndicesBuffer + i) : 0u;
+ const bool isDefaultBackgroundColor = (0u == backgroundColorIndex);
+ const Vector4& backgroundColor = isDefaultBackgroundColor ? defaultBackgroundColor : *(backgroundColorsBuffer + backgroundColorIndex - 1u);
mModel->mVisualModel->GetNumberOfLines(i, 1, lineIndex, numberOfLines);
Length lineHeight = lineRun[lineIndex].ascender + -(lineRun[lineIndex].descender) + lineRun[lineIndex].lineSpacing;
mTextFitMaxSize(DEFAULT_TEXTFIT_MAX),
mTextFitStepSize(DEFAULT_TEXTFIT_STEP),
mTextFitEnabled(false),
- mFontSizeScale(DEFAULT_FONT_SIZE_SCALE)
+ mFontSizeScale(DEFAULT_FONT_SIZE_SCALE),
+ mIsLayoutDirectionChanged(false)
{
mModel = Model::New();
Shader mShaderBackground; ///< The shader for text background.
- float mTextFitMinSize; ///< Minimum Font Size for text fit. Default 10
- float mTextFitMaxSize; ///< Maximum Font Size for text fit. Default 100
- float mTextFitStepSize; ///< Step Size for font intervalse. Default 1
- bool mTextFitEnabled : 1; ///< Whether the text's fit is enabled.
- float mFontSizeScale; ///< Scale value for Font Size. Default 1.0
+ float mTextFitMinSize; ///< Minimum Font Size for text fit. Default 10
+ float mTextFitMaxSize; ///< Maximum Font Size for text fit. Default 100
+ float mTextFitStepSize; ///< Step Size for font intervalse. Default 1
+ bool mTextFitEnabled : 1; ///< Whether the text's fit is enabled.
+ float mFontSizeScale; ///< Scale value for Font Size. Default 1.0
+ bool mIsLayoutDirectionChanged : 1; ///< Whether the layout has changed.
private:
friend ControllerImplEventHandler;
textUpdateInfo.mCharacterIndex = 0u;
}
- if(model->mMatchSystemLanguageDirection && impl.mLayoutDirection != layoutDirection)
+ if(impl.mLayoutDirection != layoutDirection)
{
// Clear the update info. This info will be set the next time the text is updated.
textUpdateInfo.mClearAll = true;
GET_GLYPH_METRICS |
SHAPE_TEXT |
UPDATE_DIRECTION |
+ ALIGN |
LAYOUT |
BIDI_INFO |
REORDER);
lines,
impl.mModel->mAlignmentOffset,
impl.mLayoutDirection,
- impl.mModel->mMatchSystemLanguageDirection);
+ (impl.mModel->mMatchLayoutDirection != DevelText::MatchLayoutDirection::CONTENTS));
viewUpdated = true;
}
#include <dali-toolkit/internal/text/text-controller.h>
// EXTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
+#include <dali/devel-api/adaptor-framework/window-devel.h>
#include <dali/integration-api/debug.h>
#include <memory.h>
#include <cmath>
mImpl->mModel->mIgnoreSpacesAfterText = ignore;
}
-bool Controller::IsMatchSystemLanguageDirection() const
+void Controller::ChangedLayoutDirection()
{
- return mImpl->mModel->mMatchSystemLanguageDirection;
+ mImpl->mIsLayoutDirectionChanged = true;
}
-void Controller::SetMatchSystemLanguageDirection(bool match)
+void Controller::SetMatchLayoutDirection(DevelText::MatchLayoutDirection type)
{
- mImpl->mModel->mMatchSystemLanguageDirection = match;
+ mImpl->mModel->mMatchLayoutDirection = type;
+}
+
+DevelText::MatchLayoutDirection Controller::GetMatchLayoutDirection() const
+{
+ return mImpl->mModel->mMatchLayoutDirection;
}
void Controller::SetLayoutDirection(Dali::LayoutDirection::Type layoutDirection)
mImpl->mLayoutDirection = layoutDirection;
}
+Dali::LayoutDirection::Type Controller::GetLayoutDirection(Dali::Actor& actor) const
+{
+ if(mImpl->mModel->mMatchLayoutDirection == DevelText::MatchLayoutDirection::LOCALE ||
+ (mImpl->mModel->mMatchLayoutDirection == DevelText::MatchLayoutDirection::INHERIT && !mImpl->mIsLayoutDirectionChanged))
+ {
+ return static_cast<Dali::LayoutDirection::Type>(DevelWindow::Get(actor).GetRootLayer().GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get<int>());
+ }
+ else
+ {
+ return static_cast<Dali::LayoutDirection::Type>(actor.GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get<int>());
+ }
+}
+
bool Controller::IsShowingRealText() const
{
return mImpl->IsShowingRealText();
void SetIgnoreSpacesAfterText(bool ignore);
/**
- * @brief Retrieves matchSystemLanguageDirection value from model
- * @return The value of matchSystemLanguageDirection
+ * @brief Sets SetMatchLayoutDirection value to model
+ * @param[in] match The value of matchLayoutDirection for the text
*/
- bool IsMatchSystemLanguageDirection() const;
+ void SetMatchLayoutDirection(DevelText::MatchLayoutDirection type);
/**
- * @brief Sets matchSystemLanguageDirection value to model
- * @param[in] match The value of matchSystemLanguageDirection for the text
+ * @brief Retrieves matchLayoutDirection value from model
+ * @return The value of matchLayoutDirection
*/
- void SetMatchSystemLanguageDirection(bool match);
+ DevelText::MatchLayoutDirection GetMatchLayoutDirection() const;
/**
- * @brief Sets layoutDirection value
- * @param[in] layoutDirection The value of system language direction
+ * @brief Sets layoutDirection type value.
+ * @param[in] layoutDirection The value of the layout direction type.
*/
void SetLayoutDirection(Dali::LayoutDirection::Type layoutDirection);
/**
+ * @brief Gets layoutDirection type value.
+ * @param[in] actor The actor which will get the layout direction type.
+ * @return The value of the layout direction type.
+ */
+ Dali::LayoutDirection::Type GetLayoutDirection(Dali::Actor& actor) const;
+
+ /**
+ * @brief Sets the layout direction changed.
+ */
+ void ChangedLayoutDirection();
+
+ /**
* @brief Retrieves if showing real text or not.
* @return The value of showing real text.
*/
bool const Model::IsMarkupBackgroundColorSet() const
{
- return (mVisualModel->mBackgroundColorIndices.Count() > 0);
+ return (mVisualModel->mBackgroundColors.Count() > 0);
}
const Vector4& Model::GetDefaultColor() const
mAlignmentOffset(0.0f),
mElideEnabled(false),
mIgnoreSpacesAfterText(true),
- mMatchSystemLanguageDirection(true)
+ mMatchLayoutDirection(DevelText::MatchLayoutDirection::INHERIT)
{
mLogicalModel = LogicalModel::New();
mVisualModel = VisualModel::New();
// Check environment variable for DALI_MATCH_SYSTEM_LANGUAGE_DIRECTION
- auto match = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_MATCH_SYSTEM_LANGUAGE_DIRECTION);
- mMatchSystemLanguageDirection = match ? (std::atoi(match) == 0 ? false : true) : mMatchSystemLanguageDirection;
+ auto match = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_MATCH_SYSTEM_LANGUAGE_DIRECTION);
+ if(match && (std::atoi(match) == 0))
+ {
+ mMatchLayoutDirection = DevelText::MatchLayoutDirection::CONTENTS;
+ }
}
Model::~Model()
* 0,0 means that the top-left corner of the layout matches the top-left corner of the UI control.
* Typically this will have a negative value with scrolling occurs.
*/
- Vector2 mScrollPosition; ///< The text is offset by this position when scrolling.
- Vector2 mScrollPositionLast; ///< The last offset value of mScrollPosition
- HorizontalAlignment::Type mHorizontalAlignment; ///< The layout's horizontal alignment.
- VerticalAlignment::Type mVerticalAlignment; ///< The layout's vertical alignment.
- DevelText::VerticalLineAlignment::Type mVerticalLineAlignment; ///< The layout's vertical line alignment.
- Text::LineWrap::Mode mLineWrapMode; ///< The text wrap mode
- float mAlignmentOffset; ///< The alignment offset.
- bool mElideEnabled : 1; ///< Whether the text's elide is enabled.
- bool mIgnoreSpacesAfterText : 1; ///< Whether ignoring spaces after text or not. Default is true.
- bool mMatchSystemLanguageDirection : 1; ///< Whether match align for system language direction or not. Default is false.
+ Vector2 mScrollPosition; ///< The text is offset by this position when scrolling.
+ Vector2 mScrollPositionLast; ///< The last offset value of mScrollPosition
+ HorizontalAlignment::Type mHorizontalAlignment; ///< The layout's horizontal alignment.
+ VerticalAlignment::Type mVerticalAlignment; ///< The layout's vertical alignment.
+ DevelText::VerticalLineAlignment::Type mVerticalLineAlignment; ///< The layout's vertical line alignment.
+ Text::LineWrap::Mode mLineWrapMode; ///< The text wrap mode
+ float mAlignmentOffset; ///< The alignment offset.
+ bool mElideEnabled : 1; ///< Whether the text's elide is enabled.
+ bool mIgnoreSpacesAfterText : 1; ///< Whether ignoring spaces after text or not. Default is true.
+ DevelText::MatchLayoutDirection mMatchLayoutDirection; ///< Whether to match text alignment with layout direction or not.
};
} // namespace Text
{
if(mImpl->mVisualModel)
{
- return (mImpl->mVisualModel->mBackgroundColorIndices.Count() > 0);
+ return (mImpl->mVisualModel->mBackgroundColors.Count() > 0);
}
return false;
// EXTERNAL INCLUDES
#include <dali/devel-api/adaptor-framework/image-loading.h>
-#include <dali/devel-api/adaptor-framework/window-devel.h>
#include <dali/devel-api/images/pixel-data-devel.h>
#include <dali/devel-api/rendering/renderer-devel.h>
#include <dali/devel-api/text-abstraction/text-abstraction-definitions.h>
return;
}
- Dali::LayoutDirection::Type layoutDirection;
- if(mController->IsMatchSystemLanguageDirection())
- {
- layoutDirection = static_cast<Dali::LayoutDirection::Type>(DevelWindow::Get(control).GetRootLayer().GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get<int>());
- }
- else
- {
- layoutDirection = static_cast<Dali::LayoutDirection::Type>(control.GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get<int>());
- }
+ Dali::LayoutDirection::Type layoutDirection = mController->GetLayoutDirection(control);
const Text::Controller::UpdateTextType updateTextType = mController->Relayout(relayoutSize, layoutDirection);
{
const unsigned int TOOLKIT_MAJOR_VERSION = 2;
const unsigned int TOOLKIT_MINOR_VERSION = 0;
-const unsigned int TOOLKIT_MICRO_VERSION = 33;
+const unsigned int TOOLKIT_MICRO_VERSION = 34;
const char* const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali2-toolkit
Summary: Dali 3D engine Toolkit
-Version: 2.0.33
+Version: 2.0.34
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT