2 * Copyright (c) 2018 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>
32 return ModelPtr( new Model() );
35 const Size& Model::GetControlSize() const
37 return mVisualModel->mControlSize;
40 const Size& Model::GetLayoutSize() const
42 return mVisualModel->GetLayoutSize();
45 const Vector2& Model::GetScrollPosition() const
47 return mScrollPosition;
50 HorizontalAlignment::Type Model::GetHorizontalAlignment() const
52 return mHorizontalAlignment;
55 VerticalAlignment::Type Model::GetVerticalAlignment() const
57 return mVerticalAlignment;
60 DevelText::VerticalLineAlignment::Type Model::GetVerticalLineAlignment() const
62 return mVerticalLineAlignment;
65 bool Model::IsTextElideEnabled() const
70 Length Model::GetNumberOfLines() const
72 return mVisualModel->mLines.Count();
75 const LineRun* const Model::GetLines() const
77 return mVisualModel->mLines.Begin();
80 Length Model::GetNumberOfScripts() const
82 return mLogicalModel->mScriptRuns.Count();
85 const ScriptRun* const Model::GetScriptRuns() const
87 return mLogicalModel->mScriptRuns.Begin();
90 Length Model::GetNumberOfGlyphs() const
92 return mVisualModel->mGlyphs.Count();
95 const GlyphInfo* const Model::GetGlyphs() const
97 return mVisualModel->mGlyphs.Begin();
100 const Vector2* const Model::GetLayout() const
102 return mVisualModel->mGlyphPositions.Begin();
105 const Vector4* const Model::GetColors() const
107 return mVisualModel->mColors.Begin();
110 const ColorIndex* const Model::GetColorIndices() const
112 return mVisualModel->mColorIndices.Begin();
115 const Vector4* const Model::GetBackgroundColors() const
117 return mVisualModel->mBackgroundColors.Begin();
120 const ColorIndex* const Model::GetBackgroundColorIndices() const
122 return mVisualModel->mBackgroundColorIndices.Begin();
125 const Vector4& Model::GetDefaultColor() const
127 return mVisualModel->mTextColor;
130 const Vector2& Model::GetShadowOffset() const
132 return mVisualModel->mShadowOffset;
135 const Vector4& Model::GetShadowColor() const
137 return mVisualModel->mShadowColor;
140 const float& Model::GetShadowBlurRadius() const
142 return mVisualModel->mShadowBlurRadius;
145 const Vector4& Model::GetUnderlineColor() const
147 return mVisualModel->GetUnderlineColor();
150 bool Model::IsUnderlineEnabled() const
152 return mVisualModel->IsUnderlineEnabled();
155 float Model::GetUnderlineHeight() const
157 return mVisualModel->GetUnderlineHeight();
160 Length Model::GetNumberOfUnderlineRuns() const
162 return mVisualModel->GetNumberOfUnderlineRuns();
165 void Model::GetUnderlineRuns( GlyphRun* underlineRuns, UnderlineRunIndex index, Length numberOfRuns ) const
167 mVisualModel->GetUnderlineRuns( underlineRuns, index, numberOfRuns );
170 const Vector4& Model::GetOutlineColor() const
172 return mVisualModel->GetOutlineColor();
175 uint16_t Model::GetOutlineWidth() const
177 return mVisualModel->GetOutlineWidth();
180 const Vector4& Model::GetBackgroundColor() const
182 return mVisualModel->GetBackgroundColor();
185 bool Model::IsBackgroundEnabled() const
187 return mVisualModel->IsBackgroundEnabled();
194 mScrollPositionLast(),
195 mHorizontalAlignment( Text::HorizontalAlignment::BEGIN ),
196 mVerticalAlignment( Text::VerticalAlignment::TOP ),
197 mVerticalLineAlignment( DevelText::VerticalLineAlignment::TOP ),
198 mLineWrapMode( Text::LineWrap::WORD ),
199 mAlignmentOffset( 0.0f ),
200 mElideEnabled( false ),
201 mIgnoreSpacesAfterText( true ),
202 mMatchSystemLanguageDirection( false )
204 mLogicalModel = LogicalModel::New();
205 mVisualModel = VisualModel::New();
214 } // namespace Toolkit