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


Java Font.ITALIC属性代码示例

本文整理汇总了Java中com.itextpdf.text.Font.ITALIC属性的典型用法代码示例。如果您正苦于以下问题:Java Font.ITALIC属性的具体用法?Java Font.ITALIC怎么用?Java Font.ITALIC使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.itextpdf.text.Font的用法示例。


在下文中一共展示了Font.ITALIC属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: calculateStyle

private int calculateStyle(Style style) {
    int s = Font.NORMAL;
    if (style.isBold()) {
        s |= Font.BOLD;
    }
    if (style.isItalic()) {
        s |= Font.ITALIC;
    }
    if (style.isStrikethrough()) {
        s |= Font.STRIKETHRU;
    }
    if (style.isUnderline()) {
        s |= Font.UNDERLINE;
    }
    return s;
}
 
开发者ID:Arnauld,项目名称:gutenberg,代码行数:16,代码来源:PygmentsAdapter.java

示例2: PDFFont

public PDFFont(float size, Style style, RGBColor color) throws HTDocumentException {
    try {
        BaseFont baseFont = (
                BaseFont.createFont("fonts/ttf/dejavu/DejaVuSans.ttf", "cp1251", BaseFont.EMBEDDED)
        );
        int iStyle;
        switch (style) {
            case BOLD:
                iStyle = Font.BOLD;
                break;
            case ITALIC:
                iStyle = Font.ITALIC;
                break;
            case UNDERLINE:
                iStyle = Font.UNDERLINE;
                break;
            default:
                iStyle = Font.NORMAL;
                break;
        }
        m_font = new Font(
                baseFont,
                size,
                iStyle,
                new BaseColor(color.getRed(), color.getGreen(), color.getBlue())
        );
    } catch (DocumentException | IOException e) {
        throw new HTDocumentException("Error while creating PDF font", e);
    }
}
 
开发者ID:Antokolos,项目名称:NLB,代码行数:30,代码来源:PDFFont.java

示例3: apply

@Override
public void apply(ElementAttributes pElementAttributes, String pValue) {
  if (ITALIC_PROPERTY_VALUE.equals(pValue)) {
    int lFontStyle = pElementAttributes.getFontAttributes().getStyle() | Font.ITALIC;
    pElementAttributes.getFontAttributes().setStyle(lFontStyle);
  }
}
 
开发者ID:Fivium,项目名称:FOXopen,代码行数:7,代码来源:FontStylePropertyResolver.java

示例4: process

@Override
public void process(int level, Node node, InvocationContext context) {
    StrongEmphSuperNode emNode = (StrongEmphSuperNode) node;
    Font font = context.peekFont();
    int style = emNode.isStrong() ? Font.BOLD : Font.ITALIC;
    context.pushFont(new Font(font.getBaseFont(), font.getSize(), font.getStyle() | style));
    context.processChildren(level, node);
    context.popFont();
}
 
开发者ID:Arnauld,项目名称:gutenberg,代码行数:9,代码来源:StrongEmphSuperNodeProcessor.java

示例5: createBlueBlock

