Enum Class StandardFont
- All Implemented Interfaces:
PdfFont, Serializable, Comparable<StandardFont>, Constable
Standard PDF Fonts - The 14 standard Type 1 fonts
标准 PDF 字体 - 14 种标准 Type 1 字体
These fonts are guaranteed to be available in all PDF viewers.
这些字体保证在所有 PDF 阅读器中可用。
Features | 主要功能:
- Helvetica, Times, and Courier font families - Helvetica、Times 和 Courier 字体族
- Bold, italic, and bold-italic variants - 粗体、斜体和粗斜体变体
- Symbol and ZapfDingbats fonts - Symbol 和 ZapfDingbats 字体
- Family and style query methods - 字体族和样式查询方法
Usage Examples | 使用示例:
StandardFont font = StandardFont.HELVETICA_BOLD;
boolean bold = font.isBold(); // true
boolean mono = font.isMonospace(); // false
String name = font.getPdfName(); // "Helvetica-Bold"
Security | 安全性:
- Thread-safe: Yes — immutable enum - 线程安全: 是 — 不可变枚举
- Null-safe: N/A — enum values are never null - 空值安全: 不适用 — 枚举值不会为空
- Since:
- JDK 25, opencode-base-pdf V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionCourier (monospace) | Courier(等宽)Courier Bold | Courier 粗体Courier Bold Oblique | Courier 粗斜体Courier Oblique | Courier 斜体Helvetica (sans-serif) | Helvetica(无衬线)Helvetica Bold | Helvetica 粗体Helvetica Bold Oblique | Helvetica 粗斜体Helvetica Oblique (Italic) | Helvetica 斜体Symbol font | Symbol 字体Times Bold | Times 粗体Times Bold Italic | Times 粗斜体Times Italic | Times 斜体Times Roman (serif) | Times Roman(衬线)ZapfDingbats font | ZapfDingbats 字体 -
Method Summary
Modifier and TypeMethodDescriptiongetName()Gets font name 获取字体名称Gets PDF font name (internal name) 获取 PDF 字体名称(内部名称)booleanisBold()Checks if this is a bold variant 检查是否为粗体变体booleanChecks if this is a Courier variant 检查是否为 Courier 变体booleanChecks if font is embedded 检查字体是否嵌入booleanChecks if this is a Helvetica variant 检查是否为 Helvetica 变体booleanisItalic()Checks if this is an italic/oblique variant 检查是否为斜体变体booleanChecks if this is a monospace font 检查是否为等宽字体booleanisTimes()Checks if this is a Times variant 检查是否为 Times 变体static StandardFontReturns the enum constant of this class with the specified name.static StandardFont[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
HELVETICA
Helvetica (sans-serif) | Helvetica(无衬线) -
HELVETICA_BOLD
Helvetica Bold | Helvetica 粗体 -
HELVETICA_OBLIQUE
Helvetica Oblique (Italic) | Helvetica 斜体 -
HELVETICA_BOLD_OBLIQUE
Helvetica Bold Oblique | Helvetica 粗斜体 -
TIMES_ROMAN
Times Roman (serif) | Times Roman(衬线) -
TIMES_BOLD
Times Bold | Times 粗体 -
TIMES_ITALIC
Times Italic | Times 斜体 -
TIMES_BOLD_ITALIC
Times Bold Italic | Times 粗斜体 -
COURIER
Courier (monospace) | Courier(等宽) -
COURIER_BOLD
Courier Bold | Courier 粗体 -
COURIER_OBLIQUE
Courier Oblique | Courier 斜体 -
COURIER_BOLD_OBLIQUE
Courier Bold Oblique | Courier 粗斜体 -
SYMBOL
Symbol font | Symbol 字体 -
ZAPF_DINGBATS
ZapfDingbats font | ZapfDingbats 字体
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getName
-
getPdfName
Description copied from interface:PdfFontGets PDF font name (internal name) 获取 PDF 字体名称(内部名称)- Specified by:
getPdfNamein interfacePdfFont- Returns:
- PDF internal name | PDF 内部名称
-
isEmbedded
public boolean isEmbedded()Description copied from interface:PdfFontChecks if font is embedded 检查字体是否嵌入- Specified by:
isEmbeddedin interfacePdfFont- Returns:
- true if embedded | 如果嵌入返回 true
-
isHelvetica
public boolean isHelvetica()Checks if this is a Helvetica variant 检查是否为 Helvetica 变体- Returns:
- true if Helvetica family | 如果是 Helvetica 系列返回 true
-
isTimes
public boolean isTimes()Checks if this is a Times variant 检查是否为 Times 变体- Returns:
- true if Times family | 如果是 Times 系列返回 true
-
isCourier
public boolean isCourier()Checks if this is a Courier variant 检查是否为 Courier 变体- Returns:
- true if Courier family | 如果是 Courier 系列返回 true
-
isMonospace
public boolean isMonospace()Checks if this is a monospace font 检查是否为等宽字体- Returns:
- true if monospace | 如果是等宽字体返回 true
-
isBold
public boolean isBold()Checks if this is a bold variant 检查是否为粗体变体- Returns:
- true if bold | 如果是粗体返回 true
-
isItalic
public boolean isItalic()Checks if this is an italic/oblique variant 检查是否为斜体变体- Returns:
- true if italic | 如果是斜体返回 true
-