- // Add as well any previous white space length.
- tmpLineLayout.length += tmpLineLayout.wsLengthEndOfLine + glyphMetrics.advance;
-
- // An extra space may be added to the line for the first and last glyph of the line.
- // If the bearing of the first glyph is negative, its positive value needs to be added.
- // If the bearing plus the width of the last glyph is greater than the advance, the difference
- // needs to be added.
-
- if( characterDirection == paragraphDirection )
- {
- if( RTL == characterDirection )
- {
- // <--
- // | Rrrrr|
- // or
- // | Rllrrr|
- // or
- // |lllrrrrr|
- // | Rll|
- //
-
- tmpExtraBearing = ( 0.f > glyphMetrics.xBearing ) ? -glyphMetrics.xBearing : 0.f;
- }
- else // LTR
- {
- // -->
- // |lllL |
- // or
- // |llrrL |
- // or
- // |lllllrrr|
- // |rrL |
- //
-
- const float extraWidth = glyphMetrics.xBearing + glyphMetrics.width - glyphMetrics.advance;
- tmpExtraWidth = ( 0.f < extraWidth ) ? extraWidth : 0.f;
- }
- }
- else
- {
- if( characterDirection != previousCharacterDirection )
- {
- if( RTL == characterDirection )
- {
- // -->
- // |lllR |
-
- const float extraWidth = glyphMetrics.xBearing + glyphMetrics.width - glyphMetrics.advance;
- tmpExtraWidth = ( 0.f < extraWidth ) ? extraWidth : 0.f;
- }
- else // LTR
- {
- // <--
- // | Lrrrr|
-
- tmpExtraBearing = ( 0.f > glyphMetrics.xBearing ) ? -glyphMetrics.xBearing : 0.f;
- }
- }
- else if( characterDirection == firstCharacterDirection )
- {
- if( RTL == characterDirection )
- {
- // -->
- // |llllllrr|
- // |Rr |
-
- tmpExtraBearing = ( 0.f > glyphMetrics.xBearing ) ? -glyphMetrics.xBearing : 0.f;
- }
- else // LTR
- {
- // <--
- // |llllrrrr|
- // | llL|
-
- const float extraWidth = glyphMetrics.xBearing + glyphMetrics.width - glyphMetrics.advance;
- tmpExtraWidth = ( 0.f < extraWidth ) ? extraWidth : 0.f;
- }
- }
- }
+ tmpLineLayout.previousAdvance = ( glyphMetrics.advance + parameters.interGlyphExtraAdvance );
+ tmpLineLayout.penX += tmpLineLayout.previousAdvance + tmpLineLayout.wsLengthEndOfLine;
+ tmpLineLayout.length = tmpLineLayout.penX;