private void createBlueBlock(PdfContentByte cb, int treeCount) throws DocumentException {
    cb.saveState();
    cb.setRGBColorFill(0x64, 0xA7, 0xBD);
    cb.rectangle(0.0f, 375.0f, 595.0f, 200.0f);
    cb.fill();
    cb.stroke();
    cb.restoreState();

    Font textFont = new Font(FontFamily.TIMES_ROMAN, 14, Font.ITALIC, BaseColor.WHITE);
    Font textBlack = new Font(FontFamily.TIMES_ROMAN, 14, Font.ITALIC, BaseColor.BLACK);
    Font textFontTreeCount = new Font(FontFamily.HELVETICA, 30, Font.BOLD, BaseColor.BLACK);
    PdfPTable tableForTreeCount = new PdfPTable(1);
    float[] rows = { 495f };
    tableForTreeCount.setTotalWidth(rows);
    tableForTreeCount.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    tableForTreeCount.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    tableForTreeCount.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    tableForTreeCount.getDefaultCell().setFixedHeight(40);

    Integer treeCountAsObject = treeCount;
    tableForTreeCount.addCell(new Phrase(new Chunk(treeCountAsObject.toString(), textFontTreeCount)));

    tableForTreeCount.writeSelectedRows(0, 1, 50f, 575f, cb);

    PdfPTable tableForWhiteText = new PdfPTable(1);
    tableForWhiteText.setTotalWidth(rows);
    tableForWhiteText.getDefaultCell().setBorder(Rectangle.BOTTOM);
    tableForWhiteText.getDefaultCell().setBorderWidth(1f);
    tableForWhiteText.getDefaultCell().setBorderColor(BaseColor.WHITE);
    tableForWhiteText.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    tableForWhiteText.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    tableForWhiteText.getDefaultCell().setFixedHeight(40);

    Phrase phraseForTreesPlantForYou = new Phrase();
    if (treeCount == 1) {
        phraseForTreesPlantForYou.add(new Chunk("Baum wurde für Sie gepflanzt!", textFont));
    } else {
        phraseForTreesPlantForYou.add(new Chunk("Bäume wurden für Sie gepflanzt!", textFont));
    }

    PdfPCell longTextCell = new PdfPCell();
    longTextCell.setHorizontalAlignment(Element.ALIGN_LEFT);
    longTextCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    longTextCell.setBorder(Rectangle.BOTTOM);
    longTextCell.setBorderWidth(1f);
    longTextCell.setBorderColor(BaseColor.WHITE);
    longTextCell.setFixedHeight(65);

    Paragraph longText = new Paragraph(new Chunk(
            "Mit diesem Gutschein können sie Ihre Pflanzung in Augenschein nehmen und mehr über die naturnahen Aufforstungsprojekte bei \"I Plant A Tree\" erfahren. Ihre Bäume wachsen auf ehemals brachliegenden Flächen und sind Teil neu entstehender Wälder.",
            textFont));
    longText.setLeading(15f);

    longTextCell.addElement(longText);

    tableForWhiteText.addCell(phraseForTreesPlantForYou);
    tableForWhiteText.addCell(longTextCell);
    tableForWhiteText.writeSelectedRows(0, 2, 50f, 535f, cb);

    PdfPTable tableForHowItWorks = new PdfPTable(1);
    tableForHowItWorks.setTotalWidth(rows);
    tableForHowItWorks.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    tableForHowItWorks.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    tableForHowItWorks.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    tableForHowItWorks.getDefaultCell().setFixedHeight(40);

    tableForHowItWorks.addCell(new Phrase(new Chunk("Und so einfach funktioniert's:", textBlack)));

    tableForHowItWorks.writeSelectedRows(0, 2, 50f, 425f, cb);
}
 
开发者ID:Dica-Developer,项目名称:weplantaforest,代码行数:70,代码来源:PdfGiftView.java

示例6: createTreeCountAndCustomTextBlock

