Object obj = iterator.next();
if (obj instanceof Text) {
size += ((Text) obj).getSize();
}
if (obj instanceof EmbeddedImage) {
EmbeddedImage image = (EmbeddedImage) obj;
if ((textRecord.document.resolve(image.getURI()) == null) && (image.getAlt() != null)) {
// Alt text if image is not found
size += (2 + image.getAlt().getSize());
continue;
}
}
if (obj instanceof Function) {
size += (1 + ((Function) obj).getSize()); // preceding NUL + size of the function itself