for current, FONT_SIZE_SCALE is applied to all text.
Add ENABLE_FONT_SIZE_SCALE to selectively apply FONT_SIZE_SCALE from SystemSettings.
Change-Id: If8d2574fcdeaa98ff4645ff03eec78e1bc265c3e
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
18 files changed:
const char* const PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION = "matchSystemLanguageDirection";
const char* const PROPERTY_NAME_MAX_LENGTH = "maxLength";
const char* const PROPERTY_NAME_FONT_SIZE_SCALE = "fontSizeScale";
const char* const PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION = "matchSystemLanguageDirection";
const char* const PROPERTY_NAME_MAX_LENGTH = "maxLength";
const char* const PROPERTY_NAME_FONT_SIZE_SCALE = "fontSizeScale";
+const char* const PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE = "enableFontSizeScale";
const char* const PROPERTY_NAME_GRAB_HANDLE_COLOR = "grabHandleColor";
const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP = "enableGrabHandlePopup";
const char* const PROPERTY_NAME_INPUT_METHOD_SETTINGS = "inputMethodSettings";
const char* const PROPERTY_NAME_GRAB_HANDLE_COLOR = "grabHandleColor";
const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP = "enableGrabHandlePopup";
const char* const PROPERTY_NAME_INPUT_METHOD_SETTINGS = "inputMethodSettings";
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_SELECTION ) == TextEditor::Property::ENABLE_SELECTION );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER ) == TextEditor::Property::PLACEHOLDER );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_FONT_SIZE_SCALE ) == DevelTextEditor::Property::FONT_SIZE_SCALE );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_SELECTION ) == TextEditor::Property::ENABLE_SELECTION );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER ) == TextEditor::Property::PLACEHOLDER );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_FONT_SIZE_SCALE ) == DevelTextEditor::Property::FONT_SIZE_SCALE );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE ) == DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER_TEXT ) == DevelTextEditor::Property::PLACEHOLDER_TEXT );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER_TEXT_COLOR ) == DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_SHIFT_SELECTION ) == DevelTextEditor::Property::ENABLE_SHIFT_SELECTION );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER_TEXT ) == DevelTextEditor::Property::PLACEHOLDER_TEXT );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER_TEXT_COLOR ) == DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_SHIFT_SELECTION ) == DevelTextEditor::Property::ENABLE_SHIFT_SELECTION );
DALI_TEST_EQUALS( editor.GetProperty<float>( DevelTextEditor::Property::FONT_SIZE_SCALE ), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
editor.SetProperty( DevelTextEditor::Property::FONT_SIZE_SCALE, 1.0f );
DALI_TEST_EQUALS( editor.GetProperty<float>( DevelTextEditor::Property::FONT_SIZE_SCALE ), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
editor.SetProperty( DevelTextEditor::Property::FONT_SIZE_SCALE, 1.0f );
+ editor.SetProperty( DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE, false );
+ DALI_TEST_EQUALS( editor.GetProperty<bool>( DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE ), false, TEST_LOCATION );
+ editor.SetProperty( DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE, true );
+
// Reset font style.
fontStyleMapSet.Clear();
fontStyleMapSet.Insert( "weight", "normal" );
// Reset font style.
fontStyleMapSet.Clear();
fontStyleMapSet.Insert( "weight", "normal" );
const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP = "enableGrabHandlePopup";
const char* const PROPERTY_NAME_BACKGROUND = "textBackground";
const char* const PROPERTY_NAME_FONT_SIZE_SCALE = "fontSizeScale";
const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP = "enableGrabHandlePopup";
const char* const PROPERTY_NAME_BACKGROUND = "textBackground";
const char* const PROPERTY_NAME_FONT_SIZE_SCALE = "fontSizeScale";
+const char* const PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE = "enableFontSizeScale";
const char* const PROPERTY_NAME_GRAB_HANDLE_COLOR = "grabHandleColor";
const char* const PROPERTY_NAME_INPUT_FILTER = "inputFilter";
const char* const PROPERTY_NAME_GRAB_HANDLE_COLOR = "grabHandleColor";
const char* const PROPERTY_NAME_INPUT_FILTER = "inputFilter";
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER ) == TextField::Property::PLACEHOLDER );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS ) == TextField::Property::ELLIPSIS );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_FONT_SIZE_SCALE ) == DevelTextField::Property::FONT_SIZE_SCALE );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER ) == TextField::Property::PLACEHOLDER );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS ) == TextField::Property::ELLIPSIS );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_FONT_SIZE_SCALE ) == DevelTextField::Property::FONT_SIZE_SCALE );
+ DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE ) == DevelTextField::Property::ENABLE_FONT_SIZE_SCALE );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_SHIFT_SELECTION ) == DevelTextField::Property::ENABLE_SHIFT_SELECTION );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_GRAB_HANDLE ) == DevelTextField::Property::ENABLE_GRAB_HANDLE );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION ) == DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_SHIFT_SELECTION ) == DevelTextField::Property::ENABLE_SHIFT_SELECTION );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_GRAB_HANDLE ) == DevelTextField::Property::ENABLE_GRAB_HANDLE );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION ) == DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION );
DALI_TEST_EQUALS( field.GetProperty<float>( DevelTextField::Property::FONT_SIZE_SCALE ), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
field.SetProperty( DevelTextField::Property::FONT_SIZE_SCALE, 1.0f );
DALI_TEST_EQUALS( field.GetProperty<float>( DevelTextField::Property::FONT_SIZE_SCALE ), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
field.SetProperty( DevelTextField::Property::FONT_SIZE_SCALE, 1.0f );
+ field.SetProperty( DevelTextField::Property::ENABLE_FONT_SIZE_SCALE, false );
+ DALI_TEST_EQUALS( field.GetProperty<bool>( DevelTextField::Property::ENABLE_FONT_SIZE_SCALE ), false, TEST_LOCATION );
+ field.SetProperty( DevelTextField::Property::ENABLE_FONT_SIZE_SCALE, true );
+
// Reset font style.
fontStyleMapSet.Clear();
fontStyleMapSet.Insert( "weight", "normal" );
// Reset font style.
fontStyleMapSet.Clear();
fontStyleMapSet.Insert( "weight", "normal" );
const char* const PROPERTY_NAME_ELLIPSIS = "ellipsis";
const char* const PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY = "autoScrollLoopDelay";
const char* const PROPERTY_NAME_FONT_SIZE_SCALE = "fontSizeScale";
const char* const PROPERTY_NAME_ELLIPSIS = "ellipsis";
const char* const PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY = "autoScrollLoopDelay";
const char* const PROPERTY_NAME_FONT_SIZE_SCALE = "fontSizeScale";
+const char* const PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE = "enableFontSizeScale";
const char* const PROPERTY_NAME_ELLIPSIS_POSITION = "ellipsisPosition";
const char* const PROPERTY_NAME_ELLIPSIS_POSITION = "ellipsisPosition";
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS ) == TextLabel::Property::ELLIPSIS );
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY ) == TextLabel::Property::AUTO_SCROLL_LOOP_DELAY );
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_FONT_SIZE_SCALE ) == DevelTextLabel::Property::FONT_SIZE_SCALE );
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS ) == TextLabel::Property::ELLIPSIS );
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY ) == TextLabel::Property::AUTO_SCROLL_LOOP_DELAY );
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_FONT_SIZE_SCALE ) == DevelTextLabel::Property::FONT_SIZE_SCALE );
+ DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE ) == DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE );
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS_POSITION ) == DevelTextLabel::Property::ELLIPSIS_POSITION );
END_TEST;
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS_POSITION ) == DevelTextLabel::Property::ELLIPSIS_POSITION );
END_TEST;
DALI_TEST_EQUALS( label.GetProperty<float>( DevelTextLabel::Property::FONT_SIZE_SCALE ), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
label.SetProperty( DevelTextLabel::Property::FONT_SIZE_SCALE, 1.0f );
DALI_TEST_EQUALS( label.GetProperty<float>( DevelTextLabel::Property::FONT_SIZE_SCALE ), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
label.SetProperty( DevelTextLabel::Property::FONT_SIZE_SCALE, 1.0f );
+ label.SetProperty( DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE, false );
+ DALI_TEST_EQUALS( label.GetProperty<bool>( DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE ), false, TEST_LOCATION );
+ label.SetProperty( DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE, true );
+
// Reset font style.
fontStyleMapSet.Clear();
fontStyleMapSet.Insert( "weight", "normal" );
// Reset font style.
fontStyleMapSet.Clear();
fontStyleMapSet.Insert( "weight", "normal" );
#define DALI_TOOLKIT_TEXT_EDITOR_DEVEL_H
/*
#define DALI_TOOLKIT_TEXT_EDITOR_DEVEL_H
/*
- * 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+ * @brief True to enable the font size scale or false to disable.
+ * @details Name "enableFontSizeScale", type Property::BOOLEAN.
+ * @note The default value is true.
+ * If false, font size scale is not apppied.
+ */
+ ENABLE_FONT_SIZE_SCALE,
+
+ /**
* @brief The position for primary cursor.
* @details Name "primaryCursorPosition", type Property::INTEGER.
*/
* @brief The position for primary cursor.
* @details Name "primaryCursorPosition", type Property::INTEGER.
*/
#define DALI_TOOLKIT_TEXT_FIELD_DEVEL_H
/*
#define DALI_TOOLKIT_TEXT_FIELD_DEVEL_H
/*
- * 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+ * @brief True to enable the font size scale or false to disable.
+ * @details Name "enableFontSizeScale", type Property::BOOLEAN.
+ * @note The default value is true.
+ * If false, font size scale is not apppied.
+ */
+ ENABLE_FONT_SIZE_SCALE,
+
+ /**
* @brief The position for primary cursor.
* @details Name "primaryCursorPosition", type Property::INTEGER.
*/
* @brief The position for primary cursor.
* @details Name "primaryCursorPosition", type Property::INTEGER.
*/
#define DALI_TOOLKIT_TEXT_LABEL_DEVEL_H
/*
#define DALI_TOOLKIT_TEXT_LABEL_DEVEL_H
/*
- * 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+ * @brief True to enable the font size scale or false to disable.
+ * @details Name "enableFontSizeScale", type Property::BOOLEAN.
+ * @note The default value is true.
+ * If false, font size scale is not apppied.
+ */
+ ENABLE_FONT_SIZE_SCALE,
+
+ /**
* @brief The enumerations used to specify whether to position the ellipsis at the END, START or MIDDLE of the text.
* @details Name "EllipsisPosition", type [Type](@ref Dali::Toolkit::DevelText::EllipsisPosition::Type) (Property::INTEGER), or Property::STRING. Read/Write
* @note Default is EllipsisPosition::END.
* @brief The enumerations used to specify whether to position the ellipsis at the END, START or MIDDLE of the text.
* @details Name "EllipsisPosition", type [Type](@ref Dali::Toolkit::DevelText::EllipsisPosition::Type) (Property::INTEGER), or Property::STRING. Read/Write
* @note Default is EllipsisPosition::END.
- * 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "enableEditing", BOOLEAN, ENABLE_EDITING )
DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY(Toolkit, TextEditor, "selectedText", STRING, SELECTED_TEXT )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "fontSizeScale", FLOAT, FONT_SIZE_SCALE )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "enableEditing", BOOLEAN, ENABLE_EDITING )
DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY(Toolkit, TextEditor, "selectedText", STRING, SELECTED_TEXT )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "fontSizeScale", FLOAT, FONT_SIZE_SCALE )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "enableFontSizeScale", BOOLEAN, ENABLE_FONT_SIZE_SCALE )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "primaryCursorPosition", INTEGER, PRIMARY_CURSOR_POSITION )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "grabHandleColor", VECTOR4, GRAB_HANDLE_COLOR )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "enableGrabHandlePopup", BOOLEAN, ENABLE_GRAB_HANDLE_POPUP )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "primaryCursorPosition", INTEGER, PRIMARY_CURSOR_POSITION )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "grabHandleColor", VECTOR4, GRAB_HANDLE_COLOR )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "enableGrabHandlePopup", BOOLEAN, ENABLE_GRAB_HANDLE_POPUP )
- * 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
* limitations under the License.
*/
-#include <dali-toolkit/internal/controls/text-controls/text-editor-property-handler.h>
#include <dali-toolkit/internal/controls/text-controls/common-text-utils.h>
#include <dali-toolkit/internal/controls/text-controls/common-text-utils.h>
+#include <dali-toolkit/internal/controls/text-controls/text-editor-property-handler.h>
#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
+ case Toolkit::DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE:
+ {
+ const bool enableFontSizeScale = value.Get<bool>();
+ if(!Equals(impl.mController->IsFontSizeScaleEnabled(), enableFontSizeScale))
+ {
+ impl.mController->SetFontSizeScaleEnabled(enableFontSizeScale);
+ }
+ break;
+ }
case Toolkit::DevelTextEditor::Property::PRIMARY_CURSOR_POSITION:
{
uint32_t position = static_cast<uint32_t>(value.Get<int>());
case Toolkit::DevelTextEditor::Property::PRIMARY_CURSOR_POSITION:
{
uint32_t position = static_cast<uint32_t>(value.Get<int>());
value = impl.mController->GetFontSizeScale();
break;
}
value = impl.mController->GetFontSizeScale();
break;
}
+ case Toolkit::DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE:
+ {
+ value = impl.mController->IsFontSizeScaleEnabled();
+ break;
+ }
case Toolkit::DevelTextEditor::Property::PRIMARY_CURSOR_POSITION:
{
value = static_cast<int>(impl.mController->GetPrimaryCursorPosition());
case Toolkit::DevelTextEditor::Property::PRIMARY_CURSOR_POSITION:
{
value = static_cast<int>(impl.mController->GetPrimaryCursorPosition());
- * 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "selectedTextEnd", INTEGER, SELECTED_TEXT_END )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "enableEditing", BOOLEAN, ENABLE_EDITING )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "fontSizeScale", FLOAT, FONT_SIZE_SCALE )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "selectedTextEnd", INTEGER, SELECTED_TEXT_END )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "enableEditing", BOOLEAN, ENABLE_EDITING )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "fontSizeScale", FLOAT, FONT_SIZE_SCALE )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "enableFontSizeScale", BOOLEAN, ENABLE_FONT_SIZE_SCALE )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "primaryCursorPosition", INTEGER, PRIMARY_CURSOR_POSITION )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "grabHandleColor", VECTOR4, GRAB_HANDLE_COLOR )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "inputFilter", MAP, INPUT_FILTER )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "primaryCursorPosition", INTEGER, PRIMARY_CURSOR_POSITION )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "grabHandleColor", VECTOR4, GRAB_HANDLE_COLOR )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "inputFilter", MAP, INPUT_FILTER )
- * 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
* limitations under the License.
*/
-#include <dali-toolkit/internal/controls/text-controls/text-field-property-handler.h>
#include <dali-toolkit/internal/controls/text-controls/common-text-utils.h>
#include <dali-toolkit/internal/controls/text-controls/common-text-utils.h>
+#include <dali-toolkit/internal/controls/text-controls/text-field-property-handler.h>
#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
#include <dali-toolkit/devel-api/text/rendering-backend.h>
#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
#include <dali-toolkit/devel-api/text/rendering-backend.h>
+ case Toolkit::DevelTextField::Property::ENABLE_FONT_SIZE_SCALE:
+ {
+ const bool enableFontSizeScale = value.Get<bool>();
+ if(!Equals(impl.mController->IsFontSizeScaleEnabled(), enableFontSizeScale))
+ {
+ impl.mController->SetFontSizeScaleEnabled(enableFontSizeScale);
+ }
+ break;
+ }
case Toolkit::DevelTextField::Property::PRIMARY_CURSOR_POSITION:
{
uint32_t position = static_cast<uint32_t>(value.Get<int>());
case Toolkit::DevelTextField::Property::PRIMARY_CURSOR_POSITION:
{
uint32_t position = static_cast<uint32_t>(value.Get<int>());
value = impl.mController->GetFontSizeScale();
break;
}
value = impl.mController->GetFontSizeScale();
break;
}
+ case Toolkit::DevelTextField::Property::ENABLE_FONT_SIZE_SCALE:
+ {
+ value = impl.mController->IsFontSizeScaleEnabled();
+ break;
+ }
case Toolkit::DevelTextField::Property::PRIMARY_CURSOR_POSITION:
{
value = static_cast<int>(impl.mController->GetPrimaryCursorPosition());
case Toolkit::DevelTextField::Property::PRIMARY_CURSOR_POSITION:
{
value = static_cast<int>(impl.mController->GetPrimaryCursorPosition());
- * 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "minLineSize", FLOAT, MIN_LINE_SIZE )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "renderingBackend", INTEGER, RENDERING_BACKEND )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "fontSizeScale", FLOAT, FONT_SIZE_SCALE )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "minLineSize", FLOAT, MIN_LINE_SIZE )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "renderingBackend", INTEGER, RENDERING_BACKEND )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "fontSizeScale", FLOAT, FONT_SIZE_SCALE )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "enableFontSizeScale", BOOLEAN, ENABLE_FONT_SIZE_SCALE )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "ellipsisPosition", INTEGER, ELLIPSIS_POSITION )
DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT(Toolkit, TextLabel, "textColor", Color::BLACK, TEXT_COLOR )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "ellipsisPosition", INTEGER, ELLIPSIS_POSITION )
DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT(Toolkit, TextLabel, "textColor", Color::BLACK, TEXT_COLOR )
+ case Toolkit::DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE:
+ {
+ const bool enableFontSizeScale = value.Get<bool>();
+ if(!Equals(impl.mController->IsFontSizeScaleEnabled(), enableFontSizeScale))
+ {
+ impl.mController->SetFontSizeScaleEnabled(enableFontSizeScale);
+ }
+ break;
+ }
case Toolkit::DevelTextLabel::Property::ELLIPSIS_POSITION:
{
DevelText::EllipsisPosition::Type ellipsisPositionType(static_cast<DevelText::EllipsisPosition::Type>(-1)); // Set to invalid value to ensure a valid mode does get set
case Toolkit::DevelTextLabel::Property::ELLIPSIS_POSITION:
{
DevelText::EllipsisPosition::Type ellipsisPositionType(static_cast<DevelText::EllipsisPosition::Type>(-1)); // Set to invalid value to ensure a valid mode does get set
value = impl.mController->GetFontSizeScale();
break;
}
value = impl.mController->GetFontSizeScale();
break;
}
+ case Toolkit::DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE:
+ {
+ value = impl.mController->IsFontSizeScaleEnabled();
+ break;
+ }
case Toolkit::DevelTextLabel::Property::ELLIPSIS_POSITION:
{
value = impl.mController->GetEllipsisPosition();
case Toolkit::DevelTextLabel::Property::ELLIPSIS_POSITION:
{
value = impl.mController->GetEllipsisPosition();
- * 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali::Toolkit::Text
{
namespace Dali::Toolkit::Text
{
namespace
{
#if defined(DEBUG_ENABLED)
namespace
{
#if defined(DEBUG_ENABLED)
// Check whether the indices for updating the text is valid
if(numberOfCharacters > 0u &&
(impl.mTextUpdateInfo.mParagraphCharacterIndex > numberOfCharacters ||
// Check whether the indices for updating the text is valid
if(numberOfCharacters > 0u &&
(impl.mTextUpdateInfo.mParagraphCharacterIndex > numberOfCharacters ||
- impl.mTextUpdateInfo.mRequestedNumberOfCharacters > numberOfCharacters))
+ impl.mTextUpdateInfo.mRequestedNumberOfCharacters > numberOfCharacters))
{
std::string currentText;
Utf32ToUtf8(impl.mModel->mLogicalModel->mText.Begin(), numberOfCharacters, currentText);
{
std::string currentText;
Utf32ToUtf8(impl.mModel->mLogicalModel->mText.Begin(), numberOfCharacters, currentText);
lineBreakInfo);
if(impl.mModel->mLineWrapMode == ((Text::LineWrap::Mode)DevelText::LineWrap::HYPHENATION) ||
lineBreakInfo);
if(impl.mModel->mLineWrapMode == ((Text::LineWrap::Mode)DevelText::LineWrap::HYPHENATION) ||
- impl.mModel->mLineWrapMode == ((Text::LineWrap::Mode)DevelText::LineWrap::MIXED))
+ impl.mModel->mLineWrapMode == ((Text::LineWrap::Mode)DevelText::LineWrap::MIXED))
{
CharacterIndex end = startIndex + requestedNumberOfCharacters;
LineBreakInfo* lineBreakInfoBuffer = lineBreakInfo.Begin();
{
CharacterIndex end = startIndex + requestedNumberOfCharacters;
LineBreakInfo* lineBreakInfoBuffer = lineBreakInfo.Begin();
// Get the default font's description.
TextAbstraction::FontDescription defaultFontDescription;
// Get the default font's description.
TextAbstraction::FontDescription defaultFontDescription;
- TextAbstraction::PointSize26Dot6 defaultPointSize = TextAbstraction::FontClient::DEFAULT_POINT_SIZE * impl.mFontSizeScale;
+ TextAbstraction::PointSize26Dot6 defaultPointSize = TextAbstraction::FontClient::DEFAULT_POINT_SIZE * impl.GetFontSizeScale();
//Get the number of points per one unit of point-size
uint32_t numberOfPointsPerOneUnitOfPointSize = impl.mFontClient.GetNumberOfPointsPerOneUnitOfPointSize();
//Get the number of points per one unit of point-size
uint32_t numberOfPointsPerOneUnitOfPointSize = impl.mFontClient.GetNumberOfPointsPerOneUnitOfPointSize();
defaultFontDescription = impl.mEventData->mPlaceholderFont->mFontDescription;
if(impl.mEventData->mPlaceholderFont->sizeDefined)
{
defaultFontDescription = impl.mEventData->mPlaceholderFont->mFontDescription;
if(impl.mEventData->mPlaceholderFont->sizeDefined)
{
- defaultPointSize = impl.mEventData->mPlaceholderFont->mDefaultPointSize * impl.mFontSizeScale * numberOfPointsPerOneUnitOfPointSize;
+ defaultPointSize = impl.mEventData->mPlaceholderFont->mDefaultPointSize * impl.GetFontSizeScale() * numberOfPointsPerOneUnitOfPointSize;
}
}
else if(nullptr != impl.mFontDefaults)
}
}
else if(nullptr != impl.mFontDefaults)
- defaultPointSize = impl.mFontDefaults->mDefaultPointSize * impl.mFontSizeScale * numberOfPointsPerOneUnitOfPointSize;
+ defaultPointSize = impl.mFontDefaults->mDefaultPointSize * impl.GetFontSizeScale() * numberOfPointsPerOneUnitOfPointSize;
}
if((nullptr != impl.mEventData) &&
}
if((nullptr != impl.mEventData) &&
- impl.mEventData->mPreEditFlag &&
+ impl.mEventData->mPreEditFlag &&
(0u != impl.mModel->mVisualModel->mCharactersToGlyph.Count()))
{
Dali::InputMethodContext::PreEditAttributeDataContainer attrs;
(0u != impl.mModel->mVisualModel->mCharactersToGlyph.Count()))
{
Dali::InputMethodContext::PreEditAttributeDataContainer attrs;
if((Controller::NO_OPERATION != (Controller::SHAPE_TEXT & operations)) &&
!((nullptr != impl.mEventData) &&
if((Controller::NO_OPERATION != (Controller::SHAPE_TEXT & operations)) &&
!((nullptr != impl.mEventData) &&
- impl.mEventData->mPreEditFlag &&
+ impl.mEventData->mPreEditFlag &&
(0u != impl.mModel->mVisualModel->mCharactersToGlyph.Count())))
{
//Mark-up processor case
(0u != impl.mModel->mVisualModel->mCharactersToGlyph.Count())))
{
//Mark-up processor case
- * 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
if(nullptr == mFontDefaults)
{
TextAbstraction::FontDescription fontDescription;
if(nullptr == mFontDefaults)
{
TextAbstraction::FontDescription fontDescription;
- defaultFontId = mFontClient.GetFontId(fontDescription, TextAbstraction::FontClient::DEFAULT_POINT_SIZE * mFontSizeScale);
+ defaultFontId = mFontClient.GetFontId(fontDescription, TextAbstraction::FontClient::DEFAULT_POINT_SIZE * GetFontSizeScale());
- defaultFontId = mFontDefaults->GetFontId(mFontClient, mFontDefaults->mDefaultPointSize * mFontSizeScale);
+ defaultFontId = mFontDefaults->GetFontId(mFontClient, mFontDefaults->mDefaultPointSize * GetFontSizeScale());
}
Text::FontMetrics fontMetrics;
}
Text::FontMetrics fontMetrics;
#define DALI_TOOLKIT_TEXT_CONTROLLER_IMPL_H
/*
#define DALI_TOOLKIT_TEXT_CONTROLLER_IMPL_H
/*
- * 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
mTextFitMaxSize(DEFAULT_TEXTFIT_MAX),
mTextFitStepSize(DEFAULT_TEXTFIT_STEP),
mFontSizeScale(DEFAULT_FONT_SIZE_SCALE),
mTextFitMaxSize(DEFAULT_TEXTFIT_MAX),
mTextFitStepSize(DEFAULT_TEXTFIT_STEP),
mFontSizeScale(DEFAULT_FONT_SIZE_SCALE),
+ mFontSizeScaleEnabled(true),
mTextFitEnabled(false),
mTextFitChanged(false),
mIsLayoutDirectionChanged(false)
mTextFitEnabled(false),
mTextFitChanged(false),
mIsLayoutDirectionChanged(false)
+ float GetFontSizeScale()
+ {
+ return mFontSizeScaleEnabled ? mFontSizeScale : 1.0f;
+ }
+
/**
* @brief Helper to notify InputMethodContext with surrounding text & cursor changes.
*/
/**
* @brief Helper to notify InputMethodContext with surrounding text & cursor changes.
*/
float mTextFitMaxSize; ///< Maximum Font Size for text fit. Default 100
float mTextFitStepSize; ///< Step Size for font intervalse. Default 1
float mFontSizeScale; ///< Scale value for Font Size. Default 1.0
float mTextFitMaxSize; ///< Maximum Font Size for text fit. Default 100
float mTextFitStepSize; ///< Step Size for font intervalse. Default 1
float mFontSizeScale; ///< Scale value for Font Size. Default 1.0
+ bool mFontSizeScaleEnabled : 1; ///< Whether the font size scale is enabled.
bool mTextFitEnabled : 1; ///< Whether the text's fit is enabled.
bool mTextFitChanged : 1; ///< Whether the text fit property has changed.
bool mIsLayoutDirectionChanged : 1; ///< Whether the layout has changed.
bool mTextFitEnabled : 1; ///< Whether the text's fit is enabled.
bool mTextFitChanged : 1; ///< Whether the text fit property has changed.
bool mIsLayoutDirectionChanged : 1; ///< Whether the layout has changed.
- * 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
startOfSelectedText,
lengthOfSelectedText);
startOfSelectedText,
lengthOfSelectedText);
- fontDescriptionRun.size = static_cast<PointSize26Dot6>(size * controller.mImpl->mFontSizeScale * 64.f);
+ fontDescriptionRun.size = static_cast<PointSize26Dot6>(size * controller.mImpl->GetFontSizeScale() * 64.f);
fontDescriptionRun.sizeDefined = true;
controller.mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText;
fontDescriptionRun.sizeDefined = true;
controller.mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText;
- * 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- fontDescriptionRun.size = static_cast<PointSize26Dot6>(inputStyle.size * impl.mFontSizeScale * 64.f);
+ fontDescriptionRun.size = static_cast<PointSize26Dot6>(inputStyle.size * impl.GetFontSizeScale() * 64.f);
fontDescriptionRun.sizeDefined = true;
}
fontDescriptionRun.sizeDefined = true;
}
- * 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
mImpl->mFontSizeScale = scale;
{
mImpl->mFontSizeScale = scale;
+ // No relayout is required
+ if(!mImpl->mFontSizeScaleEnabled) return;
+
// Update the cursor position if it's in editing mode
UpdateCursorPosition(mImpl->mEventData);
// Update the cursor position if it's in editing mode
UpdateCursorPosition(mImpl->mEventData);
return mImpl->mFontDefaults ? mImpl->mFontSizeScale : 1.0f;
}
return mImpl->mFontDefaults ? mImpl->mFontSizeScale : 1.0f;
}
+void Controller::SetFontSizeScaleEnabled(bool enabled)
+{
+ mImpl->mFontSizeScaleEnabled = enabled;
+
+ // Update the cursor position if it's in editing mode
+ UpdateCursorPosition(mImpl->mEventData);
+
+ // Clear the font-specific data
+ mImpl->ClearFontData();
+
+ mImpl->RequestRelayout();
+}
+
+bool Controller::IsFontSizeScaleEnabled() const
+{
+ return mImpl->mFontSizeScaleEnabled;
+}
+
void Controller::SetDefaultFontSize(float fontSize, FontSizeType type)
{
EnsureCreated(mImpl->mFontDefaults);
void Controller::SetDefaultFontSize(float fontSize, FontSizeType type)
{
EnsureCreated(mImpl->mFontDefaults);
#define DALI_TOOLKIT_TEXT_CONTROLLER_H
/*
#define DALI_TOOLKIT_TEXT_CONTROLLER_H
/*
- * 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
float GetFontSizeScale() const;
/**
float GetFontSizeScale() const;
/**
+ * @brief Set the font size scale enabled flag.
+ *
+ * @param[in] enabled whether to enable the font size scale.
+ */
+ void SetFontSizeScaleEnabled(bool enabled);
+
+ /**
+ * @brief Returns whether the font size scale is enabled or not.
+ *
+ * @return @e true if the font size scale is enabled, otherwise returns @e false.
+ */
+ bool IsFontSizeScaleEnabled() const;
+
+ /**
* @brief Sets the Placeholder text font size.
* @param[in] fontSize The placeholder text font size
* @param[in] type The font size type is point size or pixel size
* @brief Sets the Placeholder text font size.
* @param[in] fontSize The placeholder text font size
* @param[in] type The font size type is point size or pixel size