+ Actor shadowActor = CreateMeshActor(textControl, animatablePropertyIndex, color, meshRecord, textSize, STYLE_DROP_SHADOW);
+#if defined(DEBUG_ENABLED)
+ shadowActor.SetProperty(Dali::Actor::Property::NAME, "Text Shadow renderable actor");
+#endif
+ // Offset shadow in x and y
+ shadowActor.RegisterProperty("uOffset", shadowOffset);
+ Dali::Renderer renderer(shadowActor.GetRendererAt(0));
+ int depthIndex = renderer.GetProperty<int>(Dali::Renderer::Property::DEPTH_INDEX);
+ renderer.SetProperty(Dali::Renderer::Property::DEPTH_INDEX, depthIndex - 1);
+ mActor.Add(shadowActor);
+ }
+
+ if(hasRenderer)
+ {
+ mActor.Add(actor);
+ }
+ }
+ }
+
+ void AddGlyphs(Text::ViewInterface& view,
+ Actor textControl,
+ Property::Index animatablePropertyIndex,
+ const Vector<Vector2>& positions,
+ const Vector<GlyphInfo>& glyphs,
+ const Vector4& defaultColor,
+ const Vector4* const colorsBuffer,
+ const ColorIndex* const colorIndicesBuffer,
+ int depth,
+ float minLineOffset)
+ {
+ AtlasManager::AtlasSlot slot;
+ slot.mImageId = 0u;
+ slot.mAtlasId = 0u;
+
+ AtlasManager::AtlasSlot slotOutline;
+ slotOutline.mImageId = 0u;
+ slotOutline.mAtlasId = 0u;
+
+ std::vector<MeshRecord> meshContainer;
+ std::vector<MeshRecord> meshContainerOutline;
+ Vector<Extent> extents;
+ Vector<Extent> strikethroughExtents;
+ mDepth = depth;
+
+ const Vector2& textSize(view.GetLayoutSize());
+ const Vector2 halfTextSize(textSize * 0.5f);
+ const Vector2& shadowOffset(view.GetShadowOffset());
+ const Vector4& shadowColor(view.GetShadowColor());
+ const bool underlineEnabled = view.IsUnderlineEnabled();
+ const uint16_t outlineWidth = view.GetOutlineWidth();
+ const Vector4& outlineColor(view.GetOutlineColor());
+ const bool isOutline = 0u != outlineWidth;
+ const GlyphInfo* hyphens = view.GetHyphens();
+ const Length* hyphenIndices = view.GetHyphenIndices();
+ const Length hyphensCount = view.GetHyphensCount();
+ const bool strikethroughEnabled = view.IsStrikethroughEnabled();
+ const float characterSpacing(view.GetCharacterSpacing());
+
+ // Elided text info. Indices according to elided text.
+ const auto startIndexOfGlyphs = view.GetStartIndexOfElidedGlyphs();
+ const auto firstMiddleIndexOfElidedGlyphs = view.GetFirstMiddleIndexOfElidedGlyphs();
+ const auto secondMiddleIndexOfElidedGlyphs = view.GetSecondMiddleIndexOfElidedGlyphs();
+
+ const bool useDefaultColor = (NULL == colorsBuffer);
+
+ // Get a handle of the font client. Used to retrieve the bitmaps of the glyphs.
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+
+ // Get the underline runs.
+ const Length numberOfUnderlineRuns = view.GetNumberOfUnderlineRuns();
+ Vector<UnderlinedGlyphRun> underlineRuns;
+ underlineRuns.Resize(numberOfUnderlineRuns);
+ view.GetUnderlineRuns(underlineRuns.Begin(),
+ 0u,
+ numberOfUnderlineRuns);
+
+ // Aggregate underline-style-properties from view
+ const UnderlineStyleProperties viewUnderlineProperties{view.GetUnderlineType(),
+ view.GetUnderlineColor(),
+ view.GetUnderlineHeight(),
+ view.GetDashedUnderlineGap(),
+ view.GetDashedUnderlineWidth(),
+ true,
+ true,
+ true,
+ true,
+ true};
+
+ float maxUnderlineHeight = viewUnderlineProperties.height;
+
+ // Get the strikethrough runs.
+ const Length numberOfStrikethroughRuns = view.GetNumberOfStrikethroughRuns();
+ Vector<StrikethroughGlyphRun> strikethroughRuns;
+ strikethroughRuns.Resize(numberOfStrikethroughRuns);
+ view.GetStrikethroughRuns(strikethroughRuns.Begin(), 0u, numberOfStrikethroughRuns);
+
+ const StrikethroughStyleProperties viewStrikethroughProperties{view.GetStrikethroughColor(),
+ view.GetStrikethroughHeight(),
+ true,
+ true};
+
+ float maxStrikethroughHeight = viewStrikethroughProperties.height;
+
+ FontId lastFontId = 0;
+ Style style = STYLE_NORMAL;
+ float currentUnderlinePosition = ZERO;
+ bool thereAreUnderlinedGlyphs = false;
+ bool thereAreStrikethroughGlyphs = false;
+
+ if(fabsf(shadowOffset.x) > Math::MACHINE_EPSILON_1 || fabsf(shadowOffset.y) > Math::MACHINE_EPSILON_1)
+ {
+ style = STYLE_DROP_SHADOW;
+ }
+
+ CalculateBlocksSize(glyphs);
+
+ // Avoid emptying mTextCache (& removing references) until after incremented references for the new text
+ Vector<TextCacheEntry> newTextCache;
+ const GlyphInfo* const glyphsBuffer = glyphs.Begin();
+ const Vector2* const positionsBuffer = positions.Begin();
+ const Vector2 lineOffsetPosition(minLineOffset, 0.f);
+ uint32_t hyphenIndex = 0;
+
+ //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.
+ std::map<uint32_t, UnderlineStyleProperties> mapUnderlineChunkIdWithProperties; // mapping underlineChunkId with UnderlineStyleProperties to get properties of underlined chunk
+ UnderlineStyleProperties preUnderlineProperties = viewUnderlineProperties; // the previous UnderlineStyleProperties
+
+ //For septated strikethrough chunks. (this is for Markup case)
+ uint32_t strikethroughChunkId = 0u; // give id for each chunk.
+ bool isPreStrikethrough = false; // status of strikethrough for previous glyph.
+ std::map<uint32_t, StrikethroughStyleProperties> mapStrikethroughChunkIdWithProperties; // mapping strikethroughChunkId with StrikethroughStyleProperties to get properties of strikethrough chunk
+ StrikethroughStyleProperties preStrikethroughProperties = viewStrikethroughProperties; // the previous StrikethroughStyleProperties
+
+ const Character* textBuffer = view.GetTextBuffer();
+ float calculatedAdvance = 0.f;
+ const Vector<CharacterIndex>& glyphToCharacterMap = view.GetGlyphsToCharacters();
+ const CharacterIndex* glyphToCharacterMapBuffer = glyphToCharacterMap.Begin();
+
+ //Skip hyphenIndices less than startIndexOfGlyphs or between two middle of elided text
+ if(hyphenIndices)
+ {
+ while((hyphenIndex < hyphensCount) && (hyphenIndices[hyphenIndex] < startIndexOfGlyphs ||
+ (hyphenIndices[hyphenIndex] > firstMiddleIndexOfElidedGlyphs && hyphenIndices[hyphenIndex] < secondMiddleIndexOfElidedGlyphs)))
+ {
+ ++hyphenIndex;
+ }
+ }
+
+ //To keep the last fontMetrics of lastDecorativeLinesFontId
+ FontId lastDecorativeLinesFontId = 0; // DecorativeLines like Undeline and Strikethrough
+ FontMetrics lastDecorativeLinesFontMetrics;
+ fontClient.GetFontMetrics(lastDecorativeLinesFontId, lastDecorativeLinesFontMetrics);
+
+ // Iteration on glyphs
+ for(uint32_t i = 0, glyphSize = glyphs.Size(); i < glyphSize; ++i)
+ {
+ GlyphInfo glyph;
+ bool addHyphen = ((hyphenIndex < hyphensCount) && hyphenIndices && ((i + startIndexOfGlyphs) == hyphenIndices[hyphenIndex]));
+ if(addHyphen && hyphens)
+ {
+ glyph = hyphens[hyphenIndex];
+ i--;
+ }
+ else
+ {
+ glyph = *(glyphsBuffer + i);
+ }
+
+ Vector<UnderlinedGlyphRun>::ConstIterator currentUnderlinedGlyphRunIt = underlineRuns.End();
+ const bool isGlyphUnderlined = underlineEnabled || IsGlyphUnderlined(i, underlineRuns, currentUnderlinedGlyphRunIt);
+ const UnderlineStyleProperties currentUnderlineProperties = GetCurrentUnderlineProperties(i, isGlyphUnderlined, underlineRuns, currentUnderlinedGlyphRunIt, viewUnderlineProperties);
+ float currentUnderlineHeight = currentUnderlineProperties.height;
+ thereAreUnderlinedGlyphs = thereAreUnderlinedGlyphs || isGlyphUnderlined;
+
+ Vector<StrikethroughGlyphRun>::ConstIterator currentStrikethroughGlyphRunIt = strikethroughRuns.End();
+ const bool isGlyphStrikethrough = strikethroughEnabled || IsGlyphStrikethrough(i, strikethroughRuns, currentStrikethroughGlyphRunIt);
+ const StrikethroughStyleProperties currentStrikethroughProperties = GetCurrentStrikethroughProperties(i, isGlyphStrikethrough, strikethroughRuns, currentStrikethroughGlyphRunIt, viewStrikethroughProperties);
+ float currentStrikethroughHeight = currentStrikethroughProperties.height;
+ thereAreStrikethroughGlyphs = thereAreStrikethroughGlyphs || isGlyphStrikethrough;
+
+ // No operation for white space
+ if(glyph.width && glyph.height)
+ {
+ // Check and update decorative-lines informations
+ if(isGlyphUnderlined || isGlyphStrikethrough)
+ {
+ bool isDecorativeLinesFontIdUpdated = false;
+ // Are we still using the same fontId as previous
+ if(glyph.fontId != lastDecorativeLinesFontId)