utc-Dali-Text-ViewModel.cpp
utc-Dali-TextField-internal.cpp
utc-Dali-TextEditor-internal.cpp
- utc-Dali-TextLabel-internal.cpp
utc-Dali-TextSelectionPopup-internal.cpp
utc-Dali-TextureManager.cpp
utc-Dali-Visuals-internal.cpp
MarkupProcessData markupProcessData( logicalModel->mColorRuns,
logicalModel->mFontDescriptionRuns,
logicalModel->mEmbeddedItems,
- logicalModel->mAnchors,
- logicalModel->mUnderlinedCharacterRuns);
+ logicalModel->mAnchors );
Length textSize = 0u;
const uint8_t* utf8 = NULL;
Vector<FontDescriptionRun> fontRuns;
Vector<EmbeddedItem> items;
Vector<Anchor> anchors;
- Vector<UnderlinedCharacterRun> underlinedCharacterRuns;
- MarkupProcessData markupProcessData( colorRuns, fontRuns, items, anchors, underlinedCharacterRuns );
+ MarkupProcessData markupProcessData( colorRuns, fontRuns, items, anchors );
ProcessMarkupString( data.xHTMLEntityString, markupProcessData );
for( Vector<EmbeddedItem>::Iterator it = items.Begin(),
END_TEST;
}
-
-int UtcDaliTextEditorMarkupUnderline(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliTextEditorMarkupUnderline ");
-
- TextEditor textEditor = TextEditor::New();
-
- application.GetScene().Add( textEditor );
-
- textEditor.SetProperty( TextEditor::Property::TEXT, "<u>ABC</u>EF<u>GH</u>" );
- textEditor.SetProperty( TextEditor ::Property::ENABLE_MARKUP, true );
-
- application.SendNotification();
- application.Render();
-
- uint32_t expectedNumberOfUnderlinedGlyphs = 5u;
-
- Toolkit::Internal::TextEditor& textEditorImpl = GetImpl( textEditor );
- const Text::Length numberOfUnderlineRuns = textEditorImpl.getController()->GetTextModel()->GetNumberOfUnderlineRuns();
-
- DALI_TEST_EQUALS( numberOfUnderlineRuns, expectedNumberOfUnderlinedGlyphs, TEST_LOCATION );
-
- Vector<GlyphRun> underlineRuns;
- underlineRuns.Resize(numberOfUnderlineRuns);
- textEditorImpl.getController()->GetTextModel()->GetUnderlineRuns(underlineRuns.Begin(), 0u, numberOfUnderlineRuns);
-
- //ABC are underlined
- DALI_TEST_EQUALS( underlineRuns[0u].glyphIndex, 0u, TEST_LOCATION);
- DALI_TEST_EQUALS( underlineRuns[1u].glyphIndex, 1u, TEST_LOCATION);
- DALI_TEST_EQUALS( underlineRuns[2u].glyphIndex, 2u, TEST_LOCATION);
-
- //GH are underlined
- DALI_TEST_EQUALS( underlineRuns[3u].glyphIndex, 5u, TEST_LOCATION);
- DALI_TEST_EQUALS( underlineRuns[4u].glyphIndex, 6u, TEST_LOCATION);
-
- END_TEST;
-
-}
\ No newline at end of file
END_TEST;
}
-
-int UtcDaliTextFieldMarkupUnderline(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliTextFieldMarkupUnderline ");
-
- TextField textField = TextField::New();
-
- application.GetScene().Add( textField );
-
- textField.SetProperty( TextField::Property::TEXT, "<u>ABC</u>EF<u>GH</u>" );
- textField.SetProperty( TextField ::Property::ENABLE_MARKUP, true );
-
- application.SendNotification();
- application.Render();
-
- uint32_t expectedNumberOfUnderlinedGlyphs = 5u;
-
- Toolkit::Internal::TextField& textFieldImpl = GetImpl( textField );
- const Text::Length numberOfUnderlineRuns = textFieldImpl.getController()->GetTextModel()->GetNumberOfUnderlineRuns();
-
- DALI_TEST_EQUALS( numberOfUnderlineRuns, expectedNumberOfUnderlinedGlyphs, TEST_LOCATION );
-
- Vector<GlyphRun> underlineRuns;
- underlineRuns.Resize(numberOfUnderlineRuns);
- textFieldImpl.getController()->GetTextModel()->GetUnderlineRuns(underlineRuns.Begin(), 0u, numberOfUnderlineRuns);
-
- //ABC are underlined
- DALI_TEST_EQUALS( underlineRuns[0u].glyphIndex, 0u, TEST_LOCATION);
- DALI_TEST_EQUALS( underlineRuns[1u].glyphIndex, 1u, TEST_LOCATION);
- DALI_TEST_EQUALS( underlineRuns[2u].glyphIndex, 2u, TEST_LOCATION);
-
- //GH are underlined
- DALI_TEST_EQUALS( underlineRuns[3u].glyphIndex, 5u, TEST_LOCATION);
- DALI_TEST_EQUALS( underlineRuns[4u].glyphIndex, 6u, TEST_LOCATION);
-
- END_TEST;
-
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) 2020 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.
- *
- */
-
-#include <iostream>
-#include <stdlib.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit/internal/controls/text-controls/text-label-impl.h>
-#include <dali-toolkit/internal/text/text-controller.h>
-#include <dali-toolkit/internal/text/text-controller-impl.h>
-
-using namespace Dali;
-using namespace Toolkit;
-using namespace Text;
-
-int UtcDaliTextLabelMarkupUnderline(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliTextLabelMarkupUnderline ");
-
- TextLabel textLabel = TextLabel::New();
-
- application.GetScene().Add( textLabel );
-
- textLabel.SetProperty( TextLabel::Property::TEXT, "<u>ABC</u>EF<u>GH</u>" );
- textLabel.SetProperty( TextLabel ::Property::ENABLE_MARKUP, true );
-
- application.SendNotification();
- application.Render();
-
- uint32_t expectedNumberOfUnderlinedGlyphs = 5u;
-
- Toolkit::Internal::TextLabel& textLabelImpl = GetImpl( textLabel );
- const Text::Length numberOfUnderlineRuns = textLabelImpl.getController()->GetTextModel()->GetNumberOfUnderlineRuns();
-
- DALI_TEST_EQUALS( numberOfUnderlineRuns, expectedNumberOfUnderlinedGlyphs, TEST_LOCATION );
-
- Vector<GlyphRun> underlineRuns;
- underlineRuns.Resize(numberOfUnderlineRuns);
- textLabelImpl.getController()->GetTextModel()->GetUnderlineRuns(underlineRuns.Begin(), 0u, numberOfUnderlineRuns);
-
- //ABC are underlined
- DALI_TEST_EQUALS( underlineRuns[0u].glyphIndex, 0u, TEST_LOCATION);
- DALI_TEST_EQUALS( underlineRuns[1u].glyphIndex, 1u, TEST_LOCATION);
- DALI_TEST_EQUALS( underlineRuns[2u].glyphIndex, 2u, TEST_LOCATION);
-
- //GH are underlined
- DALI_TEST_EQUALS( underlineRuns[3u].glyphIndex, 5u, TEST_LOCATION);
- DALI_TEST_EQUALS( underlineRuns[4u].glyphIndex, 6u, TEST_LOCATION);
-
- END_TEST;
-
-}
\ No newline at end of file
MarkupProcessData markupProcessData(colorRuns,
fontDescriptionRuns,
textModel->mLogicalModel->mEmbeddedItems,
- textModel->mLogicalModel->mAnchors,
- textModel->mLogicalModel->mUnderlinedCharacterRuns);
+ textModel->mLogicalModel->mAnchors);
if(textParameters.markupEnabled)
{
mColorRuns,
removedColorRuns);
- // This is needed until now for underline tag in mark-up processor
- // Process the underlined runs.
- Vector<UnderlinedCharacterRun> removedUnderlinedCharacterRuns;
- UpdateCharacterRuns<UnderlinedCharacterRun>(index,
- numberOfCharacters,
- totalNumberOfCharacters,
- mUnderlinedCharacterRuns,
- removedUnderlinedCharacterRuns);
-
// Process the background color runs.
Vector<ColorRun> removedBackgroundColorRuns;
UpdateCharacterRuns<ColorRun>(index,
#include <dali-toolkit/internal/text/font-run.h>
#include <dali-toolkit/internal/text/paragraph-run.h>
#include <dali-toolkit/internal/text/script-run.h>
-#include <dali-toolkit/internal/text/underlined-character-run.h>
namespace Dali
{
Vector<BidirectionalLineInfoRun> mBidirectionalLineInfo;
Vector<EmbeddedItem> mEmbeddedItems;
Vector<Anchor> mAnchors;
- Vector<UnderlinedCharacterRun> mUnderlinedCharacterRuns; ///< The underlined character run from markup-processor
BidirectionalLineRunIndex mBidirectionalLineIndex; ///< The last fetched bidirectional line info.
};
}
/**
- * @brief Initializes a underlined character run to its defaults.
- *
- * @param[in,out] underlinedCharacterRun The underelined character run to initialize.
- */
-void Initialize(UnderlinedCharacterRun& underlinedCharacterRun)
-{
- underlinedCharacterRun.characterRun.characterIndex = 0u;
- underlinedCharacterRun.characterRun.numberOfCharacters = 0u;
-}
-
-/**
* @brief Splits the tag string into the tag name and its attributes.
*
* The attributes are stored in a vector in the tag.
}
/**
- * @brief Processes a particular tag for the required run (color-run, font-run or underlined-character-run).
+ * @brief Processes a particular tag for the required run (color-run or font-run).
*
- * @tparam RunType Whether ColorRun , FontDescriptionRun or UnderlinedCharacterRun
+ * @tparam RunType Whether ColorRun or FontDescriptionRun
*
* @param[in/out] runsContainer The container containing all the runs
* @param[in/out] styleStack The style stack
* @param[in/out] markupProcessData The markup process data
* @param[in] fontRunIndex The font run index
* @param[in] colorRunIndex The color run index
- * @param[in] underlinedCharacterRunIndex The underlined character run index
*/
-void ResizeModelVectors(MarkupProcessData& markupProcessData, const StyleStack::RunIndex fontRunIndex, const StyleStack::RunIndex colorRunIndex, const StyleStack::RunIndex underlinedCharacterRunIndex)
+void ResizeModelVectors(MarkupProcessData& markupProcessData, const StyleStack::RunIndex fontRunIndex, const StyleStack::RunIndex colorRunIndex)
{
markupProcessData.fontRuns.Resize(fontRunIndex);
markupProcessData.colorRuns.Resize(colorRunIndex);
- markupProcessData.underlinedCharacterRuns.Resize(underlinedCharacterRunIndex);
#ifdef DEBUG_ENABLED
for(unsigned int i = 0; i < colorRunIndex; ++i)
StyleStack styleStack;
// Points the next free position in the vector of runs.
- StyleStack::RunIndex colorRunIndex = 0u;
- StyleStack::RunIndex fontRunIndex = 0u;
- StyleStack::RunIndex underlinedCharacterRunIndex = 0u;
+ StyleStack::RunIndex colorRunIndex = 0u;
+ StyleStack::RunIndex fontRunIndex = 0u;
// check tag reference
int colorTagReference = 0u;
int fontTagReference = 0u;
int iTagReference = 0u;
int bTagReference = 0u;
- int uTagReference = 0u;
// Give an initial default value to the model's vectors.
markupProcessData.colorRuns.Reserve(DEFAULT_VECTOR_SIZE);
markupProcessData.fontRuns.Reserve(DEFAULT_VECTOR_SIZE);
- markupProcessData.underlinedCharacterRuns.Reserve(DEFAULT_VECTOR_SIZE);
// Get the mark-up string buffer.
const char* markupStringBuffer = markupString.c_str();
} // <i></i>
else if(TokenComparison(XHTML_U_TAG, tag.buffer, tag.length))
{
- ProcessTagForRun<UnderlinedCharacterRun>(
- markupProcessData.underlinedCharacterRuns, styleStack, tag, characterIndex, underlinedCharacterRunIndex, uTagReference, [](const Tag& tag, UnderlinedCharacterRun& run) { });
- } // <u></u>
+ // TODO: If !tag.isEndTag, then create a new underline run.
+ // else Pop the top of the stack and set the number of characters of the run.
+ } // <u></u>
else if(TokenComparison(XHTML_B_TAG, tag.buffer, tag.length))
{
ProcessTagForRun<FontDescriptionRun>(
}
// Resize the model's vectors.
- ResizeModelVectors(markupProcessData, fontRunIndex, colorRunIndex, underlinedCharacterRunIndex);
+ ResizeModelVectors(markupProcessData, fontRunIndex, colorRunIndex);
}
} // namespace Text
#include <dali-toolkit/internal/text/color-run.h>
#include <dali-toolkit/internal/text/embedded-item.h>
#include <dali-toolkit/internal/text/font-description-run.h>
-#include <dali-toolkit/internal/text/underlined-character-run.h>
namespace Dali
{
MarkupProcessData(Vector<ColorRun>& colorRuns,
Vector<FontDescriptionRun>& fontRuns,
Vector<EmbeddedItem>& items,
- Vector<Anchor>& anchors,
- Vector<UnderlinedCharacterRun>& underlinedCharacterRuns)
+ Vector<Anchor>& anchors)
: colorRuns(colorRuns),
fontRuns(fontRuns),
items(items),
anchors(anchors),
- underlinedCharacterRuns(underlinedCharacterRuns),
markupProcessedText()
{
}
- Vector<ColorRun>& colorRuns; ///< The color runs.
- Vector<FontDescriptionRun>& fontRuns; ///< The font description runs.
- Vector<EmbeddedItem>& items; ///< The embedded items.
- Vector<Anchor>& anchors; ///< The anchors.
- Vector<UnderlinedCharacterRun>& underlinedCharacterRuns; ///< The underlined character runs.
- std::string markupProcessedText; ///< The mark-up string.
+ Vector<ColorRun>& colorRuns; ///< The color runs.
+ Vector<FontDescriptionRun>& fontRuns; ///< The font description runs.
+ Vector<EmbeddedItem>& items; ///< The embedded items.
+ Vector<Anchor>& anchors; ///< The anchors.
+ std::string markupProcessedText; ///< The mark-up string.
};
/**
mRight(0.0f),
mUnderlinePosition(0.0f),
mUnderlineThickness(0.0f),
- mMeshRecordIndex(0u),
- mUnderlineChunkId(0u)
+ mMeshRecordIndex(0u)
{
}
float mUnderlinePosition;
float mUnderlineThickness;
uint32_t mMeshRecordIndex;
- uint32_t mUnderlineChunkId;
};
struct MaxBlockSize
float currentUnderlineThickness,
std::vector<MeshRecord>& meshContainer,
Vector<TextCacheEntry>& newTextCache,
- Vector<Extent>& extents,
- uint32_t underlineChunkId)
+ Vector<Extent>& extents)
{
// Generate mesh data for this quad, plugging in our supplied position
AtlasManager::Mesh2D newMesh;
underlineGlyph,
currentUnderlinePosition,
currentUnderlineThickness,
- slot,
- underlineChunkId);
+ slot);
}
void CreateActors(const std::vector<MeshRecord>& meshContainer,
const Vector2* const positionsBuffer = positions.Begin();
const Vector2 lineOffsetPosition(minLineOffset, 0.f);
- //For septated underlined chunks. (this is for Markup case)
- uint32_t underlineChunkId = 0u; // give id for each chunk.
- bool isPreUnderlined = false; // status of underlined for previous glyph.
-
for(uint32_t i = 0, glyphSize = glyphs.Size(); i < glyphSize; ++i)
{
const GlyphInfo& glyph = *(glyphsBuffer + i);
}
lastUnderlinedFontId = glyph.fontId;
-
} // underline
AtlasGlyphManager::GlyphStyle style;
currentUnderlineThickness,
meshContainer,
newTextCache,
- extents,
- underlineChunkId);
+ extents);
lastFontId = glyph.fontId; // Prevents searching for existing blocksizes when string of the same fontId.
}
currentUnderlineThickness,
meshContainerOutline,
newTextCache,
- extents,
- 0u);
- }
-
-
- //The new underlined chunk. Add new id if they are not consecutive indices (this is for Markup case)
- // Examples: "Hello <u>World</u> Hello <u>World</u>", "<u>World</u> Hello <u>World</u>", "<u> World</u> Hello <u>World</u>"
- if( isPreUnderlined && (isPreUnderlined != isGlyphUnderlined))
- {
- underlineChunkId++;
+ extents);
}
- //Keep status of underlined for previous glyph to check consecutive indices
- isPreUnderlined = isGlyphUnderlined;
}
} // glyphs
bool underlineGlyph,
float underlinePosition,
float underlineThickness,
- AtlasManager::AtlasSlot& slot,
- uint32_t underlineChunkId)
+ AtlasManager::AtlasSlot& slot)
{
if(slot.mImageId)
{
right,
baseLine,
underlinePosition,
- underlineThickness,
- underlineChunkId);
+ underlineThickness);
}
return;
right,
baseLine,
underlinePosition,
- underlineThickness,
- underlineChunkId);
+ underlineThickness);
}
}
}
float right,
float baseLine,
float underlinePosition,
- float underlineThickness,
- uint32_t underlineChunkId)
+ float underlineThickness)
{
bool foundExtent = false;
for(Vector<Extent>::Iterator eIt = extents.Begin(),
eIt != eEndIt;
++eIt)
{
- if(Equals(baseLine, eIt->mBaseLine) && underlineChunkId == eIt->mUnderlineChunkId)
+ if(Equals(baseLine, eIt->mBaseLine))
{
foundExtent = true;
if(left < eIt->mLeft)
extent.mUnderlinePosition = underlinePosition;
extent.mUnderlineThickness = underlineThickness;
extent.mMeshRecordIndex = index;
- extent.mUnderlineChunkId = underlineChunkId;
extents.PushBack(extent);
}
}
// Combine the two buffers
imageBuffer = CombineImageBuffer(imageBuffer, backgroundImageBuffer, bufferWidth, bufferHeight);
}
-
- // Markup-Processor
-
- imageBuffer = ApplyMarkupProcessorOnPixelBuffer(imageBuffer, bufferWidth, bufferHeight, ignoreHorizontalAlignment, pixelFormat, penX, penY);
-
}
// Create the final PixelData for the combined image buffer
return combinedPixelBuffer;
}
-Devel::PixelBuffer Typesetter::ApplyMarkupProcessorOnPixelBuffer(Devel::PixelBuffer topPixelBuffer, const unsigned int bufferWidth, const unsigned int bufferHeight, bool ignoreHorizontalAlignment, Pixel::Format pixelFormat, int horizontalOffset, int verticalOffset)
-{
- // Apply the markup-Processor if enabled
- const bool markupProcessorEnabled = mModel->IsMarkupProcessorEnabled();
- if(markupProcessorEnabled)
- {
- // Underline-tags (this is for Markup case)
- // Get the underline runs.
- const Length numberOfUnderlineRuns = mModel->GetNumberOfUnderlineRuns();
- Vector<GlyphRun> underlineRuns;
- underlineRuns.Resize(numberOfUnderlineRuns);
- mModel->GetUnderlineRuns(underlineRuns.Begin(), 0u, numberOfUnderlineRuns);
-
- // Iterate on the consecutive underlined glyph run and connect them into one chunk of underlined characters.
- Vector<GlyphRun>::ConstIterator itGlyphRun = underlineRuns.Begin();
- Vector<GlyphRun>::ConstIterator endItGlyphRun = underlineRuns.End();
- GlyphIndex startGlyphIndex, endGlyphIndex;
-
- //The outer loop to iterate on the separated chunks of underlined glyph runs
- while(itGlyphRun != endItGlyphRun)
- {
- startGlyphIndex = itGlyphRun->glyphIndex;
- endGlyphIndex = startGlyphIndex;
- //The inner loop to make a connected underline for the consecutive characters
- do
- {
- endGlyphIndex += itGlyphRun->numberOfGlyphs;
- itGlyphRun++;
- } while(itGlyphRun != endItGlyphRun && itGlyphRun->glyphIndex == endGlyphIndex);
-
- endGlyphIndex--;
-
- // Create the image buffer for underline
- Devel::PixelBuffer underlineImageBuffer = CreateImageBuffer(bufferWidth, bufferHeight, Typesetter::STYLE_UNDERLINE, ignoreHorizontalAlignment, pixelFormat, horizontalOffset, verticalOffset, startGlyphIndex, endGlyphIndex);
- // Combine the two buffers
- topPixelBuffer = CombineImageBuffer(topPixelBuffer, underlineImageBuffer, bufferWidth, bufferHeight);
- }
- }
-
- return topPixelBuffer;
-}
-
Typesetter::Typesetter(const ModelInterface* const model)
: mModel(new ViewModel(model))
{
*/
Devel::PixelBuffer CombineImageBuffer(Devel::PixelBuffer topPixelBuffer, Devel::PixelBuffer bottomPixelBuffer, const unsigned int bufferWidth, const unsigned int bufferHeightbool);
- /**
- * @brief Apply behaviour of tags if the markup-processor is enabled.
- *
- * The properties on TextLabel override the behavior of Markup.
- * Because the markup will be the bottom layer buffer
- * - i.e: If you set property UNDERLINE to enabled and blue.
- * And the TEXT is "<color value='green'>Hello</color> <u>World</u> <i>Hello</i> <b>World</b>".
- * Then the output of the whole text is underlined by blue line.
- *
- * @param[in] topPixelBuffer The top layer buffer.
- * @param[in] bufferWidth The width of the image buffer.
- * @param[in] bufferHeight The height of the image buffer.
- * @param[in] ignoreHorizontalAlignment Whether to ignore the horizontal alignment, not ignored by default.
- * @param[in] pixelFormat The format of the pixel in the image that the text is rendered as (i.e. either Pixel::BGRA8888 or Pixel::L8).
- * @param[in] horizontalOffset The horizontal offset to be added to the glyph's position.
- * @param[in] verticalOffset The vertical offset to be added to the glyph's position.
- *
- * @return The image buffer with the markup.
- */
- Devel::PixelBuffer ApplyMarkupProcessorOnPixelBuffer(Devel::PixelBuffer topPixelBuffer, const unsigned int bufferWidth, const unsigned int bufferHeight, bool ignoreHorizontalAlignment, Pixel::Format pixelFormat, int horizontalOffset, int verticalOffset);
-
protected:
/**
* @brief A reference counted object may only be deleted by calling Unreference().
return mModel->IsBackgroundEnabled();
}
-bool ViewModel::IsMarkupProcessorEnabled() const
-{
- return mModel->IsMarkupProcessorEnabled();
-}
-
void ViewModel::ElideGlyphs()
{
mIsTextElided = false;
bool IsBackgroundEnabled() const override;
/**
- * @copydoc ModelInterface::IsMarkupProcessorEnabled()
- */
- bool IsMarkupProcessorEnabled() const override;
-
- /**
* @brief Does the text elide.
*
* It stores a copy of the visible glyphs and removes as many glyphs as needed
Vector<Character>& srcCharacters = mModel->mLogicalModel->mText;
Vector<Character> displayCharacters;
bool useHiddenText = false;
- if(mHiddenInput && mEventData != nullptr && !mEventData->mIsShowingPlaceholderText)
+ if(mHiddenInput && mEventData != NULL && !mEventData->mIsShowingPlaceholderText)
{
mHiddenInput->Substitute(srcCharacters, displayCharacters);
useHiddenText = true;
TextAbstraction::FontDescription defaultFontDescription;
TextAbstraction::PointSize26Dot6 defaultPointSize = TextAbstraction::FontClient::DEFAULT_POINT_SIZE * mFontSizeScale;
- if(IsShowingPlaceholderText() && mEventData && (nullptr != mEventData->mPlaceholderFont))
+ if(IsShowingPlaceholderText() && mEventData && (NULL != mEventData->mPlaceholderFont))
{
// If the placeholder font is set specifically, only placeholder font is changed.
defaultFontDescription = mEventData->mPlaceholderFont->mFontDescription;
defaultPointSize = mEventData->mPlaceholderFont->mDefaultPointSize * mFontSizeScale * 64u;
}
}
- else if(nullptr != mFontDefaults)
+ else if(NULL != mFontDefaults)
{
// Set the normal font and the placeholder font.
defaultFontDescription = mFontDefaults->mFontDescription;
// Create the 'number of glyphs' per character and the glyph to character conversion tables.
mModel->mVisualModel->CreateGlyphsPerCharacterTable(startIndex, mTextUpdateInfo.mStartGlyphIndex, requestedNumberOfCharacters);
mModel->mVisualModel->CreateCharacterToGlyphTable(startIndex, mTextUpdateInfo.mStartGlyphIndex, requestedNumberOfCharacters);
-
- updated = true;
+ updated = true;
}
const Length numberOfGlyphs = glyphs.Count() - currentNumberOfGlyphs;
updated = true;
}
- if((nullptr != mEventData) &&
+ if((NULL != mEventData) &&
mEventData->mPreEditFlag &&
(0u != mModel->mVisualModel->mCharactersToGlyph.Count()))
{
underlineRun.glyphIndex = attrData.startIndex + numberOfCommit;
underlineRun.numberOfGlyphs = numberOfIndices;
mModel->mVisualModel->mUnderlineRuns.PushBack(underlineRun);
-
- //Mark-up processor case
- if(mModel->mVisualModel->IsMarkupProcessorEnabled())
- {
- CopyUnderlinedFromLogicalToVisualModels(false);
- }
break;
}
case Dali::InputMethodContext::PreeditStyle::REVERSE:
underlineRun.glyphIndex = attrData.startIndex + numberOfCommit;
underlineRun.numberOfGlyphs = numberOfIndices;
mModel->mVisualModel->mUnderlineRuns.PushBack(underlineRun);
-
- //Mark-up processor case
- if(mModel->mVisualModel->IsMarkupProcessorEnabled())
- {
- CopyUnderlinedFromLogicalToVisualModels(false);
- }
break;
}
case Dali::InputMethodContext::PreeditStyle::CUSTOM_PLATFORM_STYLE_2:
underlineRun.glyphIndex = attrData.startIndex + numberOfCommit;
underlineRun.numberOfGlyphs = numberOfIndices;
mModel->mVisualModel->mUnderlineRuns.PushBack(underlineRun);
-
- //Mark-up processor case
- if(mModel->mVisualModel->IsMarkupProcessorEnabled())
- {
- CopyUnderlinedFromLogicalToVisualModels(false);
- }
break;
}
case Dali::InputMethodContext::PreeditStyle::CUSTOM_PLATFORM_STYLE_3:
underlineRun.glyphIndex = attrData.startIndex + numberOfCommit;
underlineRun.numberOfGlyphs = numberOfIndices;
mModel->mVisualModel->mUnderlineRuns.PushBack(underlineRun);
-
- //Mark-up processor case
- if(mModel->mVisualModel->IsMarkupProcessorEnabled())
- {
- CopyUnderlinedFromLogicalToVisualModels(false);
- }
break;
}
case Dali::InputMethodContext::PreeditStyle::CUSTOM_PLATFORM_STYLE_4:
underlineRun.glyphIndex = attrData.startIndex + numberOfCommit;
underlineRun.numberOfGlyphs = numberOfIndices;
mModel->mVisualModel->mUnderlineRuns.PushBack(underlineRun);
-
- //Mark-up processor case
- if(mModel->mVisualModel->IsMarkupProcessorEnabled())
- {
- CopyUnderlinedFromLogicalToVisualModels(false);
- }
break;
}
case Dali::InputMethodContext::PreeditStyle::NONE:
updated = true;
}
- if((NO_OPERATION != (SHAPE_TEXT & operations)) &&
- ! ((nullptr != mEventData) &&
- mEventData->mPreEditFlag &&
- (0u != mModel->mVisualModel->mCharactersToGlyph.Count())))
- {
- //Mark-up processor case
- if(mModel->mVisualModel->IsMarkupProcessorEnabled())
- {
- CopyUnderlinedFromLogicalToVisualModels(true);
- }
-
- updated = true;
- }
-
-
// The estimated number of lines. Used to avoid reallocations when layouting.
mTextUpdateInfo.mEstimatedNumberOfLines = std::max(mModel->mVisualModel->mLines.Count(), mModel->mLogicalModel->mParagraphInfo.Count());
float Controller::Impl::GetDefaultFontLineHeight()
{
FontId defaultFontId = 0u;
- if(nullptr == mFontDefaults)
+ if(NULL == mFontDefaults)
{
TextAbstraction::FontDescription fontDescription;
defaultFontId = mFontClient.GetFontId(fontDescription, TextAbstraction::FontClient::DEFAULT_POINT_SIZE * mFontSizeScale);
void Controller::Impl::ChangeState(EventData::State newState)
{
- if(nullptr == mEventData)
+ if(NULL == mEventData)
{
// Nothing to do if there is no text input.
return;
CharacterIndex Controller::Impl::CalculateNewCursorIndex(CharacterIndex index) const
{
- if(nullptr == mEventData)
+ if(NULL == mEventData)
{
// Nothing to do if there is no text input.
return 0u;
void Controller::Impl::UpdateCursorPosition(const CursorInfo& cursorInfo)
{
DALI_LOG_INFO(gLogFilter, Debug::Verbose, "-->Controller::UpdateCursorPosition %p\n", this);
- if(nullptr == mEventData)
+ if(NULL == mEventData)
{
// Nothing to do if there is no text input.
DALI_LOG_INFO(gLogFilter, Debug::Verbose, "<--Controller::UpdateCursorPosition no event data\n");
void Controller::Impl::RequestRelayout()
{
- if(nullptr != mControlInterface)
+ if(NULL != mControlInterface)
{
mControlInterface->RequestTextRelayout();
}
return actor;
}
-void Controller::Impl::CopyUnderlinedFromLogicalToVisualModels(bool shouldClearPreUnderlineRuns)
-{
- //Underlined character runs for markup-processor
- const Vector<UnderlinedCharacterRun>& underlinedCharacterRuns = mModel->mLogicalModel->mUnderlinedCharacterRuns;
- const Vector<GlyphIndex>& charactersToGlyph = mModel->mVisualModel->mCharactersToGlyph;
- const Vector<Length>& glyphsPerCharacter = mModel->mVisualModel->mGlyphsPerCharacter;
-
- if(shouldClearPreUnderlineRuns)
- {
- mModel->mVisualModel->mUnderlineRuns.Clear();
- }
-
- for(Vector<UnderlinedCharacterRun>::ConstIterator it = underlinedCharacterRuns.Begin(), endIt = underlinedCharacterRuns.End(); it != endIt; ++it)
- {
- CharacterIndex characterIndex = it->characterRun.characterIndex;
- Length numberOfCharacters = it->characterRun.numberOfCharacters;
- for(Length index=0u; index<numberOfCharacters; index++)
- {
- GlyphRun underlineGlyphRun;
- underlineGlyphRun.glyphIndex = charactersToGlyph[characterIndex + index];
- underlineGlyphRun.numberOfGlyphs = glyphsPerCharacter[characterIndex + index];
- mModel->mVisualModel->mUnderlineRuns.PushBack(underlineGlyphRun);
- }
- }
-}
-
} // namespace Text
} // namespace Toolkit
// Declared private and left undefined to avoid copies.
Impl& operator=(const Impl&);
- /**
- * @brief Copy Underlined-Character-Runs from Logical-Model to Underlined-Glyph-Runs in Visual-Model
- *
- * @param shouldClearPreUnderlineRuns Whether should clear the existing Underlined-Glyph-Runs in Visual-Model
- */
- void CopyUnderlinedFromLogicalToVisualModels(bool shouldClearPreUnderlineRuns);
-
public:
ControlInterface* mControlInterface; ///< Reference to the text controller.
EditableControlInterface* mEditableControlInterface; ///< Reference to the editable text controller.
MarkupProcessData markupProcessData(logicalModel->mColorRuns,
logicalModel->mFontDescriptionRuns,
logicalModel->mEmbeddedItems,
- logicalModel->mAnchors,
- logicalModel->mUnderlinedCharacterRuns);
+ logicalModel->mAnchors);
Length textSize = 0u;
const uint8_t* utf8 = NULL;
GetText(text);
SetText(text);
}
-
- mImpl->mModel->mVisualModel->SetMarkupProcessorEnabled(enable);
}
bool Controller::IsMarkupProcessorEnabled() const
* @return The background state.
*/
virtual bool IsBackgroundEnabled() const = 0;
-
- /**
- * @brief Returns whether markup-processor is enabled or not.
- *
- * @return The markup-processor state.
- */
- virtual bool IsMarkupProcessorEnabled() const = 0;
};
} // namespace Text
return mVisualModel->IsBackgroundEnabled();
}
-bool Model::IsMarkupProcessorEnabled() const
-{
- return mVisualModel->IsMarkupProcessorEnabled();
-}
-
Model::Model()
: mLogicalModel(),
mVisualModel(),
*/
bool IsBackgroundEnabled() const override;
- /**
- * @copydoc ModelInterface::IsMarkupProcessorEnabled()
- */
- bool IsMarkupProcessorEnabled() const override;
-
private: // Private contructors & copy operator.
/**
* @brief Private constructor.
+++ /dev/null
-#ifndef DALI_TOOLKIT_TEXT_UNDERLINED_CHARACTER_RUN_H
-#define DALI_TOOLKIT_TEXT_UNDERLINED_CHARACTER_RUN_H
-
-/*
- * Copyright (c) 2021 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 <dali/public-api/math/vector4.h>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/internal/text/character-run.h>
-#include <dali-toolkit/internal/text/glyph-run.h>
-
-namespace Dali
-{
-namespace Toolkit
-{
-namespace Text
-{
-/**
- * @brief Run of underlined characters with same properties.
- */
-struct UnderlinedCharacterRun
-{
- CharacterRun characterRun; ///< The initial character index and the number of characters of the run.
- //TODO: add properties like color, height and style
- //Vector4 color; ///< The color of underline.
- //float height; ///< The height of underline.
-};
-
-} // namespace Text
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // DALI_TOOLKIT_TEXT_UNDERLINED_CHARACTER_RUN_H
mBackgroundEnabled = enabled;
}
-void VisualModel::SetMarkupProcessorEnabled(bool enabled)
-{
- mMarkupProcessorEnabled = enabled;
-}
-
const Vector4& VisualModel::GetTextColor() const
{
return mTextColor;
return mBackgroundEnabled;
}
-bool VisualModel::IsMarkupProcessorEnabled() const
-{
- return mMarkupProcessorEnabled;
-}
-
Length VisualModel::GetNumberOfUnderlineRuns() const
{
return mUnderlineRuns.Count();
mCachedLineIndex(0u),
mUnderlineEnabled(false),
mUnderlineColorSet(false),
- mBackgroundEnabled(false),
- mMarkupProcessorEnabled(false)
+ mBackgroundEnabled(false)
{
}
*/
bool IsBackgroundEnabled() const;
- /**
- * @brief Sets whether the text has a markup-processor or not.
- *
- * @param[in] enabled true if the text has a markup-processor.
- */
- void SetMarkupProcessorEnabled(bool enabled);
-
- /**
- * @brief Returns whether the text has a markup-processor or not.
- *
- * @return whether the text has a markup-processor or not.
- */
- bool IsMarkupProcessorEnabled() const;
-
protected:
/**
* @brief A reference counted object may only be deleted by calling Unreference().
bool mUnderlineEnabled : 1; ///< Underline enabled flag
bool mUnderlineColorSet : 1; ///< Has the underline color been explicitly set?
bool mBackgroundEnabled : 1; ///< Background enabled flag
- bool mMarkupProcessorEnabled : 1; ///< Markup-processor enabled flag
};
} // namespace Text
shadowEnabled = true;
}
- const bool underlineEnabled = mController->GetTextModel()->IsUnderlineEnabled();
- const bool outlineEnabled = (mController->GetTextModel()->GetOutlineWidth() > Math::MACHINE_EPSILON_1);
- const bool backgroundEnabled = mController->GetTextModel()->IsBackgroundEnabled();
- const bool markupProcessorEnabled = mController->IsMarkupProcessorEnabled();
+ const bool underlineEnabled = mController->GetTextModel()->IsUnderlineEnabled();
+ const bool outlineEnabled = (mController->GetTextModel()->GetOutlineWidth() > Math::MACHINE_EPSILON_1);
+ const bool backgroundEnabled = mController->GetTextModel()->IsBackgroundEnabled();
+ ;
- const bool styleEnabled = (shadowEnabled || underlineEnabled || outlineEnabled || backgroundEnabled || markupProcessorEnabled);
+ const bool styleEnabled = (shadowEnabled || underlineEnabled || outlineEnabled || backgroundEnabled);
AddRenderer(control, relayoutSize, hasMultipleTextColors, containsColorGlyph, styleEnabled);