/* Position the cursor. */
final float originX = toPoints(area.baselineX());
final float originY = toPoints(area.baselineY());
getContentStream().setCursor(originX, originY);
final FontUse primaryFont = area.getPrimaryFont();
FontUse currentFont = primaryFont;
int startIndex = 0;
for (int i = 0; i < text.length(); i++) {
final int codePoint = Character.codePointAt(text, i);
if (Character.isSupplementaryCodePoint(codePoint)) {
i++;
}
final FontUse newFont = whichFont(area, primaryFont, currentFont,
codePoint);
if (newFont != currentFont) {
/* Font has changed. Write the text so far. */
final int size = i - startIndex;
paintText(area, currentFont, text, startIndex, size,