From: Paul Wisbey Date: Thu, 29 Jan 2015 12:45:32 +0000 (+0000) Subject: Minimal Model/View implementation X-Git-Tag: new_text_0.1~62 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=96960a51eeead5ecfbfbb9d933b039ccfb1a41e9 Minimal Model/View implementation Change-Id: I2f86ec7cb6a3174c4ed70b3925f94c2501403141 --- diff --git a/base/dali-toolkit/public-api/file.list b/base/dali-toolkit/public-api/file.list index f6dae04..17885b5 100755 --- a/base/dali-toolkit/public-api/file.list +++ b/base/dali-toolkit/public-api/file.list @@ -39,6 +39,9 @@ public_api_base_src_files = \ $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-slide-effect.cpp \ $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-wobble-effect.cpp \ $(public_api_base_src_dir)/controls/table-view/table-view.cpp \ + $(public_api_base_src_dir)/text/logical-model.cpp \ + $(public_api_base_src_dir)/text/text-view.cpp \ + $(public_api_base_src_dir)/text/visual-model.cpp \ $(public_api_base_src_dir)/focus-manager/focus-manager.cpp \ $(public_api_base_src_dir)/focus-manager/keyboard-focus-manager.cpp \ $(public_api_base_src_dir)/focus-manager/keyinput-focus-manager.cpp \ @@ -112,6 +115,11 @@ public_api_base_scroll_view_header_files = \ public_api_base_table_view_header_files = \ $(public_api_base_src_dir)/controls/table-view/table-view.h +public_api_base_text_header_files = \ + $(public_api_base_src_dir)/text/logical-model.h \ + $(public_api_base_src_dir)/text/text-definitions.h \ + $(public_api_base_src_dir)/text/visual-model.h + public_api_base_focus_manager_header_files = \ $(public_api_base_src_dir)/focus-manager/keyinput-focus-manager.h \ $(public_api_base_src_dir)/focus-manager/focus-manager.h \ diff --git a/base/dali-toolkit/public-api/text/logical-model.cpp b/base/dali-toolkit/public-api/text/logical-model.cpp new file mode 100644 index 0000000..6343e90 --- /dev/null +++ b/base/dali-toolkit/public-api/text/logical-model.cpp @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2015 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// CLASS HEADER +#include + +// EXTERNAL INCLUDES +#include + +namespace Dali +{ + +namespace Toolkit +{ + +namespace Text +{ + +struct LogicalModel::Impl +{ + Vector mText; +}; + +LogicalModelPtr LogicalModel::New() +{ + return LogicalModelPtr( new LogicalModel() ); +} + +void LogicalModel::SetText( const Character* text, Length length ) +{ + Vector& modelText = mImpl->mText; + modelText.Resize( length ); + memcpy( &modelText[0], text, length*sizeof(Character) ); +} + +Length LogicalModel::GetNumberOfCharacters() const +{ + return mImpl->mText.Count(); +} + +void LogicalModel::GetText( CharacterIndex characterIndex, Character* text, Length numberOfCharacters ) const +{ + Vector& modelText = mImpl->mText; + memcpy( text, &modelText[characterIndex], numberOfCharacters*sizeof(Character) ); +} + +LogicalModel::~LogicalModel() +{ +} + +LogicalModel::LogicalModel() +: mImpl( NULL ) +{ + mImpl = new LogicalModel::Impl(); +} + +} // namespace Text + +} // namespace Toolkit + +} // namespace Dali diff --git a/base/dali-toolkit/public-api/text/logical-model.h b/base/dali-toolkit/public-api/text/logical-model.h new file mode 100644 index 0000000..f62e6b2 --- /dev/null +++ b/base/dali-toolkit/public-api/text/logical-model.h @@ -0,0 +1,118 @@ +#ifndef __DALI_TOOLKIT_TEXT_LOGICAL_MODEL_H__ +#define __DALI_TOOLKIT_TEXT_LOGICAL_MODEL_H__ + +/* + * Copyright (c) 2015 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +namespace Toolkit +{ + +namespace Text +{ + +class LogicalModel; +typedef IntrusivePtr LogicalModelPtr; + +/** + * @brief A logical text model contains layout independent information. + * + * This includes: + * - A series of UTF-32 characters in logical order + */ +class LogicalModel : public RefObject +{ +public: + + /** + * @brief Create a new instance of a LogicalModel. + * + * @return A pointer to a new LogicalModel. + */ + static LogicalModelPtr New(); + + // Text interface. + + /** + * @brief Replaces any text previously set. + * + * @param[in] text An array of UTF-32 characters. + * @param[in] length The length of the array. + */ + void SetText( const Character* text, + Length length ); + + /** + * @brief Retrieves the number of characters of the text. + * + * @return The number of characters. + */ + Length GetNumberOfCharacters() const; + + /** + * @brief Retrieves characters from the text in the given buffer. + * + * @pre The size of the @p text buffer needs to be big enough to copy the @p numberOfCharacters. + * @param[in] characterIndex The index to the first character to copy. + * @param[out] text Pointer to a buffer where the text is copied. + * @param[in] numberOfCharacters The number of characters to be copied. + */ + void GetText( CharacterIndex characterIndex, + Character* text, + Length numberOfCharacters ) const; + +protected: + + /** + * @brief A reference counted object may only be deleted by calling Unreference(). + */ + virtual ~LogicalModel(); + +private: + + /** + * @brief Private constructor. + */ + LogicalModel(); + + // Undefined + LogicalModel( const LogicalModel& handle ); + + // Undefined + LogicalModel& operator=( const LogicalModel& handle ); + +private: + + struct Impl; + Impl* mImpl; +}; + +} // namespace Text + +} // namespace Toolkit + +} // namespace Dali + +#endif // __DALI_TOOLKIT_TEXT_LOGICAL_MODEL_H__ diff --git a/base/dali-toolkit/public-api/text/text-definitions.h b/base/dali-toolkit/public-api/text/text-definitions.h new file mode 100644 index 0000000..55510d8 --- /dev/null +++ b/base/dali-toolkit/public-api/text/text-definitions.h @@ -0,0 +1,50 @@ +#ifndef __DALI_TEXT_ABSTRACTION_TEXT_TYPE_DEFINITIONS_H__ +#define __DALI_TEXT_ABSTRACTION_TEXT_TYPE_DEFINITIONS_H__ + +/* + * Copyright (c) 2015 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include + +namespace Dali +{ + +namespace Toolkit +{ + +namespace Text +{ + +typedef TextAbstraction::FontId FontId; ///< The unique identifier for a font face (generated by FontClient) +typedef TextAbstraction::PointSize26Dot6 PointSize26Dot6; ///< The point size in 26.6 fractional points +typedef TextAbstraction::FaceIndex FaceIndex; ///< Used with fonts which allow several font faces +typedef TextAbstraction::GlyphIndex GlyphIndex; ///< Uniquely identifies a glyph within a particular font +typedef TextAbstraction::Character Character; ///< A UTF-32 representation of a character +typedef TextAbstraction::GlyphInfo GlyphInfo; ///< The information describing a glyph (font ID, index, metrics) + +typedef uint32_t CharacterIndex; ///< An index into an array of characters +typedef uint32_t GlyphIndex; ///< An index into an array of glyphs +typedef uint32_t Length; ///< The length of an array + +} // namespace Text + +} // namespace Toolkit + +} // namespace Dali + +#endif // __DALI_TEXT_ABSTRACTION_TEXT_TYPE_DEFINITIONS_H__ diff --git a/base/dali-toolkit/public-api/text/text-view-interface.h b/base/dali-toolkit/public-api/text/text-view-interface.h new file mode 100644 index 0000000..a440209 --- /dev/null +++ b/base/dali-toolkit/public-api/text/text-view-interface.h @@ -0,0 +1,95 @@ +#ifndef __DALI_TOOLKIT_TEXT_VIEW_INTERFACE_H__ +#define __DALI_TOOLKIT_TEXT_VIEW_INTERFACE_H__ + +/* + * Copyright (c) 2015 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +struct Vector2; + +namespace Toolkit +{ + +namespace Text +{ + +/** + * @brief Abstract interface to provide the information necessary displaying text. + * + * This includes: + * - The font & glyph IDs needed to get bitmaps etc. from TextAbstraction + * - The visual position of each glyph within the layout + * - A window into the text layout e.g. which page of a document to view + */ +class ViewInterface +{ +public: + + /** + * @brief Constructor. + */ + ViewInterface(); + + /** + * @brief Virtual destructor + */ + virtual ~ViewInterface(); + + /** + * Retrieves the number of glyphs. + * + * @return The number of glyphs. + */ + virtual Length GetNumberOfGlyphs() const = 0; + + /** + * @brief Retrieves glyphs in the given buffer. + * + * The size of the @p glyphs buffer needs to be big enough to copy the @p numberOfGlyphs. + * @param[out] glyphs Pointer to a buffer where the glyphs are copied. + * @param[in] glyphIndex Index to the first glyph. + * @param[in] numberOfGlyphs Number of glyphs to be copied. + */ + virtual void GetGlyphs( GlyphIndex glyphIndex, + GlyphInfo* glyphs, + Length numberOfGlyphs ) const = 0; + + /** + * @brief Retrieves the glyph positions. + * + * @pre The size of the @p positions buffer needs to be big enough to copy the @p numberOfGlyphs positions. + * @param[in] glyphIndex Index to the first glyph position. + * @param[out] glyphPositions Pointer to a buffer where the glyph positions are copied. + * @param[in] numberOfGlyphs The number of positions to be copied. + */ + virtual void GetGlyphPositions( GlyphIndex glyphIndex, + Vector2* glyphPositions, + Length numberOfGlyphs ) const = 0; +}; + +} // namespace Text + +} // namespace Toolkit + +} // namespace Dali + +#endif // __DALI_TOOLKIT_TEXT_VIEW_INTERFACE_H__ diff --git a/base/dali-toolkit/public-api/text/text-view.cpp b/base/dali-toolkit/public-api/text/text-view.cpp new file mode 100644 index 0000000..b91fce5 --- /dev/null +++ b/base/dali-toolkit/public-api/text/text-view.cpp @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2015 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// CLASS HEADER +#include + +// EXTERNAL INCLUDES +#include + +namespace Dali +{ + +namespace Toolkit +{ + +namespace Text +{ + +struct View::Impl +{ + VisualModelPtr mVisualModel; +}; + +ViewPtr View::New() +{ + return ViewPtr( new View() ); +} + +void View::SetVisualModel( VisualModelPtr visualModel ) +{ + mImpl->mVisualModel = visualModel; +} + +Length View::GetNumberOfGlyphs() const +{ + if( mImpl->mVisualModel ) + { + return mImpl->mVisualModel->GetNumberOfGlyphs(); + } + + return 0; +} + +void View::GetGlyphs( GlyphIndex glyphIndex, + GlyphInfo* glyphs, + Length numberOfGlyphs ) const +{ + if( mImpl->mVisualModel ) + { + mImpl->mVisualModel->GetGlyphs( glyphIndex, glyphs, numberOfGlyphs ); + } +} + +void View::GetGlyphPositions( GlyphIndex glyphIndex, + Vector2* glyphPositions, + Length numberOfGlyphs ) const +{ + if( mImpl->mVisualModel ) + { + mImpl->mVisualModel->GetGlyphPositions( glyphIndex, glyphPositions, numberOfGlyphs ); + } +} + +View::~View() +{ +} + +View::View() +: mImpl( NULL ) +{ + mImpl = new View::Impl(); +} + +} // namespace Text + +} // namespace Toolkit + +} // namespace Dali diff --git a/base/dali-toolkit/public-api/text/text-view.h b/base/dali-toolkit/public-api/text/text-view.h new file mode 100644 index 0000000..35f52d1 --- /dev/null +++ b/base/dali-toolkit/public-api/text/text-view.h @@ -0,0 +1,114 @@ +#ifndef __DALI_TOOLKIT_TEXT_VIEW_H__ +#define __DALI_TOOLKIT_TEXT_VIEW_H__ + +/* + * Copyright (c) 2015 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include +#include + +namespace Dali +{ + +struct Vector2; + +namespace Toolkit +{ + +namespace Text +{ + +class View; +typedef IntrusivePtr ViewPtr; + +/** + * @brief View provides an interface between the Text layout engine and rendering back-end. + */ +class View : public RefObject, public ViewInterface +{ +public: + + /** + * @brief Create a new instance of a View. + * + * @return A pointer to a new View. + */ + static ViewPtr New(); + + /** + * @brief Set the visual model. + * + * @param[in] visualModel The visual model used by the View. + */ + void SetVisualModel( VisualModelPtr visualModel ); + + /** + * @copydoc Dali::Toolkit::Text::ViewInterface::GetNumberOfGlyphs() + */ + virtual Length GetNumberOfGlyphs() const; + + /** + * @copydoc Dali::Toolkit::Text::ViewInterface::GetGlyphs() + */ + virtual void GetGlyphs( GlyphIndex glyphIndex, + GlyphInfo* glyphs, + Length numberOfGlyphs ) const; + + /** + * @copydoc Dali::Toolkit::Text::ViewInterface::GetGlyphPositions() + */ + virtual void GetGlyphPositions( GlyphIndex glyphIndex, + Vector2* glyphPositions, + Length numberOfGlyphs ) const; + +protected: + + /** + * @brief A reference counted object may only be deleted by calling Unreference(). + */ + virtual ~View(); + +private: + + /** + * @brief Private constructor. + */ + View(); + + // Undefined + View( const View& handle ); + + // Undefined + View& operator=( const View& handle ); + +private: + + struct Impl; + Impl* mImpl; +}; +} // namespace Text + +} // namespace Toolkit + +} // namespace Dali + +#endif // __DALI_TOOLKIT_TEXT_VIEW_H__ diff --git a/base/dali-toolkit/public-api/text/visual-model.cpp b/base/dali-toolkit/public-api/text/visual-model.cpp new file mode 100644 index 0000000..27ae89e --- /dev/null +++ b/base/dali-toolkit/public-api/text/visual-model.cpp @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2015 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// CLASS HEADER +#include + +// EXTERNAL INCLUDES +#include +#include +#include + +namespace Dali +{ + +namespace Toolkit +{ + +namespace Text +{ + +struct VisualModel::Impl +{ + Vector mGlyphs; + Vector mGlyphsToCharacters; + Vector mCharactersPerGlyph; + std::vector mGlyphPositions; +}; + +VisualModelPtr VisualModel::New() +{ + return VisualModelPtr( new VisualModel() ); +} + +void VisualModel::SetGlyphs( const GlyphInfo* glyphs, + const CharacterIndex* characterIndices, + const Length* charactersPerGlyph, + Length numberOfGlyphs ) +{ + Vector& modelGlyphs = mImpl->mGlyphs; + modelGlyphs.Resize( numberOfGlyphs ); + memcpy( &modelGlyphs[0], glyphs, numberOfGlyphs*sizeof(GlyphInfo) ); + + Vector& glyphsToCharacters = mImpl->mGlyphsToCharacters; + glyphsToCharacters.Resize( numberOfGlyphs ); + memcpy( &glyphsToCharacters[0], characterIndices, numberOfGlyphs*sizeof(CharacterIndex) ); + + Vector& modelCharactersPerGlyph = mImpl->mCharactersPerGlyph; + modelCharactersPerGlyph.Resize( numberOfGlyphs ); + memcpy( &modelCharactersPerGlyph[0], charactersPerGlyph, numberOfGlyphs*sizeof(Length) ); +} + +Length VisualModel::GetNumberOfGlyphs() const +{ + return mImpl->mGlyphs.Count(); +} + +void VisualModel::GetGlyphs( GlyphIndex glyphIndex, + GlyphInfo* glyphs, + Length numberOfGlyphs ) const +{ + Vector& modelGlyphs = mImpl->mGlyphs; + memcpy( glyphs, &modelGlyphs[glyphIndex], numberOfGlyphs*sizeof(GlyphInfo) ); +} + +CharacterIndex VisualModel::GetCharacterIndex( GlyphIndex glyphIndex ) const +{ + return mImpl->mGlyphsToCharacters[glyphIndex]; +} + +Length VisualModel::GetCharactersPerGlyph( GlyphIndex glyphIndex ) const +{ + return mImpl->mCharactersPerGlyph[glyphIndex]; +} + +GlyphIndex VisualModel::GetGlyphIndex( CharacterIndex characterIndex ) const +{ + GlyphIndex index( 0 ); + + for( unsigned int i=0; imGlyphsToCharacters.Count(); ++i ) + { + if( mImpl->mGlyphsToCharacters[i] == characterIndex ) + { + index = i; + break; + } + } + + return index; +} + +void VisualModel::SetGlyphPositions( const Vector2* glyphPositions, + Length numberOfGlyphs ) +{ + std::vector& modelPositions = mImpl->mGlyphPositions; + modelPositions.resize( numberOfGlyphs ); + memcpy( &modelPositions[0], glyphPositions, numberOfGlyphs*sizeof(Vector2) ); +} + +void VisualModel::GetGlyphPositions( GlyphIndex glyphIndex, + Vector2* glyphPositions, + Length numberOfGlyphs ) const +{ + std::vector& modelPositions = mImpl->mGlyphPositions; + memcpy( glyphPositions, &modelPositions[0], numberOfGlyphs*sizeof(Vector2) ); +} + +VisualModel::~VisualModel() +{ +} + +VisualModel::VisualModel() +: mImpl( NULL ) +{ + mImpl = new VisualModel::Impl(); +} + +} // namespace Text + +} // namespace Toolkit + +} // namespace Dali diff --git a/base/dali-toolkit/public-api/text/visual-model.h b/base/dali-toolkit/public-api/text/visual-model.h new file mode 100644 index 0000000..406eb21 --- /dev/null +++ b/base/dali-toolkit/public-api/text/visual-model.h @@ -0,0 +1,177 @@ +#ifndef __DALI_TOOLKIT_TEXT_VISUAL_MODEL_H__ +#define __DALI_TOOLKIT_TEXT_VISUAL_MODEL_H__ + +/* + * Copyright (c) 2015 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +struct Vector2; + +namespace Toolkit +{ + +namespace Text +{ + +class VisualModel; +typedef IntrusivePtr VisualModelPtr; + +/** + * @brief A visual text model contains layout specific information. + * + * This includes: + * - A series of glyphs in visual order i.e. after the bidirectional reordering. + * - The position of each glyph within a 2D bounding box. + */ +class VisualModel : public RefObject +{ +public: + + /** + * @brief Create a new instance of a VisualModel. + * + * @return A pointer to a new VisualModel. + */ + static VisualModelPtr New(); + + // Glyph interface. + + /** + * @brief Replaces any glyphs previously set. + * + * @param[in] glyphs An array of glyphs in the visual order. + * @param[in] characterIndices An array containing the first character in the logical model that each glyph relates to. + * @param[in] charactersPerGlyph An array of containing the number of characters per glyph. + * @param[in] numberOfGlyphs The number of glyphs. + */ + void SetGlyphs( const GlyphInfo* glyphs, + const CharacterIndex* characterIndices, + const Length* charactersPerGlyph, + Length numberOfGlyphs ); + + /** + * Retrieves the number of glyphs. + * + * @return The number of glyphs. + */ + Length GetNumberOfGlyphs() const; + + /** + * @brief Retrieves glyphs in the given buffer. + * + * The size of the @p glyphs buffer needs to be big enough to copy the @p numberOfGlyphs. + * @param[out] glyphs Pointer to a buffer where the glyphs are copied. + * @param[in] glyphIndex Index to the first glyph. + * @param[in] numberOfGlyphs Number of glyphs to be copied. + */ + void GetGlyphs( GlyphIndex glyphIndex, + GlyphInfo* glyphs, + Length numberOfGlyphs ) const; + + // Character <--> Glyph conversion + + /** + * @brief Retrieves the first character in the logical model which a glyph represents. + * + * @note After shaping several characters may be represented by the same glyph. + * Alternatively several glyphs may be required to display a character. + * @param[in] glyphIndex The glyph index. + * @return The character index. + */ + CharacterIndex GetCharacterIndex( GlyphIndex glyphIndex ) const; + + /** + * @brief Query the number of characters the glyph represents. + * + * @param[in] glyphIndex The glyph index. + * @return The number of characters represented by the glyph. + */ + Length GetCharactersPerGlyph( GlyphIndex glyphIndex ) const; + + /** + * Retrieves the first glyph in the visual model which represents a given character. + * + * @note After shaping several characters may be represented by the same glyph. + * Alternatively several glyphs may be required to display a character. + * @param[in] characterIndex The character index. + * @return The glyph index. + */ + GlyphIndex GetGlyphIndex( CharacterIndex characterIndex ) const; + + // Position interface + + /** + * @brief Replaces any glyph positions previously set. + * + * @param[in] glyphPositions An array of visual positions for each glyph. + * @param[in] numberOfGlyphs The number of positions. + */ + void SetGlyphPositions( const Vector2* glyphPositions, + Length numberOfGlyphs ); + + /** + * @brief Retrieves the glyph positions. + * + * @pre The size of the @p positions buffer needs to be big enough to copy the @p numberOfGlyphs positions. + * @param[in] glyphIndex Index to the first glyph position. + * @param[out] glyphPositions Pointer to a buffer where the glyph positions are copied. + * @param[in] numberOfGlyphs The number of positions to be copied. + */ + void GetGlyphPositions( GlyphIndex glyphIndex, + Vector2* glyphPositions, + Length numberOfGlyphs ) const; + +protected: + + /** + * @brief A reference counted object may only be deleted by calling Unreference(). + */ + virtual ~VisualModel(); + +private: + + /** + * @brief Private constructor. + */ + VisualModel(); + + // Undefined + VisualModel( const VisualModel& handle ); + + // Undefined + VisualModel& operator=( const VisualModel& handle ); + +private: + + struct Impl; + Impl* mImpl; +}; +} // namespace Text + +} // namespace Toolkit + +} // namespace Dali + +#endif // __DALI_TOOLKIT_TEXT_VISUAL_MODEL_H__ diff --git a/build/tizen/dali-toolkit/Makefile.am b/build/tizen/dali-toolkit/Makefile.am index 86111b2..6f9a202 100644 --- a/build/tizen/dali-toolkit/Makefile.am +++ b/build/tizen/dali-toolkit/Makefile.am @@ -114,8 +114,7 @@ publicapibasescrollcomponentdir = $(publicapibasedir)/controls/scroll-component publicapibasescrollabledir = $(publicapibasedir)/controls/scrollable publicapibasescrollviewdir = $(publicapibasedir)/controls/scrollable/scroll-view publicapibasetableviewdir = $(publicapibasedir)/controls/table-view -publicapibasetextviewdir = $(publicapibasedir)/controls/text-view -publicapibasetextinputdir = $(publicapibasedir)/controls/text-input +publicapibasetextdir = $(publicapibasedir)/text publicapibasefactorydir = $(publicapibasedir)/factory publicapibasefocusmanagerdir = $(publicapibasedir)/focus-manager publicapibasemarkupprocessordir = $(publicapibasedir)/markup-processor @@ -135,8 +134,7 @@ publicapibasescrollcomponent_HEADERS = $(public_api_base_scroll_component_header publicapibasescrollable_HEADERS = $(public_api_base_scrollable_header_files) publicapibasescrollview_HEADERS = $(public_api_base_scroll_view_header_files) publicapibasetableview_HEADERS = $(public_api_base_table_view_header_files) -publicapibasetextview_HEADERS = $(public_api_base_text_view_header_files) -publicapibasetextinput_HEADERS = $(public_api_base_text_input_header_files) +publicapibasetext_HEADERS = $(public_api_base_text_header_files) publicapibasefocusmanager_HEADERS = $(public_api_base_focus_manager_header_files) publicapibasemarkupprocessor_HEADERS = $(public_api_base_markup_processor_header_files) publicapibaseshadereffects_HEADERS = $(public_api_base_shader_effects_header_files) diff --git a/optional/dali-toolkit/dali-toolkit.h b/optional/dali-toolkit/dali-toolkit.h index 0e3f0a4..63c2598 100644 --- a/optional/dali-toolkit/dali-toolkit.h +++ b/optional/dali-toolkit/dali-toolkit.h @@ -59,6 +59,11 @@ #include #include #include +#include +#include +#include +#include +#include // INTERNAL INCLUDES