public Chunk addSuperscript(String text) { float leading = determineCurrentLeading(); Font f = determineCurrentFont(); Font supFont = new Font(f); supFont.setSize(f.getSize() / 2f); Chunk c = new Chunk(text, supFont); c.setTextRise(leading / 2f); return c; }
Paragraph p = new Paragraph(); Chunk smallChunk = new Chunk("small middle", BLUE); smallChunk.setTextRise( (15 - 6) / 2); p.add(smallChunk); p.add(new Chunk("big middle", RED));
chunk.setTextRise(8);
/** * Creates an iText Chunk * @param content the content of the Chunk * @param chain the hierarchy chain * @return a Chunk */ public Chunk createChunk(final String content, final ChainedProperties chain) { Font font = getFont(chain); Chunk ck = new Chunk(content, font); if (chain.hasProperty(HtmlTags.SUB)) ck.setTextRise(-font.getSize() / 2); else if (chain.hasProperty(HtmlTags.SUP)) ck.setTextRise(font.getSize() / 2); ck.setHyphenation(getHyphenation(chain)); return ck; }
/** * Creates an iText Chunk * @param content the content of the Chunk * @param chain the hierarchy chain * @return a Chunk */ public Chunk createChunk(final String content, final ChainedProperties chain) { Font font = getFont(chain); Chunk ck = new Chunk(content, font); if (chain.hasProperty(HtmlTags.SUB)) ck.setTextRise(-font.getSize() / 2); else if (chain.hasProperty(HtmlTags.SUP)) ck.setTextRise(font.getSize() / 2); ck.setHyphenation(getHyphenation(chain)); return ck; }