private void createTreeCountAndCustomTextBlock(PdfContentByte cb, String customText, int treeCount) throws DocumentException {
    Font textFont = new Font(FontFamily.TIMES_ROMAN, 16, Font.ITALIC, BaseColor.BLACK);
    Font textFontTreeCount = new Font(FontFamily.HELVETICA, 30, Font.BOLD, BaseColor.BLACK);
    Font customTextFont = new Font(FontFamily.HELVETICA, 12, Font.NORMAL, BaseColor.BLACK);

    cb.saveState();
    cb.setRGBColorFill(0xE0, 0xDE, 0xDF);
    cb.rectangle(0.0f, 325.0f, 595.0f, 205.0f);
    cb.fill();
    cb.stroke();
    cb.restoreState();

    Integer treeCountAsObj = treeCount;

    PdfPTable table = new PdfPTable(1);
    float[] rows = { 595f };
    table.setTotalWidth(rows);
    table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.getDefaultCell().setFixedHeight(35);
    table.addCell(new Phrase(new Chunk("über die Pflanzung von", textFont)));
    table.addCell(new Phrase(new Chunk(treeCountAsObj.toString(), textFontTreeCount)));
    table.addCell(new Phrase(new Chunk("Bäumen", textFont)));
    table.writeSelectedRows(0, 3, 0, 520, cb);

    cb.saveState();
    cb.setRGBColorFill(0xF7, 0xF2, 0xF4);
    cb.rectangle(50.0f, 345.0f, 495.0f, 60.0f);
    cb.fill();
    cb.stroke();
    cb.restoreState();

    PdfPTable textTable = new PdfPTable(1);
    float[] textRows = { 475f };
    textTable.setTotalWidth(textRows);
    textTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    textTable.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    textTable.getDefaultCell().setFixedHeight(40);
    textTable.addCell(new Phrase(new Chunk(customText, customTextFont)));
    textTable.writeSelectedRows(0, 1, 60, 395, cb);
}
 
开发者ID:Dica-Developer,项目名称:weplantaforest,代码行数:42,代码来源:PdfCertificateView.java

示例7: createTreeCountAndCustomTextBlock

private void createTreeCountAndCustomTextBlock(PdfContentByte cb, String customText, int treeCount) throws DocumentException {
    Font textFont = new Font(FontFamily.TIMES_ROMAN, 16, Font.ITALIC, BaseColor.WHITE);
    Font textFontTreeCount = new Font(FontFamily.HELVETICA, 30, Font.BOLD, BaseColor.BLACK);
    Font customTextFont = new Font(FontFamily.HELVETICA, 12, Font.NORMAL, BaseColor.BLACK);

    cb.saveState();
    cb.setRGBColorFill(0x64, 0xA7, 0xBD);
    cb.rectangle(0.0f, 325.0f, 595.0f, 205.0f);
    cb.fill();
    cb.stroke();
    cb.restoreState();

    Integer treeCountAsObj = treeCount;

    PdfPTable table = new PdfPTable(1);
    float[] rows = { 595f };
    table.setTotalWidth(rows);
    table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.getDefaultCell().setFixedHeight(35);
    table.addCell(new Phrase(new Chunk("über die Pflanzung von", textFont)));
    table.addCell(new Phrase(new Chunk(treeCountAsObj.toString(), textFontTreeCount)));
    table.addCell(new Phrase(new Chunk("Bäumen", textFont)));
    table.writeSelectedRows(0, 3, 0, 520, cb);

    cb.saveState();
    cb.setRGBColorFill(0xF7, 0xF2, 0xF4);
    cb.rectangle(50.0f, 345.0f, 495.0f, 60.0f);
    cb.fill();
    cb.stroke();
    cb.restoreState();

    PdfPTable textTable = new PdfPTable(1);
    float[] textRows = { 475f };
    textTable.setTotalWidth(textRows);
    textTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    textTable.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    textTable.getDefaultCell().setFixedHeight(40);
    textTable.addCell(new Phrase(new Chunk(customText, customTextFont)));
    textTable.writeSelectedRows(0, 1, 60, 395, cb);
}
 
开发者ID:Dica-Developer,项目名称:weplantaforest,代码行数:42,代码来源:PdfCertificateView2.java

示例8: formatPhrase

@Override
protected void formatPhrase(final Element el, final DecoratedPhrase p) throws Exception {
    int style = hasAncestor(el, "b") ? Font.BOLDITALIC : Font.ITALIC;
    p.setFont(ctx.getFont(style));
}
 
开发者ID:lexml,项目名称:lexml-renderer-pdf,代码行数:5,代码来源:Renderer_i.java


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