/** Writes the font definition to the document. * @param writer the <CODE>PdfWriter</CODE> of this document */ internal void writeFont(PdfWriter writer) { try { switch (fontType) { case BaseFont.FONT_TYPE_T1: case BaseFont.FONT_TYPE_TT: { int firstChar; int lastChar; if (subset) { for (firstChar = 0; firstChar < 256; ++firstChar) { if (shortTag[firstChar] != 0) { break; } } for (lastChar = 255; lastChar >= firstChar; --lastChar) { if (shortTag[lastChar] != 0) { break; } } if (firstChar > 255) { firstChar = 255; lastChar = 255; } } else { for (int k = 0; k < shortTag.Length; ++k) { shortTag[k] = 1; } firstChar = 0; lastChar = shortTag.Length - 1; } baseFont.writeFont(writer, indirectReference, new Object[] { firstChar, lastChar, shortTag }); break; } case BaseFont.FONT_TYPE_CJK: baseFont.writeFont(writer, indirectReference, new Object[] { cjkTag }); break; case BaseFont.FONT_TYPE_TTUNI: baseFont.writeFont(writer, indirectReference, new Object[] { longTag }); break; } } catch (Exception e) { throw e; } }