From: Victor Cebollada Date: Mon, 22 Jun 2015 07:46:38 +0000 (+0100) Subject: Text logical and visual models. Remove unused/unwanted code. X-Git-Tag: dali_1.0.46~9 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=24ab5420ad958de9ba345b504de62881162c754b Text logical and visual models. Remove unused/unwanted code. Change-Id: Iee86400a173278fbeed48783b019b2d359c845fe Signed-off-by: Victor Cebollada --- diff --git a/dali-toolkit/internal/text/logical-model-impl.cpp b/dali-toolkit/internal/text/logical-model-impl.cpp index 2faca97..7dbe628 100644 --- a/dali-toolkit/internal/text/logical-model-impl.cpp +++ b/dali-toolkit/internal/text/logical-model-impl.cpp @@ -35,112 +35,6 @@ LogicalModelPtr LogicalModel::New() return LogicalModelPtr( new LogicalModel() ); } -void LogicalModel::SetText( const Character* const text, - Length numberOfCharacters ) -{ - if( 0u == numberOfCharacters ) - { - mText.Clear(); - } - else - { - mText.Resize( numberOfCharacters ); - memcpy( mText.Begin(), text, numberOfCharacters * sizeof( Character ) ); - } -} - -Length LogicalModel::GetNumberOfCharacters() const -{ - return mText.Count(); -} - -void LogicalModel::GetText( Character* text, - CharacterIndex characterIndex, - Length numberOfCharacters ) const -{ - memcpy( text, mText.Begin() + characterIndex, numberOfCharacters * sizeof( Character ) ); -} - -Character LogicalModel::GetCharacter( CharacterIndex characterIndex ) const -{ - return mText[characterIndex]; -} - -void LogicalModel::ReplaceText( CharacterIndex characterIndex, - Length numberOfCharactersToRemove, - const Character* const text, - Length numberOfCharactersToInsert ) -{ -} - -void LogicalModel::SetScripts( const ScriptRun* const scripts, - Length numberOfRuns ) -{ - if( 0u == numberOfRuns ) - { - mScriptRuns.Clear(); - } - else - { - mScriptRuns.Resize( numberOfRuns ); - memcpy( mScriptRuns.Begin(), scripts, numberOfRuns * sizeof( ScriptRun ) ); - } -} - -void LogicalModel::GetNumberOfScriptRuns( CharacterIndex characterIndex, - Length numberOfCharacters, - ScriptRunIndex& firstScriptRun, - Length& numberOfScriptRuns ) const -{ - // Initialize the number of scripts and the index to the first script. - firstScriptRun = 0u; - numberOfScriptRuns = 0; - bool firstScriptFound = false; - - const CharacterIndex lastCharacterIndex = characterIndex + numberOfCharacters; - - // Traverse the scripts and count those scripts within the range of characters. - for( Vector::ConstIterator it = mScriptRuns.Begin(), - endIt = mScriptRuns.End(); - it != endIt; - ++it ) - { - const ScriptRun& script = *it; - - if( ( script.characterRun.characterIndex + script.characterRun.numberOfCharacters > characterIndex ) && - ( lastCharacterIndex > script.characterRun.characterIndex ) ) - { - firstScriptFound = true; - ++numberOfScriptRuns; - } - else if( lastCharacterIndex <= script.characterRun.characterIndex ) - { - // nothing else to do. - break; - } - - if( !firstScriptFound ) - { - ++firstScriptRun; - } - } -} - -void LogicalModel::GetScriptRuns( ScriptRun* scriptRuns, - CharacterIndex characterIndex, - Length numberOfCharacters ) const -{ - ScriptRunIndex firstScriptRun = 0u; - Length numberOfScriptRuns = 0u; - - GetNumberOfScriptRuns( characterIndex, - numberOfCharacters, - firstScriptRun, - numberOfScriptRuns ); - - memcpy( scriptRuns, mScriptRuns.Begin() + firstScriptRun, numberOfScriptRuns * sizeof( ScriptRun ) ); -} - Script LogicalModel::GetScript( CharacterIndex characterIndex ) const { // If this operation is too slow, consider a binary search. @@ -159,265 +53,6 @@ Script LogicalModel::GetScript( CharacterIndex characterIndex ) const return TextAbstraction::UNKNOWN; } -void LogicalModel::ReplaceScripts( CharacterIndex characterIndex, - Length numberOfCharactersToRemove, - const ScriptRun* const scriptRuns, - Length numberOfCharactersToInsert ) -{ -} - -void LogicalModel::SetFonts( const FontRun* const fonts, - Length numberOfRuns ) -{ - if( 0u == numberOfRuns ) - { - mFontRuns.Clear(); - } - else - { - mFontRuns.Resize( numberOfRuns ); - memcpy( mFontRuns.Begin(), fonts, numberOfRuns * sizeof( FontRun ) ); - } -} - -void LogicalModel::GetNumberOfFontRuns( CharacterIndex characterIndex, - Length numberOfCharacters, - FontRunIndex& firstFontRun, - Length& numberOfFontRuns ) const -{ - // Initialize the number of fonts and the index to the first font. - firstFontRun = 0u; - numberOfFontRuns = 0; - bool firstFontFound = false; - - const CharacterIndex lastCharacterIndex = characterIndex + numberOfCharacters; - - // Traverse the fonts and count those fonts within the range of characters. - for( Vector::ConstIterator it = mFontRuns.Begin(), - endIt = mFontRuns.End(); - it != endIt; - ++it ) - { - const FontRun& font = *it; - - if( ( font.characterRun.characterIndex + font.characterRun.numberOfCharacters > characterIndex ) && - ( characterIndex + numberOfCharacters > font.characterRun.characterIndex ) ) - { - firstFontFound = true; - ++numberOfFontRuns; - } - else if( lastCharacterIndex <= font.characterRun.characterIndex ) - { - // nothing else to do. - break; - } - - if( !firstFontFound ) - { - ++firstFontRun; - } - } -} - -void LogicalModel::GetFontRuns( FontRun* fontRuns, - CharacterIndex characterIndex, - Length numberOfCharacters ) const -{ - FontRunIndex firstFontRun = 0u; - Length numberOfFontRuns = 0u; - - GetNumberOfFontRuns( characterIndex, - numberOfCharacters, - firstFontRun, - numberOfFontRuns ); - - memcpy( fontRuns, mFontRuns.Begin() + firstFontRun, numberOfFontRuns * sizeof( FontRun ) ); -} - -FontId LogicalModel::GetFont( CharacterIndex characterIndex ) const -{ - for( Length index = 0u, length = mFontRuns.Count(); index < length; ++index ) - { - const FontRun* const fontRun = mFontRuns.Begin() + index; - - if( ( fontRun->characterRun.characterIndex <= characterIndex ) && - ( characterIndex < fontRun->characterRun.characterIndex + fontRun->characterRun.numberOfCharacters ) ) - { - return fontRun->fontId; - } - } - - return 0u; -} - -void LogicalModel::ReplaceFonts( CharacterIndex characterIndex, - Length numberOfCharactersToRemove, - const FontRun* const fontRuns, - Length numberOfCharactersToInsert ) -{ -} - -void LogicalModel::SetLineBreakInfo( const LineBreakInfo* const lineBreakInfo, - Length length ) -{ - if( 0u == length ) - { - mLineBreakInfo.Clear(); - } - else - { - mLineBreakInfo.Resize( length ); - memcpy( mLineBreakInfo.Begin(), lineBreakInfo, length * sizeof( LineBreakInfo ) ); - } -} - -void LogicalModel::GetLineBreakInfo( LineBreakInfo* lineBreakInfo, - CharacterIndex characterIndex, - Length numberOfItems ) const -{ - memcpy( lineBreakInfo, mLineBreakInfo.Begin() + characterIndex, numberOfItems * sizeof( LineBreakInfo ) ); -} - -LineBreakInfo LogicalModel::GetLineBreakInfo( CharacterIndex characterIndex ) const -{ - return *( mLineBreakInfo.Begin() + characterIndex ); -} - -void LogicalModel::ReplaceLineBreakInfo( CharacterIndex characterIndex, - Length numberOfItemsToRemove, - const LineBreakInfo* const lineBreakInfo, - Length numberOfItemsToInsert ) -{ -} - -void LogicalModel::SetWordBreakInfo( const WordBreakInfo* const wordBreakInfo, - Length length ) -{ - if( 0u == length ) - { - mWordBreakInfo.Clear(); - } - else - { - mWordBreakInfo.Resize( length ); - memcpy( mWordBreakInfo.Begin(), wordBreakInfo, length * sizeof( WordBreakInfo ) ); - } -} - -void LogicalModel::GetWordBreakInfo( WordBreakInfo* wordBreakInfo, - CharacterIndex characterIndex, - Length numberOfItems ) const -{ - memcpy( wordBreakInfo, mWordBreakInfo.Begin() + characterIndex, numberOfItems * sizeof( WordBreakInfo ) ); -} - -WordBreakInfo LogicalModel::GetWordBreakInfo( CharacterIndex characterIndex ) const -{ - return *( mWordBreakInfo.Begin() + characterIndex ); -} - -void LogicalModel::ReplaceWordBreakInfo( CharacterIndex characterIndex, - Length numberOfItemsToRemove, - const WordBreakInfo* const wordBreakInfo, - Length numberOfItemsToInsert ) -{ -} - -void LogicalModel::SetBidirectionalInfo( const BidirectionalParagraphInfoRun* const bidirectionalInfo, - Length numberOfRuns ) -{ - if( 0u == numberOfRuns ) - { - mBidirectionalParagraphInfo.Clear(); - } - else - { - mBidirectionalParagraphInfo.Resize( numberOfRuns ); - memcpy( mBidirectionalParagraphInfo.Begin(), bidirectionalInfo, numberOfRuns * sizeof( BidirectionalParagraphInfoRun ) ); - } -} - -void LogicalModel::GetNumberOfBidirectionalInfoRuns( CharacterIndex characterIndex, - Length numberOfCharacters, - BidirectionalRunIndex& firstBidirectionalRun, - Length& numberOfFontRuns ) const -{ - // Initialize the number of bidi paragraphs and the index to the first paragraph. - firstBidirectionalRun = 0u; - numberOfFontRuns = 0; - bool firstParagraphFound = false; - - // Traverse the bidirectional paragraph info and count those bidi paragraphs within the range of characters. - for( Vector::ConstIterator it = mBidirectionalParagraphInfo.Begin(), - endIt = mBidirectionalParagraphInfo.End(); - it != endIt; - ++it ) - { - const BidirectionalParagraphInfoRun& bidi = *it; - - if( ( bidi.characterRun.characterIndex + bidi.characterRun.numberOfCharacters > characterIndex ) && - ( characterIndex + numberOfCharacters > bidi.characterRun.characterIndex ) ) - { - firstParagraphFound = true; - ++numberOfFontRuns; - } - - if( !firstParagraphFound ) - { - ++firstBidirectionalRun; - } - } -} - -void LogicalModel::GetBidirectionalInfo( BidirectionalParagraphInfoRun* bidirectionalInfo, - CharacterIndex characterIndex, - Length numberOfCharacters ) const -{ - BidirectionalRunIndex firstBidirectionalRun = 0u; - Length numberOfFontRuns = 0u; - - GetNumberOfBidirectionalInfoRuns( characterIndex, - numberOfCharacters, - firstBidirectionalRun, - numberOfFontRuns ); - - memcpy( bidirectionalInfo, mBidirectionalParagraphInfo.Begin() + firstBidirectionalRun, numberOfFontRuns * sizeof( BidirectionalParagraphInfoRun ) ); -} - -void ReplaceBidirectionalInfo( CharacterIndex characterIndex, - Length numberOfCharactersToRemove, - const BidirectionalParagraphInfoRun* const bidirectionalInfo, - Length numberOfCharactersToInsert ) -{ -} - -void LogicalModel::SetCharacterDirections( const CharacterDirection* const directions, - Length numberOfCharacters ) -{ - if( 0u == numberOfCharacters ) - { - mCharacterDirections.Clear(); - } - else - { - mCharacterDirections.Resize( numberOfCharacters ); - memcpy( mCharacterDirections.Begin(), directions, numberOfCharacters * sizeof( CharacterDirection ) ); - } -} - -void LogicalModel::GetCharacterDirections( CharacterDirection* directions, - CharacterIndex characterIndex, - Length numberOfCharacters ) const -{ - if( 0u == mCharacterDirections.Count() ) - { - // Nothing to retrieve if the model has no right to left characters. - return; - } - - memcpy( directions, mCharacterDirections.Begin() + characterIndex, numberOfCharacters * sizeof( CharacterDirection ) ); -} - CharacterDirection LogicalModel::GetCharacterDirection( CharacterIndex characterIndex ) const { if( characterIndex >= mCharacterDirections.Count() ) @@ -597,25 +232,6 @@ void LogicalModel::SetVisualToLogicalMap( const BidirectionalLineInfoRun* const } } -void LogicalModel::ReplaceVisualToLogicalMap( CharacterIndex characterIndex, - Length numberOfCharactersToRemove, - const BidirectionalLineInfoRun* const bidirectionalInfo, - Length numberOfCharactersToInsert ) -{ -} - -CharacterIndex LogicalModel::GetVisualCharacterIndex( CharacterIndex logicalCharacterIndex ) const -{ - if( 0u == mLogicalToVisualMap.Count() ) - { - // If there is no logical to visual info is because the whole text is left to right. - // Return the identity. - return logicalCharacterIndex; - } - - return *( mLogicalToVisualMap.Begin() + logicalCharacterIndex ); -} - CharacterIndex LogicalModel::GetLogicalCharacterIndex( CharacterIndex visualCharacterIndex ) const { if( 0u == mVisualToLogicalMap.Count() ) @@ -628,20 +244,6 @@ CharacterIndex LogicalModel::GetLogicalCharacterIndex( CharacterIndex visualChar return *( mVisualToLogicalMap.Begin() + visualCharacterIndex ); } -void LogicalModel::GetLogicalToVisualMap( CharacterIndex* logicalToVisualMap, - CharacterIndex characterIndex, - Length numberOfCharacters ) const -{ - memcpy( logicalToVisualMap, mLogicalToVisualMap.Begin() + characterIndex, numberOfCharacters * sizeof( CharacterIndex ) ); -} - -void LogicalModel::GetVisualToLogicalMap( CharacterIndex* visualToLogicalMap, - CharacterIndex characterIndex, - Length numberOfCharacters ) const -{ - memcpy( visualToLogicalMap, mVisualToLogicalMap.Begin() + characterIndex, numberOfCharacters * sizeof( CharacterIndex ) ); -} - LogicalModel::~LogicalModel() { } diff --git a/dali-toolkit/internal/text/logical-model-impl.h b/dali-toolkit/internal/text/logical-model-impl.h index 73d9230..269247f 100644 --- a/dali-toolkit/internal/text/logical-model-impl.h +++ b/dali-toolkit/internal/text/logical-model-impl.h @@ -62,110 +62,9 @@ public: */ static LogicalModelPtr New(); - // Text interface. - - /** - * @brief Replaces any text previously set. - * - * @note If the number of characters is zero the text buffer is cleared. - * - * @param[in] text An array of UTF-32 characters. - * @param[in] numberOfCharacters The length of the array. - */ - void SetText( const Character* const text, - Length numberOfCharacters ); - - /** - * @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[out] text Pointer to a buffer where the text is copied. - * @param[in] characterIndex The index to the first character to copy. - * @param[in] numberOfCharacters The number of characters to be copied. - */ - void GetText( Character* text, - CharacterIndex characterIndex, - Length numberOfCharacters ) const; - - /** - * @brief Retrieves a character. - * - * @param[in] characterIndex Index to a character. - * - * @return A character. - */ - Character GetCharacter( CharacterIndex characterIndex ) const; - - /** - * @brief Replaces characters from the text. - * - * If the @p numberOfCharactersToRemove is zero, this operation is like an insert. - * If the @p numberOfCharactersToInsert is zero, this operation is like a remove. - * - * @param[in] characterIndex Where to replace the text. - * @param[in] numberOfCharactersToRemove The number of characters to be removed. - * @param[in] text Pointer to a buffer with the text encoded in utf32. - * @param[in] numberOfCharactersToInsert The number of characters in the buffer. - */ - void ReplaceText( CharacterIndex characterIndex, - Length numberOfCharactersToRemove, - const Character* const text, - Length numberOfCharactersToInsert ); - // Language support interface. /** - * @brief Sets the script runs. - * - * Replaces any scripts previously set. - * - * A run is a group of consecutive characters. A script run contains the script for a run. - * - * @note If the number of runs is zero the script buffer is cleared. - * - * @param[in] scripts Pointer to a buffer with all the script runs. - * @param[in] numberOfRuns The number of script runs. - */ - void SetScripts( const ScriptRun* const scripts, - Length numberOfRuns ); - - /** - * @brief Retrieves the number of script runs and the index to the first one for the given range of characters. - * - * A run is a group of consecutive characters. A script run contains the script for a run. - * - * @param[in] characterIndex Index to the first character. - * @param[in] numberOfCharacters The number of characters. - * @param[out] firstScriptRun Index to the script run containing the character index. - * @param[out] numberOfScriptRuns The number of script runs. - */ - void GetNumberOfScriptRuns( CharacterIndex characterIndex, - Length numberOfCharacters, - ScriptRunIndex& firstScriptRun, - Length& numberOfScriptRuns ) const; - - /** - * @brief Retrieves the script runs for the given range of characters. - * - * The @p scriptRuns buffer needs to be big enough to copy the number of script runs. - * Call GetNumberOfScriptRuns() to retrieve the number of script runs. - * - * @param[out] scriptRuns Pointer to a buffer where the script runs are copied. - * @param[in] characterIndex Index to the first character. - * @param[in] numberOfCharacters The number of characters. - */ - void GetScriptRuns( ScriptRun* scriptRuns, - CharacterIndex characterIndex, - Length numberOfCharacters ) const; - - /** * @brief Retrieves the script for the given character index. * * @param[in] characterIndex Index to the character. @@ -174,322 +73,9 @@ public: */ Script GetScript( CharacterIndex characterIndex ) const; - /** - * @brief Replaces script runs for the given range of characters. - * - * If the @p numberOfCharactersToRemove is zero, this operation is like an insert. - * If the @p numberOfCharactersToInsert is zero, this operation is like a remove. - * - * @param[in] characterIndex Index of the first character where to replace the scripts. - * @param[in] numberOfCharactersToRemove The number of characters to be the script removed. - * @param[in] scriptRuns Pointer to a buffer with the script runs. - * @param[in] numberOfCharactersToInsert The number of characters to be the script inserted. - */ - void ReplaceScripts( CharacterIndex characterIndex, - Length numberOfCharactersToRemove, - const ScriptRun* const scriptRuns, - Length numberOfCharactersToInsert ); - - /** - * @brief Sets the font runs. - * - * Replaces any fonts previously set. - * - * A run is a group of consecutive characters. A font run contains the font id for a run. - * - * @note If the number of runs is zero the font buffer is cleared. - * - * @param[in] fonts Pointer to a buffer with all the font runs. - * @param[in] numberOfRuns The number of font runs. - */ - void SetFonts( const FontRun* const fonts, - Length numberOfRuns ); - - /** - * @brief Retrieves the number of font runs and the index of the first one for the given range of characters. - * - * A run is a group of consecutive characters. A font run contains the font id for a run. - * - * @param[in] characterIndex Index to the first character. - * @param[in] numberOfCharacters The number of characters. - * @param[out] firstFontRun Index to the font run containing the character index. - * @param[out] numberOfFontRuns The number of font runs. - */ - void GetNumberOfFontRuns( CharacterIndex characterIndex, - Length numberOfCharacters, - FontRunIndex& firstFontRun, - Length& numberOfFontRuns ) const; - - /** - * @brief Retrieves the font runs for the given range of characters. - * - * The @p fontRuns buffer needs to be big enough to copy the number of font runs. - * Call GetNumberOfFontRuns() to retrieve the number of font runs. - * - * @param[out] fontRuns Pointer to a buffer where the font runs are copied. - * @param[in] characterIndex Index to the first character. - * @param[in] numberOfCharacters The number of characters. - */ - void GetFontRuns( FontRun* fontRuns, - CharacterIndex characterIndex, - Length numberOfCharacters ) const; - - /** - * @brief Retrieves the font id for the given character index. - * - * @param[in] characterIndex Index to the first character. - * - * @return The font id. - */ - FontId GetFont( CharacterIndex characterIndex ) const; - - /** - * @brief Replaces font runs for the given range of characters. - * - * If the @p numberOfCharactersToRemove is zero, this operation is like an insert. - * If the @p numberOfCharactersToInsert is zero, this operation is like a remove. - * - * @param[in] characterIndex Index of the first character where to replace the fonts. - * @param[in] numberOfCharactersToRemove The number of characters to be the font removed. - * @param[in] fontRuns Pointer to a buffer with the font runs. - * @param[in] numberOfCharactersToInsert The number of characters to be the font inserted. - */ - void ReplaceFonts( CharacterIndex characterIndex, - Length numberOfCharactersToRemove, - const FontRun* const fontRuns, - Length numberOfCharactersToInsert ); - - // Break info interface. - - /** - * @brief Sets the line break info. - * - * See GetLineBreakInfo() to get how the line break info is encoded. - * - * Replaces any line break info previously set. - * - * @note If the @length is zero the break info buffer is cleared. - * - * @param[in] lineBreakInfo Pointer to a buffer with the line break info. - * @param[in] length The size of the buffer. - */ - void SetLineBreakInfo( const LineBreakInfo* const lineBreakInfo, - Length length ); - - /** - * @brief Retrieves the line break info in the given buffer. - * - * The size of the @p lineBreakInfo buffer needs to be big enough to copy the @p numberOfItems. - * - * Possible values for LineBreakInfo are: - * - * - 0 is a LINE_MUST_BREAK. Text must be broken into a new line. - * - 1 is a LINE_ALLOW_BREAK. Is possible to break the text into a new line. - * - 2 is a LINE_NO_BREAK. Text can't be broken into a new line. - * - @verbatim - i.e. Hello big\nworld produces: - 2222212220 22220 - @endverbatim - * - * @param[out] lineBreakInfo Pointer to a buffer where the line break info is copied. - * @param[in] characterIndex Index to the first line break info item. - * @param[in] numberOfItems The number of items to be copied. - */ - void GetLineBreakInfo( LineBreakInfo* lineBreakInfo, - CharacterIndex characterIndex, - Length numberOfItems ) const; - - /** - * @brief Retrieves the line break info for the given item index. - * - * @param[in] characterIndex Index to the line break info item. - */ - LineBreakInfo GetLineBreakInfo( CharacterIndex characterIndex ) const; - - /** - * @brief Replaces line break info. - * - * See GetLineBreakInfo() to get how the line break info is encoded. - * - * If the @p numberOfItemsToRemove is zero, this operation is like an insert. - * If the @p numberOfItemsToInsert is zero, this operation is like a remove. - * - * @param[in] characterIndex Where to replace the line break info. - * @param[in] numberOfItemsToRemove The number of items to be removed. - * @param[in] lineBreakInfo Pointer to a buffer with the line break info. - * @param[in] numberOfItemsToInsert The number of items in the buffer. - */ - void ReplaceLineBreakInfo( CharacterIndex characterIndex, - Length numberOfItemsToRemove, - const LineBreakInfo* const lineBreakInfo, - Length numberOfItemsToInsert ); - - /** - * @brief Sets the word break info. - * - * See GetWordBreakInfo() to get how the word break info is encoded. - * - * Replaces any word break info previously set. - * - * @note If the @length is zero the break info buffer is cleared. - * - * @param[in] wordBreakInfo Pointer to a buffer with the word break info. - * @param[in] length The size of the buffer. - */ - void SetWordBreakInfo( const WordBreakInfo* const wordBreakInfo, - Length length ); - - /** - * @brief Retrieves the word break info in the given buffer. - * - * The size of the @p wordBreakInfo buffer needs to be big enough to copy the @p numberOfItems. - * - * The size of the buffer has to be big enough to store the whole word break info per character. - * Call GetNumberOfCharacters() to get the number of characters. - * - * Possible values for WordBreakInfo are: - * - * - 0 is a WORD_BREAK. Text can be broken into a new word. - * - 1 is a WORD_NO_BREAK. Text can't be broken into a new word. - * - @verbatim - i.e. Hello big\nworld produces: - 1111001100 11110 - @endverbatim - * - * @param[out] wordBreakInfo Pointer to a buffer where the word break info is copied. - * @param[in] characterIndex Index to the first word break info item. - * @param[in] numberOfItems The number of items to be copied. - */ - void GetWordBreakInfo( WordBreakInfo* wordBreakInfo, - CharacterIndex characterIndex, - Length numberOfItems ) const; - - /** - * @brief Retrieves the word break info for the given item index. - * - * @param[in] characterIndex Index to the word break info item. - */ - WordBreakInfo GetWordBreakInfo( CharacterIndex characterIndex ) const; - - /** - * @brief Replaces word break info. - * - * See GetWordBreakInfo() to get how the word break info is encoded. - * - * If the @p numberOfItemsToRemove is zero, this operation is like an insert. - * If the @p numberOfItemsToInsert is zero, this operation is like a remove. - * - * @param[in] characterIndex Where to replace the word break info. - * @param[in] numberOfItemsToRemove The number of items to be removed. - * @param[in] wordBreakInfo Pointer to a buffer with the word break info. - * @param[in] numberOfItemsToInsert The number of items in the buffer. - */ - void ReplaceWordBreakInfo( CharacterIndex characterIndex, - Length numberOfItemsToRemove, - const WordBreakInfo* const wordBreakInfo, - Length numberOfItemsToInsert ); - // Bidirectional support interface. /** - * @brief Sets the bidirectional info runs. - * - * Replaces any bidirectional info previously set. - * - * Each bidirectional info run stores bidirectional info for a whole 'paragraph' of text which contains right to left scripts. - - * In terms of the bidirectional algorithm, a 'paragraph' is understood as a run of characters between Paragraph Separators or appropriate Newline Functions. - * A 'paragraph' may also be determined by higher-level protocols like a mark-up tag. - * - * @note If the number of runs is zero the bidirectional info buffer is cleared. - * - * @param[in] bidirectionalInfo Pointer to a buffer with all the bidirectional info runs. - * @param[in] numberOfRuns The number of bidirectional info runs. - */ - void SetBidirectionalInfo( const BidirectionalParagraphInfoRun* const bidirectionalInfo, - Length numberOfRuns ); - - /** - * @brief Retrieves the number of bidirectional info runs and the index to the first one for the given range of characters. - * - * It may be zero if there is no right to left scripts. - * - * @param[in] characterIndex Index to the first character. - * @param[in] numberOfCharacters The number of characters. - * - * @return The number of bidirectional info runs. - */ - void GetNumberOfBidirectionalInfoRuns( CharacterIndex characterIndex, - Length numberOfCharacters, - BidirectionalRunIndex& firstBidirectionalRun, - Length& numberOfFontRuns ) const; - - /** - * @brief Retrieves the bidirectional paragraph info runs for the given range of characters. - * - * The @p bidirectionalInfo buffer needs to be big enough to copy the number of bidirectional - * paragraph info runs. - * Call GetNumberOfBidirectionalInfoRuns() to retrieve the number of bidirectional runs. - * - * @param[out] bidirectionalInfo Pointer to a buffer where the bidirectional info runs are copied. - * @param[in] characterIndex Index to the first character. - * @param[in] numberOfCharacters The number of characters. - */ - void GetBidirectionalInfo( BidirectionalParagraphInfoRun* bidirectionalInfo, - CharacterIndex characterIndex, - Length numberOfCharacters ) const; - - /** - * @brief Replaces bidirectional info runs for the given range of characters. - * - * If the @p numberOfCharactersToRemove is zero, this operation is like an insert. - * If the @p numberOfCharactersToInsert is zero, this operation is like a remove. - * - * @param[in] characterIndex Index of the first character where to replace the bidirectional info. - * @param[in] numberOfCharactersToRemove The number of characters to be the bidirectional info removed. - * @param[in] bidirectionalInfo Pointer to a buffer with the bidirectional info runs. - * @param[in] numberOfCharactersToInsert The number of characters to be the bidirectional info inserted. - */ - void ReplaceBidirectionalInfo( CharacterIndex characterIndex, - Length numberOfCharactersToRemove, - const BidirectionalParagraphInfoRun* const bidirectionalInfo, - Length numberOfCharactersToInsert ); - - /** - * @brief Replaces the direction of the characters. - * - * @note If the number of characters is zero the directions buffer is cleared. - * - * @param[in] directions The directions of the characters. - * @param[in] numberOfCharacters The number of characters. - */ - void SetCharacterDirections( const CharacterDirection* const directions, - Length numberOfCharacters ); - - /** - * @brief Retrieves the direction of the characters. - * - * It sets @e true for right to left characters and @e false for left to right. - * For neutral characters it check's the next and previous character's directions: - * - If they are equals set that direction. If they are not, sets the paragraph's direction. - * - If there is no next, sets the paragraph's direction. - * - * See SetBidirectionalInfo() to get an explanation of the 'paragraph' meaning in the bidirectional algorithm. - * - * @pre the @p directions vector should be initialized to @e false (left to right) as this method is not going - * to update it if there is no right to left characters. - * - * @param[out] directions Whether the characters are right to left or left to right. - * @param[in] characterIndex Index to the first character. - * @param[in] numberOfCharacters The number of characters. - */ - void GetCharacterDirections( CharacterDirection* directions, - CharacterIndex characterIndex, - Length numberOfCharacters ) const; - - /** * @brief Retrieves the direction of a characters. * * See GetCharacterDirections(). @@ -516,31 +102,6 @@ public: Length numberOfRuns ); /** - * @brief Replaces the visual to logical and logical to visual map tables for the given range of characters. - * - * If the @p numberOfCharactersToRemove is zero, this operation is like an insert. - * If the @p numberOfCharactersToInsert is zero, this operation is like a remove. - * - * @param[in] characterIndex Index of the first character where to replace the map tables. - * @param[in] numberOfCharactersToRemove The number of characters to be removed. - * @param[in] bidirectionalInfo Pointer to a buffer with the bidirectional info runs. - * @param[in] numberOfCharactersToInsert The number of characters to be inserted. - */ - void ReplaceVisualToLogicalMap( CharacterIndex characterIndex, - Length numberOfCharactersToRemove, - const BidirectionalLineInfoRun* const bidirectionalInfo, - Length numberOfCharactersToInsert ); - - /** - * @brief Retrieves the visual character index for the given logical character index. - * - * @param[in] logicalCharacterIndex The logical character index. - * - * @return The visual character index. - */ - CharacterIndex GetVisualCharacterIndex( CharacterIndex logicalCharacterIndex ) const; - - /** * @brief Retrieves the logical character index for the given visual character index. * * @param[in] visualCharacterIndex The visual character index. @@ -549,32 +110,6 @@ public: */ CharacterIndex GetLogicalCharacterIndex( CharacterIndex visualCharacterIndex ) const; - /** - * @brief Retrieves the whole or part of the logical to visual conversion map. - * - * The size of the buffer needs to be big enough to copy the @p numberOfCharacters. - * - * @param[out] logicalToVisualMap Pointer to a buffer where the conversion map is copied. - * @param[in] characterIndex Index to the first character. - * @param[in] numberOfCharacters The number of characters. - */ - void GetLogicalToVisualMap( CharacterIndex* logicalToVisualMap, - CharacterIndex characterIndex, - Length numberOfCharacters ) const; - - /** - * @brief Retrieves the whole or part of the visual to logical conversion map. - * - * The size of the buffer needs to be big enough to copy the @p numberOfCharacters. - * - * @param[out] visualToLogicalMap Pointer to a buffer where the conversion map is copied. - * @param[in] characterIndex Index to the first character. - * @param[in] numberOfCharacters The number of characters. - */ - void GetVisualToLogicalMap( CharacterIndex* visualToLogicalMap, - CharacterIndex characterIndex, - Length numberOfCharacters ) const; - protected: /** diff --git a/dali-toolkit/internal/text/multi-language-support-impl.cpp b/dali-toolkit/internal/text/multi-language-support-impl.cpp index 2d2352e..f137b4d 100644 --- a/dali-toolkit/internal/text/multi-language-support-impl.cpp +++ b/dali-toolkit/internal/text/multi-language-support-impl.cpp @@ -332,17 +332,17 @@ void MultilanguageSupport::SetScripts( const Vector& text, // Add remaining characters into the last script. currentScriptRun.characterRun.numberOfCharacters += numberOfAllScriptCharacters; - if( 0u != currentScriptRun.characterRun.numberOfCharacters ) - { - if( TextAbstraction::UNKNOWN == currentScriptRun.script ) - { - // There are only white spaces in the last script. Set the latin script. - currentScriptRun.script = TextAbstraction::LATIN; - } - // Store the last run. - scripts.PushBack( currentScriptRun ); + DALI_ASSERT_DEBUG( ( 0u != currentScriptRun.characterRun.numberOfCharacters ) && "MultilanguageSupport::SetScripts() Trying to insert a script run with zero characters." ); + + if( TextAbstraction::UNKNOWN == currentScriptRun.script ) + { + // There are only white spaces in the last script. Set the latin script. + currentScriptRun.script = TextAbstraction::LATIN; } + + // Store the last run. + scripts.PushBack( currentScriptRun ); } void MultilanguageSupport::ReplaceScripts( LogicalModel& model, diff --git a/dali-toolkit/internal/text/text-controller-impl.cpp b/dali-toolkit/internal/text/text-controller-impl.cpp index d900032..e3ee4d6 100644 --- a/dali-toolkit/internal/text/text-controller-impl.cpp +++ b/dali-toolkit/internal/text/text-controller-impl.cpp @@ -453,7 +453,7 @@ void Controller::Impl::OnCursorKeyEvent( const Event& event ) } else if( Dali::DALI_KEY_CURSOR_RIGHT == keyCode ) { - if( mLogicalModel->GetNumberOfCharacters() > mEventData->mPrimaryCursorPosition ) + if( mLogicalModel->mText.Count() > mEventData->mPrimaryCursorPosition ) { mEventData->mPrimaryCursorPosition = CalculateNewCursorIndex( mEventData->mPrimaryCursorPosition ); } @@ -1150,7 +1150,7 @@ void Controller::Impl::GetCursorPosition( CharacterIndex logical, // Check if the logical position is the first or the last one of the text. const bool isFirstPosition = 0u == logical; - const bool isLastPosition = mLogicalModel->GetNumberOfCharacters() == logical; + const bool isLastPosition = mLogicalModel->mText.Count() == logical; if( isFirstPosition && isLastPosition ) { diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index d7a6149..de3aa91 100644 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -599,9 +599,9 @@ bool Controller::Relayout( const Size& size ) if( ( size.width < Math::MACHINE_EPSILON_1000 ) || ( size.height < Math::MACHINE_EPSILON_1000 ) ) { bool glyphsRemoved( false ); - if( 0u != mImpl->mVisualModel->GetNumberOfGlyphPositions() ) + if( 0u != mImpl->mVisualModel->mGlyphPositions.Count() ) { - mImpl->mVisualModel->SetGlyphPositions( NULL, 0u ); + mImpl->mVisualModel->mGlyphPositions.Clear(); glyphsRemoved = true; } // Not worth to relayout if width or height is equal to zero. @@ -799,7 +799,7 @@ bool Controller::DoRelayout( const Size& size, // after the first time the text has been laid out. // Fill the vectors again. - Length numberOfGlyphs = mImpl->mVisualModel->GetNumberOfGlyphs(); + Length numberOfGlyphs = mImpl->mVisualModel->mGlyphs.Count(); if( 0u == numberOfGlyphs ) { @@ -859,7 +859,7 @@ bool Controller::DoRelayout( const Size& size, if( 0u != bidirectionalInfo.Count() ) { // Get the lines - const Length numberOfLines = mImpl->mVisualModel->GetNumberOfLines(); + const Length numberOfLines = mImpl->mVisualModel->mLines.Count(); // Reorder the lines. Vector lineBidirectionalInfoRuns; @@ -1265,7 +1265,7 @@ void Controller::InsertText( const std::string& text, Controller::InsertType typ } } - const Length numberOfCharactersInModel = mImpl->mLogicalModel->GetNumberOfCharacters(); + const Length numberOfCharactersInModel = mImpl->mLogicalModel->mText.Count(); // Restrict new text to fit within Maximum characters setting Length maxSizeOfNewText = std::min ( ( mImpl->mMaximumNumberOfCharacters - numberOfCharactersInModel ), characterCount ); diff --git a/dali-toolkit/internal/text/text-view.cpp b/dali-toolkit/internal/text/text-view.cpp index 91ecadf..34c3f32 100644 --- a/dali-toolkit/internal/text/text-view.cpp +++ b/dali-toolkit/internal/text/text-view.cpp @@ -67,7 +67,7 @@ Length View::GetGlyphs( GlyphInfo* glyphs, // If ellipsis is enabled, the number of glyphs the layout engine has laid out may be less than 'numberOfGlyphs'. // Check the last laid out line to know if the layout engine elided some text. - const Length numberOfLines = mImpl->mVisualModel->GetNumberOfLines(); + const Length numberOfLines = mImpl->mVisualModel->mLines.Count(); if( numberOfLines > 0u ) { const LineRun& lastLine = *( mImpl->mVisualModel->mLines.Begin() + ( numberOfLines - 1u ) ); @@ -302,8 +302,8 @@ Length View::GetNumberOfGlyphs() const { VisualModel& model = *mImpl->mVisualModel; - Length glyphCount = model.GetNumberOfGlyphs(); - Length positionCount = model.GetNumberOfGlyphPositions(); + const Length glyphCount = model.mGlyphs.Count(); + const Length positionCount = model.mGlyphPositions.Count(); DALI_ASSERT_DEBUG( positionCount <= glyphCount && "Invalid glyph positions in Model" ); diff --git a/dali-toolkit/internal/text/visual-model-impl.cpp b/dali-toolkit/internal/text/visual-model-impl.cpp index beeb08b..a354fdc 100644 --- a/dali-toolkit/internal/text/visual-model-impl.cpp +++ b/dali-toolkit/internal/text/visual-model-impl.cpp @@ -36,47 +36,6 @@ VisualModelPtr VisualModel::New() return VisualModelPtr( new VisualModel() ); } -void VisualModel::SetGlyphs( const GlyphInfo* const glyphs, - const CharacterIndex* const characterIndices, - const Length* const charactersPerGlyph, - Length numberOfGlyphs ) -{ - if( 0u == numberOfGlyphs ) - { - mGlyphs.Clear(); - mGlyphsToCharacters.Clear(); - mCharactersToGlyph.Clear(); - mCharactersPerGlyph.Clear(); - mGlyphsPerCharacter.Clear(); - } - else - { - if( NULL != glyphs ) - { - mGlyphs.Resize( numberOfGlyphs ); - memcpy( mGlyphs.Begin(), glyphs, numberOfGlyphs * sizeof( GlyphInfo ) ); - } - - if( NULL != characterIndices ) - { - mGlyphsToCharacters.Resize( numberOfGlyphs ); - memcpy( mGlyphsToCharacters.Begin(), characterIndices, numberOfGlyphs * sizeof( CharacterIndex ) ); - } - - if( NULL != charactersPerGlyph ) - { - mCharactersPerGlyph.Resize( numberOfGlyphs ); - memcpy( mCharactersPerGlyph.Begin(), charactersPerGlyph, numberOfGlyphs * sizeof( Length ) ); - - // Build the glyphs per character table. - CreateGlyphsPerCharacterTable(); - - // Build the characters to glyph conversion table. - CreateCharacterToGlyphTable(); - } - } -} - void VisualModel::CreateCharacterToGlyphTable( Length numberOfCharacters ) { // 1) Reserve some space for the characters to avoid reallocations. @@ -157,11 +116,6 @@ void VisualModel::CreateGlyphsPerCharacterTable( Length numberOfCharacters ) } } -Length VisualModel::GetNumberOfGlyphs() const -{ - return mGlyphs.Count(); -} - void VisualModel::GetGlyphs( GlyphInfo* glyphs, GlyphIndex glyphIndex, Length numberOfGlyphs ) const @@ -169,81 +123,6 @@ void VisualModel::GetGlyphs( GlyphInfo* glyphs, memcpy( glyphs, mGlyphs.Begin() + glyphIndex, numberOfGlyphs * sizeof( GlyphInfo ) ); } -const GlyphInfo& VisualModel::GetGlyphInfo( GlyphIndex glyphIndex ) const -{ - return mGlyphs[glyphIndex]; -} - -void VisualModel::ReplaceGlyphs( GlyphIndex glyphIndex, - Length numberOfGlyphsToRemove, - const GlyphInfo* const glyphs, - const Length* const numberOfCharacters, - Length numberOfGlyphsToInsert ) -{ -} - -CharacterIndex VisualModel::GetCharacterIndex( GlyphIndex glyphIndex ) const -{ - return mGlyphsToCharacters[glyphIndex]; -} - -Length VisualModel::GetCharactersPerGlyph( GlyphIndex glyphIndex ) const -{ - return mCharactersPerGlyph[glyphIndex]; -} - -GlyphIndex VisualModel::GetGlyphIndex( CharacterIndex characterIndex ) const -{ - return mCharactersToGlyph[characterIndex]; -} - -void VisualModel::GetCharacterToGlyphMap( GlyphIndex* characterToGlyphMap, - CharacterIndex characterIndex, - Length numberOfCharacters ) const -{ - memcpy( characterToGlyphMap, mCharactersToGlyph.Begin() + characterIndex, numberOfCharacters * sizeof( GlyphIndex ) ); -} - -void VisualModel::GetGlyphToCharacterMap( CharacterIndex* glyphToCharacter, - GlyphIndex glyphIndex, - Length numberOfGlyphs ) const -{ - memcpy( glyphToCharacter, mGlyphsToCharacters.Begin() + glyphIndex, numberOfGlyphs * sizeof( CharacterIndex ) ); -} - -void VisualModel::GetCharactersPerGlyphMap( Length* charactersPerGlyph, - GlyphIndex glyphIndex, - Length numberOfGlyphs ) const -{ - memcpy( charactersPerGlyph, mCharactersPerGlyph.Begin() + glyphIndex, numberOfGlyphs * sizeof( Length ) ); -} - -void VisualModel::GetGlyphsPerCharacterMap( Length* glyphsPerCharacter, - CharacterIndex characterIndex, - Length numberOfCharacters ) const -{ - memcpy( glyphsPerCharacter, mGlyphsPerCharacter.Begin() + characterIndex, numberOfCharacters * sizeof( Length ) ); -} - -void VisualModel::SetGlyphPositions( const Vector2* const glyphPositions, - Length numberOfGlyphs ) -{ - if( 0u == numberOfGlyphs ) - { - mGlyphPositions.Clear(); - } - else - { - mGlyphPositions.Resize( numberOfGlyphs ); - memcpy( mGlyphPositions.Begin(), glyphPositions, numberOfGlyphs * sizeof( Vector2 ) ); - } -} - -Length VisualModel::GetNumberOfGlyphPositions() const -{ - return mGlyphPositions.Count(); -} - void VisualModel::GetGlyphPositions( Vector2* glyphPositions, GlyphIndex glyphIndex, Length numberOfGlyphs ) const @@ -251,44 +130,6 @@ void VisualModel::GetGlyphPositions( Vector2* glyphPositions, memcpy( glyphPositions, mGlyphPositions.Begin() + glyphIndex, numberOfGlyphs * sizeof( Vector2 ) ); } -const Vector2& VisualModel::GetGlyphPosition( GlyphIndex glyphIndex ) const -{ - return *( mGlyphPositions.Begin() + glyphIndex ); -} - -void VisualModel::ReplaceGlyphPositions( GlyphIndex glyphIndex, - Length numberOfGlyphsToRemove, - const Vector2* const positions, - Length numberOfGlyphsToInsert ) -{ -} - -void VisualModel::SetLines( const LineRun* const lines, - Length numberOfLines ) -{ - if( 0u == numberOfLines ) - { - mLines.Clear(); - } - else - { - mLines.Resize( numberOfLines ); - memcpy( mLines.Begin(), lines, numberOfLines * sizeof( LineRun ) ); - } -} - -Length VisualModel::GetNumberOfLines() const -{ - return mLines.Count(); -} - -void VisualModel::GetLines( LineRun* lines, - LineIndex lineIndex, - Length numberOfLines ) const -{ - memcpy( lines, mLines.Begin() + lineIndex, numberOfLines * sizeof( LineRun ) ); -} - void VisualModel::GetNumberOfLines( GlyphIndex glyphIndex, Length numberOfGlyphs, LineIndex& firstLine, @@ -343,13 +184,6 @@ void VisualModel::GetLinesOfGlyphRange( LineRun* lines, memcpy( lines, mLines.Begin() + firstLine, numberOfLines * sizeof( LineRun ) ); } -LineIndex VisualModel::GetLineOfGlyph( GlyphIndex glyphIndex ) -{ - const CharacterIndex characterIndex = *( mGlyphsToCharacters.Begin() + glyphIndex ); - - return GetLineOfCharacter( characterIndex ); -} - LineIndex VisualModel::GetLineOfCharacter( CharacterIndex characterIndex ) { // 1) Check first in the cached line. @@ -383,13 +217,6 @@ LineIndex VisualModel::GetLineOfCharacter( CharacterIndex characterIndex ) return index; } -void VisualModel::ReplaceLines( GlyphIndex glyphIndex, - Length numberOfGlyphsToRemove, - const LineRun* const lines, - Length numberOfGlyphsToInsert ) -{ -} - void VisualModel::SetNaturalSize( const Vector2& size ) { mNaturalSize = size; diff --git a/dali-toolkit/internal/text/visual-model-impl.h b/dali-toolkit/internal/text/visual-model-impl.h index 227019f..f290ba5 100644 --- a/dali-toolkit/internal/text/visual-model-impl.h +++ b/dali-toolkit/internal/text/visual-model-impl.h @@ -63,22 +63,6 @@ public: // Glyph interface. /** - * @brief Replaces any glyphs previously set. - * - * @note If the number of glyphs is zero, all buffers are cleared. - * @note If one pointer is NULL and the number of glyphs is not zero, the buffer is not touched. - * - * @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 containing the number of characters per glyph. - * @param[in] numberOfGlyphs The number of glyphs. - */ - void SetGlyphs( const GlyphInfo* const glyphs, - const CharacterIndex* const characterIndices, - const Length* const charactersPerGlyph, - Length numberOfGlyphs ); - - /** * @brief Creates the character to glyph conversion table. * * @pre The glyphs per character table needs to be created first. @@ -95,13 +79,6 @@ public: void CreateGlyphsPerCharacterTable( Length numberOfCharacters = 0u ); /** - * @brief 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. @@ -113,101 +90,9 @@ public: GlyphIndex glyphIndex, Length numberOfGlyphs ) const; - /** - * @brief Retrieves a glyph. - * - * @param[in] glyphIndex Index to a glyph. - * - * @return A glyph. - */ - const GlyphInfo& GetGlyphInfo( GlyphIndex glyphIndex ) const; - - /** - * @brief Replaces glyphs. - * - * If the @p numberOfGlyphsToRemove is zero, this operation is like an insert. - * If the @p numberOfGlyphsToInsert is zero, this operation is like a remove. - * - * @param[in] glyphIndex Where to replace the glyphs. - * @param[in] numberOfGlyphsToRemove The number of glyphs to be removed. - * @param[in] glyphs Pointer to a buffer with the new glyphs. - * @param[in] numberOfCharacters Pointer to a buffer with the number of characters per glyph. - * @param[in] numberOfGlyphsToInsert The number of new glyphs in the buffer. - */ - void ReplaceGlyphs( GlyphIndex glyphIndex, - Length numberOfGlyphsToRemove, - const GlyphInfo* const glyphs, - const Length* const numberOfCharacters, - Length numberOfGlyphsToInsert ); - // 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; - - /** - * @brief 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; - - /** - * @brief Retrieves the whole or part of the character to glyph conversion map. - * - * The size of the buffer needs to be big enough to copy the @p numberOfCharacters. - * - * @param[out] characterToGlyphMap Pointer to a buffer where the conversion map is copied. - * @param[in] characterIndex Index to the first character. - * @param[in] numberOfCharacters The number of characters. - */ - void GetCharacterToGlyphMap( GlyphIndex* characterToGlyphMap, - CharacterIndex characterIndex, - Length numberOfCharacters ) const; - - /** - * @brief Retrieves the whole or part of the glyph to character conversion map. - * - * The size of the buffer needs to be big enough to copy the @p numberOfGlyphs. - * - * @param[out] glyphToCharacter Pointer to a buffer where the conversion map is copied. - * @param[in] glyphIndex Index to the first glyph. - * @param[in] numberOfGlyphs The number of glyphs. - */ - void GetGlyphToCharacterMap( CharacterIndex* glyphToCharacter, - GlyphIndex glyphIndex, - Length numberOfGlyphs ) const; - - /** - * @brief Retrieves for each glyph the number of characters the glyph represents. - * - * @param[out] charactersPerGlyph Pointer to a buffer where the number of characters for each glyph are copied. - * @param[in] glyphIndex Index to the first glyph. - * @param[in] numberOfGlyphs The number of glyphs. - */ - void GetCharactersPerGlyphMap( Length* charactersPerGlyph, - GlyphIndex glyphIndex, - Length numberOfGlyphs ) const; - - /** * @brief Retrieves for each character the number of glyphs the character is shaped. * * @param[out] glyphsPerCharacter Pointer to a buffer where the number of glyphs for each character are copied. @@ -221,25 +106,6 @@ public: // Position interface /** - * @brief Replaces any glyph positions previously set. - * - * @note If the number of glyphs is zero the position buffer is cleared. - * - * @param[in] glyphPositions An array of visual positions for each glyph. - * @param[in] numberOfGlyphs The number of positions. - */ - void SetGlyphPositions( const Vector2* const glyphPositions, - Length numberOfGlyphs ); - - /** - * @brief Retrieves the number of glyph positions set. - * - * @note This may be less than the number of glyphs in the model. - * @return The number of glyphs. - */ - Length GetNumberOfGlyphPositions() const; - - /** * @brief Retrieves the glyph positions. * * @pre The size of the @p positions buffer needs to be big enough to copy the @p numberOfGlyphs positions. @@ -251,69 +117,9 @@ public: GlyphIndex glyphIndex, Length numberOfGlyphs ) const; - /** - * @brief Retrieve the glyph's position of the given glyph. - * - * @param[in] glyphIndex Index to the glyph. - * - * @return The glyph's position. - */ - const Vector2& GetGlyphPosition( GlyphIndex glyphIndex ) const; - - /** - * @brief Replaces glyph's positions. - * - * If the @p numberOfGlyphsToRemove is zero, this operation is like an insert. - * If the @p numberOfGlyphsToInsert is zero, this operation is like a remove. - * - * @param[in] glyphIndex Where to replace the glyph's positions. - * @param[in] numberOfGlyphsToRemove The number of glyph's positions to be removed. - * @param[in] positions Pointer to a buffer with the new glyph's positions. - * @param[in] numberOfGlyphsToInsert The number of new glyph's positions in the buffer. - */ - void ReplaceGlyphPositions( GlyphIndex glyphIndex, - Length numberOfGlyphsToRemove, - const Vector2* const positions, - Length numberOfGlyphsToInsert ); - // Line interface. /** - * @brief Sets the lines. - * - * Replaces any lines previously set. - * - * Every line is an item run containing the index to the first glyph of the line and the number of glyphs. - * - * @note If the number of lines is zero or the pointer is NULL, the lines buffer is cleared. - * - * @param[in] lines Pointer to a buffer containing all the line runs. - * @param[in] numberOfLines The number of lines in the buffer. - */ - void SetLines( const LineRun* const lines, - Length numberOfLines ); - - /** - * @brief Retrieves the number of lines of the whole text. - * - * @return The number of lines. - */ - Length GetNumberOfLines() const; - - /** - * @brief Retrieves lines. - * - * The size of the @p lines buffer needs to be big enough to copy the @p numberOfLines. - * - * @param[out] lines Pointer to a buffer where the lines are copied. - * @param[in] lineIndex Index to the first line. - * @param[in] numberOfLines Number of lines to be copied. - */ - void GetLines( LineRun* lines, - LineIndex lineIndex, - Length numberOfLines ) const; - - /** * @brief Retrieves the number of lines and the index to the first line where the given range of glyphs is laid out. * * @param[in] glyphIndex Index to the first glyph. @@ -325,6 +131,7 @@ public: Length numberOfGlyphs, LineIndex& firstLine, Length& numberOfLines ) const; + /** * @brief Retrieves the lines where the given range of glyphs is laid out. * @@ -339,15 +146,6 @@ public: Length numberOfGlyphs ) const; /** - * @brief Retrieves the line index where the glyph is laid-out. - * - * @param[in] glyphIndex The glyph's index. - * - * @return The line index. - */ - LineIndex GetLineOfGlyph( GlyphIndex glyphIndex ); - - /** * @brief Retrieves the line index where the character is laid-out. * * @param[in] characterIndex The character's index. @@ -356,22 +154,6 @@ public: */ LineIndex GetLineOfCharacter( CharacterIndex characterIndex ); - /** - * @brief Replaces lines for the given range of glyphs. - * - * If the @p numberOfGlyphsToRemove is zero, this operation is like an insert. - * If the @p numberOfGlyphsToInsert is zero, this operation is like a remove. - * - * @param[in] glyphIndex Index of the first glyph where to replace the line info. - * @param[in] numberOfGlyphsToRemove The number of glyphs to be the line info removed. - * @param[in] lines Pointer to a buffer with the lines. - * @param[in] numberOfGlyphsToInsert The number of characters to be the line info inserted. - */ - void ReplaceLines( GlyphIndex glyphIndex, - Length numberOfGlyphsToRemove, - const LineRun* const lines, - Length numberOfGlyphsToInsert ); - // Size interface /**