com.itextpdf.text.Font.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(139)

本文整理了Java中com.itextpdf.text.Font.<init>()方法的一些代码示例,展示了Font.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Font.<init>()方法的具体详情如下:
包路径:com.itextpdf.text.Font
类名称:Font
方法名:<init>

Font.<init>介绍

[英]Constructs a Font.
[中]构造字体。

代码示例

代码示例来源:origin: youseries/ureport

Font font=null;
if(baseFont!=null){
  font=new Font(baseFont);
}else{
  font=FontFactory.getFont(fontName);

代码示例来源:origin: com.itextpdf/itextpdf

/**
 * Constructs a chunk of text with a certain content, without specifying a
 * <CODE>Font</CODE>.
 *
 * @param content
 *            the content
 */
public Chunk(final String content) {
  this(content, new Font());
}

代码示例来源:origin: com.itextpdf/itextpdf

/**
 * Constructs a chunk of text with a char, without specifying a <CODE>Font
 * </CODE>.
 *
 * @param c
 *            the content
 */
public Chunk(final char c) {
  this(c, new Font());
}

代码示例来源:origin: com.itextpdf/itextpdf

/**
 * Constructs a <CODE>Phrase</CODE> with a certain leading.
 *
 * @param    leading        the leading
 */
public Phrase(final float leading) {
  this.leading = leading;
  font = new Font();
}

代码示例来源:origin: com.itextpdf/itextpdf

/**
 * Constructs a <CODE>Phrase</CODE> with a certain <CODE>String</CODE>.
 *
 * @param    string        a <CODE>String</CODE>
 */
public Phrase(final String string) {
  this(Float.NaN, string, new Font());
}

代码示例来源:origin: com.itextpdf/itextg

/**
 * Constructs a <CODE>Phrase</CODE> with a certain leading and a certain <CODE>String</CODE>.
 *
 * @param    leading    the leading
 * @param    string        a <CODE>String</CODE>
 */
public Phrase(final float leading, final String string) {
  this(leading, string, new Font());
}

代码示例来源:origin: fr.opensagres.xdocreport/fr.opensagres.xdocreport.itext5.extension

public ExtendedChunk( ExtendedDocument ownerDocument, String textContent )
{
  this( ownerDocument, textContent, new Font() );
}

代码示例来源:origin: com.itextpdf/itextg

/**
 * Constructs a chunk of text with a char, without specifying a <CODE>Font
 * </CODE>.
 *
 * @param c
 *            the content
 */
public Chunk(final char c) {
  this(c, new Font());
}

代码示例来源:origin: com.itextpdf/itextg

/**
 * Constructs a <CODE>Phrase</CODE> with a certain leading.
 *
 * @param    leading        the leading
 */
public Phrase(final float leading) {
  this.leading = leading;
  font = new Font();
}

代码示例来源:origin: com.itextpdf/itextpdf

/**
 * Empty constructor.
 */
public Chunk() {
  this.content = new StringBuffer();
  this.font = new Font();
  this.role = PdfName.SPAN;
}

代码示例来源:origin: com.itextpdf/itextg

/**
 * Empty constructor.
 */
public Chunk() {
  this.content = new StringBuffer();
  this.font = new Font();
  this.role = PdfName.SPAN;
}

代码示例来源:origin: com.itextpdf/itextpdf

/**
 * Gets a special kind of Phrase that changes some characters into corresponding symbols.
 * @param leading
 * @param string
 * @return a newly constructed Phrase
 */
public static final Phrase getInstance(final int leading, final String string) {
  return getInstance(leading, string, new Font());
}

代码示例来源:origin: org.technbolts/gutenberg

public Chunk symbol(String name, float size, BaseColor fg) {
  String s = fontAwesome.get(name);
  if(s==null)
    throw new IllegalArgumentException("Unrecognized symbol '" + name + "'");
  return new Chunk(s, new Font(baseFont, size, Font.NORMAL, fg));
}

代码示例来源:origin: com.itextpdf/itextg

/**
 * Gets a special kind of Phrase that changes some characters into corresponding symbols.
 * @param string
 * @return a newly constructed Phrase
 */
public static final Phrase getInstance(final String string) {
  return getInstance(16, string, new Font());
}

代码示例来源:origin: com.itextpdf/itextpdf

/**
 * Gets a special kind of Phrase that changes some characters into corresponding symbols.
 * @param string
 * @return a newly constructed Phrase
 */
public static final Phrase getInstance(final String string) {
  return getInstance(16, string, new Font());
}

代码示例来源:origin: org.technbolts.tzatziki/tzatziki-pdf

@Override
  public Font get() {
    try {
      return new Font(ITextUtils.inconsolata(), styles.defaultFontSize());
    } catch (Exception e) {
      log.warn("Fail to retrieve font", e);
      return FontFactory.getFont(FontFactory.COURIER, styles.defaultFontSize());
    }
  }
};

代码示例来源:origin: hmkcode/Java

private static PdfPCell createLabelCell(String text){
  // font
  Font font = new Font(FontFamily.HELVETICA, 8, Font.BOLD, BaseColor.DARK_GRAY);
  
  // create cell
  PdfPCell cell = new PdfPCell(new Phrase(text,font));
  // set style
  Style.labelCellStyle(cell);
  return cell;
}

代码示例来源:origin: hmkcode/Java

private static PdfPCell createValueCell(String text){
    // font
    Font font = new Font(FontFamily.HELVETICA, 8, Font.NORMAL, BaseColor.BLACK);
    
    // create cell
    PdfPCell cell = new PdfPCell(new Phrase(text,font));
    
    // set style
    Style.valueCellStyle(cell);
    return cell;
  }
}

代码示例来源:origin: caryyu/excel2pdf

@Override
public void onStartPage(PdfWriter writer, Document document) {
  try {
    this.template = writer.getDirectContent().createTemplate(100, 100);
    this.baseFont = new Font(Resource.BASE_FONT_CHINESE, 8, Font.NORMAL).getBaseFont();
  } catch (Exception e) {
    throw new ExceptionConverter(e);
  }
}

代码示例来源:origin: Texera/texera

private static void createPDF(String path) throws Exception {
  Document pdfDoc = new Document(PageSize.A4);
  PdfWriter.getInstance(pdfDoc, new FileOutputStream(path)).setPdfVersion(PdfWriter.VERSION_1_7);
  pdfDoc.open();
  Font myfont = new Font();
  myfont.setStyle(Font.NORMAL);
  myfont.setSize(11);
  Paragraph para = new Paragraph("test", myfont);
  para.setAlignment(Element.ALIGN_JUSTIFIED);
  pdfDoc.add(para);
  pdfDoc.close();
}

相关文章