+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->GetLineLayoutForBox\n" );
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, " initial glyph index : %d\n", lineLayout.glyphIndex );
+ // Stores temporary line layout which has not been added to the final line layout.
+ LineLayout tmpLineLayout;
+
+ const bool isMultiline = mLayout == MULTI_LINE_BOX;
+ const GlyphIndex lastGlyphIndex = parameters.totalNumberOfGlyphs - 1u;
+
+ // If the first glyph has a negative bearing its absolute value needs to be added to the line length.
+ // In the case the line starts with a right to left character the bearing needs to be substracted to the line length.
+ const GlyphInfo& glyphInfo = *( parameters.glyphsBuffer + lineLayout.glyphIndex );
+ float initialHorizontalBearing = glyphInfo.xBearing;
+
+ lineLayout.characterIndex = *( parameters.glyphsToCharactersBuffer + lineLayout.glyphIndex );
+ const CharacterDirection firstCharacterDirection = ( NULL == parameters.characterDirectionBuffer ) ? false : *( parameters.characterDirectionBuffer + lineLayout.characterIndex );
+
+ if( RTL == firstCharacterDirection )
+ {
+ initialHorizontalBearing = -initialHorizontalBearing;
+
+ if( 0.f < glyphInfo.xBearing )
+ {
+ tmpLineLayout.length = glyphInfo.xBearing;
+ initialHorizontalBearing = 0.f;
+ }
+ }
+ else
+ {
+ if( 0.f > glyphInfo.xBearing )
+ {
+ tmpLineLayout.length = -glyphInfo.xBearing;
+ initialHorizontalBearing = 0.f;
+ }
+ }
+
+ // Calculate the line height if there is no characters.
+ FontId lastFontId = glyphInfo.fontId;
+ UpdateLineHeight( lastFontId, tmpLineLayout );
+
+ const float boundingBoxWidth = parameters.boundingBox.width - initialHorizontalBearing;