当前位置: 首页>>代码示例>>Java>>正文


Java Chunk.setFont方法代码示例

本文整理汇总了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;
}
 
开发者ID:ltrr-arizona-edu,项目名称:tellervo,代码行数:21,代码来源:SeriesReport.java

示例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);
}
 
开发者ID:wolfposd,项目名称:IMSQTI2PDF,代码行数:9,代码来源:HeaderFooter.java

示例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);
}
 
开发者ID:wolfposd,项目名称:IMSQTI2PDF,代码行数:10,代码来源:HeaderFooter.java

示例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;
}
 
开发者ID:wolfposd,项目名称:IMSQTI2PDF,代码行数:9,代码来源:PDFCreator.java

示例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;
}
 
开发者ID:wolfposd,项目名称:IMSQTI2PDF,代码行数:41,代码来源:PDFCreator.java

示例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 );
}
 
开发者ID:Billes,项目名称:pdf-renderer,代码行数:13,代码来源:DottedFillPhrase.java

示例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);
}
  }
 
开发者ID:lexml,项目名称:lexml-renderer-pdf,代码行数:15,代码来源:PDFBuilder.java

示例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;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:6,代码来源:AbstractPdfReportBuilder.java

示例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));
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:11,代码来源:ItextTableWriter.java

示例10: adjustChunkFont

import com.itextpdf.text.Chunk; //导入方法依赖的package包/类
private void adjustChunkFont(Chunk element) {
    Font font = configuration.tableContentFont();
    element.setFont(font);
}
 
开发者ID:Arnauld,项目名称:cucumber-contrib,代码行数:5,代码来源:TableDataContentProcessor.java

示例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;
}
 
开发者ID:lexml,项目名称:lexml-renderer-pdf,代码行数:54,代码来源:Renderer_Rotulo.java


注:本文中的com.itextpdf.text.Chunk.setFont方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。