public void Save()
{
if (indexChunk > 0) {
if (indexChunk >= chunks.Count)
chunks.Clear();
else {
for (--indexChunk; indexChunk >= 0; --indexChunk)
chunks.RemoveAt(indexChunk);
}
indexChunk = 0;
}
storedRunDirection = runDirection;
storedTotalTextLength = totalTextLength;
storedIndexChunk = indexChunk;
storedIndexChunkChar = indexChunkChar;
storedCurrentChar = currentChar;
shortStore = (currentChar < totalTextLength);
if (!shortStore) {
// long save
if (storedText.Length < totalTextLength) {
storedText = new char[totalTextLength];
storedDetailChunks = new PdfChunk[totalTextLength];
}
Array.Copy(text, 0, storedText, 0, totalTextLength);
Array.Copy(detailChunks, 0, storedDetailChunks, 0, totalTextLength);
}
if (runDirection == PdfWriter.RUN_DIRECTION_LTR || runDirection == PdfWriter.RUN_DIRECTION_RTL) {
if (storedOrderLevels.Length < totalTextLength) {
storedOrderLevels = new byte[totalTextLength];
storedIndexChars = new int[totalTextLength];
}
Array.Copy(orderLevels, currentChar, storedOrderLevels, currentChar, totalTextLength - currentChar);
Array.Copy(indexChars, currentChar, storedIndexChars, currentChar, totalTextLength - currentChar);
}
}