- // Retrieve from the visual model the glyphs and positions.
- mImpl->mVisualModel->GetGlyphs( glyphs,
- glyphIndex,
- numberOfLaidOutGlyphs );
+ if( 0u < numberOfLaidOutGlyphs )
+ {
+ // Retrieve from the visual model the glyphs and positions.
+ mImpl->mVisualModel->GetGlyphs( glyphs,
+ glyphIndex,
+ numberOfLaidOutGlyphs );
+
+ mImpl->mVisualModel->GetGlyphPositions( glyphPositions,
+ glyphIndex,
+ numberOfLaidOutGlyphs );
+
+ // Set the colors.
+ const GlyphIndex lastLaidOutGlyphIndex = glyphIndex + numberOfLaidOutGlyphs;
+
+ for( Vector<ColorGlyphRun>::ConstIterator it = mImpl->mVisualModel->mColorRuns.Begin(),
+ endIt = mImpl->mVisualModel->mColorRuns.End();
+ it != endIt;
+ ++it )
+ {
+ const ColorGlyphRun& colorGlyphRun = *it;
+ const GlyphIndex lastGlyphIndex = colorGlyphRun.glyphRun.glyphIndex + colorGlyphRun.glyphRun.numberOfGlyphs;