/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
LineLayout tmpLineLayout;
const bool isMultiline = mLayout == MULTI_LINE_BOX;
+ const bool isWordLaidOut = parameters.lineWrapMode == Text::LineWrap::WORD;
// The last glyph to be laid-out.
const GlyphIndex lastGlyphOfParagraphPlusOne = parameters.startGlyphIndex + parameters.numberOfGlyphs;
if( isMultiline &&
( TextAbstraction::WORD_BREAK == wordBreakInfo ) )
{
- oneWordLaidOut = true;
+ oneWordLaidOut = isWordLaidOut;
DALI_LOG_INFO( gLogFilter, Debug::Verbose, " One word laid-out\n" );
// Current glyph is the last one of the current word.
void SetGlyphPositions( const GlyphInfo* const glyphsBuffer,
Length numberOfGlyphs,
+ float outlineWidth,
Vector2* glyphPositionsBuffer )
{
// Traverse the glyphs and set the positions.
// so the penX position needs to be moved to the right.
const GlyphInfo& glyph = *glyphsBuffer;
- float penX = ( 0.f > glyph.xBearing ) ? -glyph.xBearing : 0.f;
+ float penX = ( 0.f > glyph.xBearing ) ? -glyph.xBearing + outlineWidth : outlineWidth;
+
for( GlyphIndex i = 0u; i < numberOfGlyphs; ++i )
{
SetGlyphPositions( layoutParameters.glyphsBuffer + lineRun->glyphRun.glyphIndex,
ellipsisLayout.numberOfGlyphs,
+ layoutParameters.outlineWidth,
glyphPositionsBuffer + lineRun->glyphRun.glyphIndex - layoutParameters.startGlyphIndex );
}
// Sets the positions of the glyphs.
SetGlyphPositions( layoutParameters.glyphsBuffer + index,
layout.numberOfGlyphs,
+ layoutParameters.outlineWidth,
glyphPositionsBuffer + index - layoutParameters.startGlyphIndex );
// Updates the vertical pen's position.
const CharacterIndex characterVisualIndex = bidiLine.characterRun.characterIndex + *bidiLine.visualToLogicalMap;
const GlyphInfo& glyph = *( layoutParameters.glyphsBuffer + *( layoutParameters.charactersToGlyphsBuffer + characterVisualIndex ) );
- float penX = ( 0.f > glyph.xBearing ) ? -glyph.xBearing : 0.f;
+ float penX = ( 0.f > glyph.xBearing ) ? -glyph.xBearing - layoutParameters.outlineWidth : -layoutParameters.outlineWidth;
Vector2* glyphPositionsBuffer = glyphPositions.Begin();
void Align( const Size& size,
CharacterIndex startIndex,
Length numberOfCharacters,
- HorizontalAlignment horizontalAlignment,
+ Text::HorizontalAlignment::Type horizontalAlignment,
Vector<LineRun>& lines,
float& alignmentOffset )
{
}
void CalculateHorizontalAlignment( float boxWidth,
- HorizontalAlignment horizontalAlignment,
+ HorizontalAlignment::Type horizontalAlignment,
LineRun& line )
{
line.alignmentOffset = 0.f;
const bool isRTL = RTL == line.direction;
float lineLength = line.width;
- HorizontalAlignment alignment = horizontalAlignment;
+ HorizontalAlignment::Type alignment = horizontalAlignment;
if( isRTL )
{
// Swap the alignment type if the line is right to left.
switch( alignment )
{
- case HORIZONTAL_ALIGN_BEGIN:
+ case HorizontalAlignment::BEGIN:
{
- alignment = HORIZONTAL_ALIGN_END;
+ alignment = HorizontalAlignment::END;
break;
}
- case HORIZONTAL_ALIGN_CENTER:
+ case HorizontalAlignment::CENTER:
{
// Nothing to do.
break;
}
- case HORIZONTAL_ALIGN_END:
+ case HorizontalAlignment::END:
{
- alignment = HORIZONTAL_ALIGN_BEGIN;
+ alignment = HorizontalAlignment::BEGIN;
break;
}
}
// Calculate the horizontal line offset.
switch( alignment )
{
- case HORIZONTAL_ALIGN_BEGIN:
+ case HorizontalAlignment::BEGIN:
{
line.alignmentOffset = 0.f;
}
break;
}
- case HORIZONTAL_ALIGN_CENTER:
+ case HorizontalAlignment::CENTER:
{
line.alignmentOffset = 0.5f * ( boxWidth - lineLength );
line.alignmentOffset = floorf( line.alignmentOffset ); // try to avoid pixel alignment.
break;
}
- case HORIZONTAL_ALIGN_END:
+ case HorizontalAlignment::END:
{
if( isRTL )
{
void Engine::Align( const Size& size,
CharacterIndex startIndex,
Length numberOfCharacters,
- Layout::HorizontalAlignment horizontalAlignment,
+ Text::HorizontalAlignment::Type horizontalAlignment,
Vector<LineRun>& lines,
float& alignmentOffset )
{