2 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali-toolkit/internal/text/text-model.h>
29 return ModelPtr(new Model());
32 const Size& Model::GetControlSize() const
34 return mVisualModel->mControlSize;
37 const Size& Model::GetLayoutSize() const
39 return mVisualModel->GetLayoutSize();
42 const Vector2& Model::GetScrollPosition() const
44 return mScrollPosition;
47 HorizontalAlignment::Type Model::GetHorizontalAlignment() const
49 return mHorizontalAlignment;
52 VerticalAlignment::Type Model::GetVerticalAlignment() const
54 return mVerticalAlignment;
57 DevelText::VerticalLineAlignment::Type Model::GetVerticalLineAlignment() const
59 return mVerticalLineAlignment;
62 bool Model::IsTextElideEnabled() const
67 Length Model::GetNumberOfLines() const
69 return mVisualModel->mLines.Count();
72 const LineRun* const Model::GetLines() const
74 return mVisualModel->mLines.Begin();
77 Length Model::GetNumberOfScripts() const
79 return mLogicalModel->mScriptRuns.Count();
82 const ScriptRun* const Model::GetScriptRuns() const
84 return mLogicalModel->mScriptRuns.Begin();
87 Length Model::GetNumberOfGlyphs() const
89 return mVisualModel->mGlyphs.Count();
92 const GlyphInfo* const Model::GetGlyphs() const
94 return mVisualModel->mGlyphs.Begin();
97 const Vector2* const Model::GetLayout() const
99 return mVisualModel->mGlyphPositions.Begin();
102 const Vector4* const Model::GetColors() const
104 return mVisualModel->mColors.Begin();
107 const ColorIndex* const Model::GetColorIndices() const
109 return mVisualModel->mColorIndices.Begin();
112 const Vector4* const Model::GetBackgroundColors() const
114 return mVisualModel->mBackgroundColors.Begin();
117 const ColorIndex* const Model::GetBackgroundColorIndices() const
119 return mVisualModel->mBackgroundColorIndices.Begin();
122 const Vector4& Model::GetDefaultColor() const
124 return mVisualModel->mTextColor;
127 const Vector2& Model::GetShadowOffset() const
129 return mVisualModel->mShadowOffset;
132 const Vector4& Model::GetShadowColor() const
134 return mVisualModel->mShadowColor;
137 const float& Model::GetShadowBlurRadius() const
139 return mVisualModel->mShadowBlurRadius;
142 const Vector4& Model::GetUnderlineColor() const
144 return mVisualModel->GetUnderlineColor();
147 bool Model::IsUnderlineEnabled() const
149 return mVisualModel->IsUnderlineEnabled();
152 float Model::GetUnderlineHeight() const
154 return mVisualModel->GetUnderlineHeight();
157 Length Model::GetNumberOfUnderlineRuns() const
159 return mVisualModel->GetNumberOfUnderlineRuns();
162 void Model::GetUnderlineRuns(GlyphRun* underlineRuns, UnderlineRunIndex index, Length numberOfRuns) const
164 mVisualModel->GetUnderlineRuns(underlineRuns, index, numberOfRuns);
167 const Vector4& Model::GetOutlineColor() const
169 return mVisualModel->GetOutlineColor();
172 uint16_t Model::GetOutlineWidth() const
174 return mVisualModel->GetOutlineWidth();
177 const Vector4& Model::GetBackgroundColor() const
179 return mVisualModel->GetBackgroundColor();
182 bool Model::IsBackgroundEnabled() const
184 return mVisualModel->IsBackgroundEnabled();
191 mScrollPositionLast(),
192 mHorizontalAlignment(Text::HorizontalAlignment::BEGIN),
193 mVerticalAlignment(Text::VerticalAlignment::TOP),
194 mVerticalLineAlignment(DevelText::VerticalLineAlignment::TOP),
195 mLineWrapMode(Text::LineWrap::WORD),
196 mAlignmentOffset(0.0f),
197 mElideEnabled(false),
198 mIgnoreSpacesAfterText(true),
199 mMatchSystemLanguageDirection(false)
201 mLogicalModel = LogicalModel::New();
202 mVisualModel = VisualModel::New();
211 } // namespace Toolkit