mCursorWidth( CURSOR_WIDTH ),
mEllipsisEnabled( false )
{
- mFontClient = TextAbstraction::FontClient::Get();
}
/**
void UpdateLineHeight( FontId fontId, LineLayout& lineLayout )
{
Text::FontMetrics fontMetrics;
- mFontClient.GetFontMetrics( fontId, fontMetrics );
+ mMetrics->GetFontMetrics( fontId, fontMetrics );
// Sets the maximum ascender.
if( fontMetrics.ascender > lineLayout.ascender )
const GlyphInfo& glyph = *glyphsBuffer;
float penX = ( 0.f > glyph.xBearing ) ? -glyph.xBearing : 0.f;
- penX += mCursorWidth; // Added to give some space to the cursor.
for( GlyphIndex i = 0u; i < numberOfGlyphs; ++i )
{
const GlyphInfo& glyphInfo = *( layoutParameters.glyphsBuffer + layoutParameters.totalNumberOfGlyphs - 1u );
Text::FontMetrics fontMetrics;
- mFontClient.GetFontMetrics( glyphInfo.fontId, fontMetrics );
+ mMetrics->GetFontMetrics( glyphInfo.fontId, fontMetrics );
LineRun lineRun;
lineRun.glyphRun.glyphIndex = 0u;
const GlyphInfo& glyph = *( layoutParameters.glyphsBuffer + *( layoutParameters.charactersToGlyphsBuffer + characterVisualIndex ) );
float penX = ( 0.f > glyph.xBearing ) ? -glyph.xBearing : 0.f;
- penX += mCursorWidth; // Added to give some space to the cursor.
Vector2* glyphPositionsBuffer = glyphPositions.Begin();
{
if( isLastLine && !isRTL )
{
+ // Add the length of the white saces at the end of the line.
lineLength += line.extraLength;
if( lineLength > boxWidth )
{
- lineLength = boxWidth;
+ // The line's length is longer than the box's width.
+ // Set the line's offset to 0 and nothing else to do.
line.alignmentOffset = 0.f;
break;
}
LayoutEngine::VerticalAlignment mVerticalAlignment;
float mCursorWidth;
- TextAbstraction::FontClient mFontClient;
+ IntrusivePtr<Metrics> mMetrics;
bool mEllipsisEnabled:1;
};
delete mImpl;
}
+void LayoutEngine::SetMetrics( MetricsPtr& metrics )
+{
+ mImpl->mMetrics = metrics;
+}
+
void LayoutEngine::SetLayout( Layout layout )
{
mImpl->mLayout = layout;