Interface PdfFont

All Known Implementing Classes:
EmbeddedFont, StandardFont

public sealed interface PdfFont permits StandardFont, EmbeddedFont
PDF Font - Font representation for PDF content PDF 字体 - PDF 内容的字体表示

Provides standard PDF fonts and custom font embedding support.

提供标准 PDF 字体和自定义字体嵌入支持。

Features | 主要功能:

  • Sealed font hierarchy (StandardFont, EmbeddedFont) - 密封字体层次结构
  • Factory methods for all 14 standard PDF fonts - 所有 14 种标准 PDF 字体的工厂方法
  • Font name and embedding status access - 字体名称和嵌入状态访问

Usage Examples | 使用示例:

PdfFont helvetica = PdfFont.helvetica();
PdfFont courier = PdfFont.courierBold();
PdfFont times = PdfFont.timesRoman();
boolean embedded = helvetica.isEmbedded(); // false

Security | 安全性:

  • Thread-safe: Yes — implementations are immutable - 线程安全: 是 — 实现不可变
  • Null-safe: N/A — interface defines no mutators - 空值安全: 不适用 — 接口不定义修改器
Since:
JDK 25, opencode-base-pdf V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    static PdfFont
    Returns Courier font (monospace) 返回 Courier 字体(等宽)
    static PdfFont
    Returns Courier Bold font 返回 Courier Bold 字体
    Gets font name 获取字体名称
    Gets PDF font name (internal name) 获取 PDF 字体名称(内部名称)
    static PdfFont
    Returns Helvetica font (sans-serif) 返回 Helvetica 字体(无衬线)
    static PdfFont
    Returns Helvetica Bold font 返回 Helvetica Bold 字体
    static PdfFont
    Returns Helvetica Italic font 返回 Helvetica Italic 字体
    boolean
    Checks if font is embedded 检查字体是否嵌入
    static PdfFont
    Returns Symbol font 返回 Symbol 字体
    static PdfFont
    Returns Times Bold font 返回 Times Bold 字体
    static PdfFont
    Returns Times Roman font (serif) 返回 Times Roman 字体(衬线)
    static PdfFont
    Returns ZapfDingbats font 返回 ZapfDingbats 字体
  • Method Details

    • getName

      String getName()
      Gets font name 获取字体名称
      Returns:
      font name | 字体名称
    • getPdfName

      String getPdfName()
      Gets PDF font name (internal name) 获取 PDF 字体名称(内部名称)
      Returns:
      PDF internal name | PDF 内部名称
    • isEmbedded

      boolean isEmbedded()
      Checks if font is embedded 检查字体是否嵌入
      Returns:
      true if embedded | 如果嵌入返回 true
    • helvetica

      static PdfFont helvetica()
      Returns Helvetica font (sans-serif) 返回 Helvetica 字体(无衬线)
      Returns:
      Helvetica font | Helvetica 字体
    • helveticaBold

      static PdfFont helveticaBold()
      Returns Helvetica Bold font 返回 Helvetica Bold 字体
      Returns:
      Helvetica Bold font | Helvetica Bold 字体
    • helveticaItalic

      static PdfFont helveticaItalic()
      Returns Helvetica Italic font 返回 Helvetica Italic 字体
      Returns:
      Helvetica Italic font | Helvetica Italic 字体
    • timesRoman

      static PdfFont timesRoman()
      Returns Times Roman font (serif) 返回 Times Roman 字体(衬线)
      Returns:
      Times Roman font | Times Roman 字体
    • timesBold

      static PdfFont timesBold()
      Returns Times Bold font 返回 Times Bold 字体
      Returns:
      Times Bold font | Times Bold 字体
    • courier

      static PdfFont courier()
      Returns Courier font (monospace) 返回 Courier 字体(等宽)
      Returns:
      Courier font | Courier 字体
    • courierBold

      static PdfFont courierBold()
      Returns Courier Bold font 返回 Courier Bold 字体
      Returns:
      Courier Bold font | Courier Bold 字体
    • symbol

      static PdfFont symbol()
      Returns Symbol font 返回 Symbol 字体
      Returns:
      Symbol font | Symbol 字体
    • zapfDingbats

      static PdfFont zapfDingbats()
      Returns ZapfDingbats font 返回 ZapfDingbats 字体
      Returns:
      ZapfDingbats font | ZapfDingbats 字体