2 * Copyright (c) 2015 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-view.h>
22 #include <dali/public-api/math/vector2.h>
35 VisualModelPtr mVisualModel;
41 mImpl = new View::Impl();
49 void View::SetVisualModel( VisualModelPtr visualModel )
51 mImpl->mVisualModel = visualModel;
54 Length View::GetNumberOfGlyphs() const
56 if( mImpl->mVisualModel )
58 VisualModel& model = *mImpl->mVisualModel;
60 Length glyphCount = model.GetNumberOfGlyphs();
61 Length positionCount = model.GetNumberOfGlyphPositions();
63 DALI_ASSERT_DEBUG( positionCount <= glyphCount && "Invalid glyph positions in Model" );
65 return (positionCount < glyphCount) ? positionCount : glyphCount;
71 void View::GetGlyphs( GlyphInfo* glyphs,
72 GlyphIndex glyphIndex,
73 Length numberOfGlyphs ) const
75 if( mImpl->mVisualModel )
77 mImpl->mVisualModel->GetGlyphs( glyphs, glyphIndex, numberOfGlyphs );
81 void View::GetGlyphPositions( Vector2* glyphPositions,
82 GlyphIndex glyphIndex,
83 Length numberOfGlyphs ) const
85 if( mImpl->mVisualModel )
87 mImpl->mVisualModel->GetGlyphPositions( glyphPositions, glyphIndex, numberOfGlyphs );
93 } // namespace Toolkit