- // Check if the current index is a white space. Do not want to shape a \n.
- // The last character is always a must-break even if it's not a \n.
- Length numberOfCharactersToShape = currentIndex - previousIndex;
- if( mustBreak && !IsWhiteSpace( *( textBuffer + currentIndex ) ) )
+ // Shape the text for the current chunk.
+ const Length numberOfGlyphs = shaping.Shape(textBuffer + previousIndex,
+ (currentIndex - previousIndex), // The number of characters to shape.
+ currentFontId,
+ currentScript);
+
+ // Retrieve the glyphs and the glyph to character conversion map.
+ Vector<GlyphInfo> tmpGlyphs;
+ Vector<CharacterIndex> tmpGlyphToCharacterMap;
+
+ GlyphInfo glyphInfo;
+ glyphInfo.isItalicRequired = isItalicRequired;
+ glyphInfo.isBoldRequired = isBoldRequired;
+
+ tmpGlyphs.Resize(numberOfGlyphs, glyphInfo);
+ tmpGlyphToCharacterMap.Resize(numberOfGlyphs);
+ shaping.GetGlyphs(tmpGlyphs.Begin(),
+ tmpGlyphToCharacterMap.Begin());
+
+ // Update the new indices of the glyph to character map.
+ if(0u != totalNumberOfGlyphs)