本文整理汇总了Java中com.itextpdf.text.Chunk.setFont方法的典型用法代码示例。如果您正苦于以下问题:Java Chunk.setFont方法的具体用法?Java Chunk.setFont怎么用?Java Chunk.setFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.itextpdf.text.Chunk
的用法示例。
在下文中一共展示了Chunk.setFont方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: certaintyToNaturalString
import com.itextpdf.text.Chunk; //导入方法依赖的package包/类
private Chunk certaintyToNaturalString(String certainty)
{
Chunk c = new Chunk();
if(certainty.equalsIgnoreCase("exact")){
c.append("in exactly ");
}
else if (certainty.equalsIgnoreCase("after")){
c.append("after ");
}
else if (certainty.equalsIgnoreCase("before")){
c.append("before ");
}
else{
c.append("in "+certainty.toLowerCase() + " ");
}
c.setFont(bodyFont);
return c;
}
示例2: HeaderFooter
import com.itextpdf.text.Chunk; //导入方法依赖的package包/类
public HeaderFooter(int maximumPageNumber)
{
_maximumPageNumber = maximumPageNumber;
Chunk c = new Chunk("" + (char) 229);
c.setFont(new Font(FontFamily.SYMBOL, 28));
_sumSymbol = new Phrase(c);
}
示例3: pageNumberFooter
import com.itextpdf.text.Chunk; //导入方法依赖的package包/类
private void pageNumberFooter(PdfWriter writer, Rectangle rect)
{
Chunk c = new Chunk(String.format(LocaleStrings.getString("page"), writer.getPageNumber(), _maximumPageNumber));
c.setFont(new Font(FontFamily.HELVETICA, 10));
Phrase pagephrase = new Phrase(c);
ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, pagephrase, rect.getRight() - 60,
rect.getBottom() - 30, 0);
}
示例4: getQuestionNumberChunk
import com.itextpdf.text.Chunk; //导入方法依赖的package包/类
private Chunk getQuestionNumberChunk(Font f, int number)
{
Chunk c = new Chunk((number + 1) + ". ");
Font ff = new Font(f);
ff.setStyle(Font.BOLD);
c.setFont(ff);
return c;
}
示例5: getPointsChunk
import com.itextpdf.text.Chunk; //导入方法依赖的package包/类
private Chunk getPointsChunk(Font f, Question question)
{
int points = (int) question.getPointsPerAnswer();
String punkteText = LocaleStrings.getString(points == 1 ?"point":"points");
String text;
if (question.basetype == BaseType.STRING)
{
text = " " + LocaleStrings.getString("maximum"); //(maximal %d %s)
text = String.format(text, points, punkteText);
}
else
{
if (question.type.equalsIgnoreCase("single"))
{
text = " "+ LocaleStrings.getString("correctAnswer"); //" (1 richtige Antwort";
if (points == 1)
{
text += ")";
}
else
{
text += ", %d %s)";
text = String.format(text, points, punkteText);
}
}
else
{ // MUTLIPLE
text = " "+ LocaleStrings.getString("perCorrectAnswer"); //(%d %s pro richtige Antwort)";
text = String.format(text, points, punkteText);
}
}
Chunk c = new Chunk(text);
Font ff = new Font(f);
ff.setSize(OVERALLFONTSIZE);
c.setFont(ff);
return c;
}
示例6: onRender
import com.itextpdf.text.Chunk; //导入方法依赖的package包/类
@Override
public void onRender(com.itextpdf.text.Paragraph paragraph) {
DottedLineSeparator sep = new DottedLineSeparator();
sep.setAlignment( Element.ALIGN_LEFT );
sep.setGap( gap );
sep.setLineColor( getBaseColor());
com.itextpdf.text.Font f = new com.itextpdf.text.Font( getBaseFont(), getFontSize() );
f.setColor( getBaseColor() );
Chunk separator = new Chunk( sep );
separator.setFont( f );
paragraph.add( separator );
}
示例7: renderTextToContainer
import com.itextpdf.text.Chunk; //导入方法依赖的package包/类
private void renderTextToContainer(final String text) {
String str = ctx.stringTransform(ITextUtil.normalizeSpaces(text));
final Chunk c = new Chunk(str);
c.setFont(ctx.getFont(Font.NORMAL));
if (ctx.isMustAddAnchor()) {
Anchor a = new Anchor(c);
a.setFont(ctx.getFont(Font.NORMAL));
a.setName(ctx.getCurrentId());
ctx.addToContainer(a);
ctx.setMustAddAnchor(false);
} else {
ctx.addToContainer(c);
}
}
示例8: createChunk
import com.itextpdf.text.Chunk; //导入方法依赖的package包/类
protected Chunk createChunk(TextChunk textChunk) {
Chunk chunk = new Chunk(textChunk.getText());
chunk.setFont(createFont(textChunk));
return chunk;
}
示例9: setBoldStyle
import com.itextpdf.text.Chunk; //导入方法依赖的package包/类
/**
* Makes chunk content bold.
* @param chunk The chunk whose content is to be rendered bold.
* @param color The font color desired.
*/
private void setBoldStyle(Chunk chunk, BaseColor color)
{
Font font = chunk.getFont();
chunk.setFont(FontFactory.getFont(font.getFamilyname(), font.getSize(), Font.BOLD, color));
}
示例10: adjustChunkFont
import com.itextpdf.text.Chunk; //导入方法依赖的package包/类
private void adjustChunkFont(Chunk element) {
Font font = configuration.tableContentFont();
element.setFont(font);
}
示例11: render
import com.itextpdf.text.Chunk; //导入方法依赖的package包/类
@Override
public boolean render(final Element el) throws Exception {
String parentName = el.getParent().getName();
if (parentName.equals("Capitulo") || parentName.equals("Titulo") || parentName.equals("Livro")
|| parentName.equals("Parte") || parentName.equals("Secao") || parentName.equals("Subsecao")) {
Paragraph p = ctx.createParagraph();
p.setAlignment(com.itextpdf.text.Element.ALIGN_CENTER);
float paragraphSpacing = ITextUtil.cm2point(ctx.getFloat(PDFConfigs.PARAGRAPH_SPACING));
p.setSpacingBefore(paragraphSpacing / 2);
p.setSpacingAfter(paragraphSpacing / 2);
ctx.pushContainer(p); // Necessário para abertura de aspas
// Negrito
if (parentName.equals("Secao") || parentName.equals("Subsecao")) {
p.setFont(ctx.getFont(Font.BOLD));
}
addToContainer(el.getTextTrim());
ctx.popContainer();
addToPDF(p);
}
else {
String texto = el.getTextTrim();
if (parentName.equals("Artigo") || parentName.equals("Paragrafo")) {
texto += " "; // Dois espaços
}
else {
texto += " ";
}
Chunk c = new Chunk(texto);
if (texto.toLowerCase().contains("parágrafo único")) {
c.setFont(ctx.getFont(Font.ITALIC));
}
else {
c.setFont(ctx.getFont(Font.BOLD));
}
addToNextContainer(c);
if (renderizarOmissis(el)) {
Renderer_Omissis.renderOmissis(ctx);
}
}
return Renderer.ACABOU;
}