Adding Character Spacing
***********************************************************
Description:
Adding the CHARACTER_SPACING for text-editor, text-field and text-label.
CHARACTER_SPACING determines the spaces between characters.
A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).
The sample code below can be used to test the CHARACTER_SPACING.
***********************************************************
using namespace Dali;
using namespace Dali::Toolkit;
class SimpleApp : public ConnectionTracker
{
public:
SimpleApp(Application &application)
: mApplication(application)
{
mApplication.InitSignal().Connect(this, &SimpleApp::Create);
}
void Create(Application &application)
{
Window window = application.GetWindow();
window.SetBackgroundColor(Vector4(0.04f, 0.345f, 0.392f, 1.0f));
mEditor = TextEditor::New();
mEditor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER);
mEditor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER);
mEditor.SetProperty(Actor::Property::POSITION, Vector3(0.f, 0.0f, 0.f));
mEditor.SetProperty(Actor::Property::SIZE, Vector2(200.f, 100.0f));
mEditor.SetBackgroundColor(Vector4(0.04f, 0.345f, 0.392f, 1.0f));
mEditor.SetProperty(TextEditor::Property::TEXT, "A long text that exceeds the editor's width.");
mEditor.SetProperty(DevelTextEditor::Property::CHARACTER_SPACING, 15.0f);
// mLabel = TextLabel::New();
// mLabel.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER);
// mLabel.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER);
// mLabel.SetProperty(Actor::Property::POSITION, Vector3(0.f, 0.0f, 0.f));
// mLabel.SetProperty(Actor::Property::SIZE, Vector2(400.f, 200.0f));
// mLabel.SetProperty(TextLabel::Property::TEXT_COLOR, Color::BLACK);
// mLabel.SetProperty(TextLabel::Property::TEXT, "A long text text text that exceeds the label's width.");
// mLabel.SetProperty(DevelTextLabel::Property::CHARACTER_SPACING, 10.0f);
// mLabel.SetProperty(TextLabel::Property::ELLIPSIS, false);
// mField = TextField::New();
// mField.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER);
// mField.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER);
// mField.SetProperty(Actor::Property::POSITION, Vector3(0.f, 0.0f, 0.f));
// mField.SetProperty(Actor::Property::SIZE, Vector2(200.f, 100.0f));
// mField.SetProperty(TextField::Property::TEXT, "A long text text text that exceeds the field's width.");
// mField.SetProperty(DevelTextField::Property::CHARACTER_SPACING, 10.0f);
// mField.SetProperty(TextField::Property::ELLIPSIS, false);
//window.Add(mLabel);
window.Add(mEditor);
//window.Add(mField);
}
bool OnButtonClicked(Button button)
{
if (button == mButton)
{
Vector3 originalSize = mEditor.GetNaturalSize();
}
return true;
}
private:
Application &mApplication;
TextEditor mEditor;
PushButton mButton;
TextField mField;
TextLabel mLabel;
};
int DALI_EXPORT_API main(int argc, char **argv)
{
Application application = Application::New(&argc, &argv);
SimpleApp test(application);
application.MainLoop();
return 0;
}
Change-Id: Ibd89f1398e391dc56e3a230c7a136cfe07edc37a
50 files changed: