pub struct DefaultAppearance {
pub font: Font,
pub font_size: f64,
pub color: Color,
}Expand description
Default appearance for a form field’s value rendering (ISO 32000-1 §12.7.3.3).
The /DA entry on a form field dictionary tells viewers — and, critically,
Document::fill_field — which font, size, and colour to use when
generating the field’s /AP/N stream. Expressed in PDF as a content-stream
fragment (/FontName size Tf <color op>); this struct models it with typed
fields and serialises to that exact syntax.
Selecting a custom Type0/CID font here is the only path today that lets
fill_field emit a correct appearance for non-WinAnsi values (CJK, Arabic,
etc.) — see issue #212.
Fields§
§font: FontFont to use in the appearance stream. Must be registered on the
Document via add_font_from_bytes if a custom font is selected.
font_size: f64Font size in user-space units.
color: ColorFill colour for the drawn text.
Implementations§
Source§impl DefaultAppearance
impl DefaultAppearance
Sourcepub fn new(font: Font, font_size: f64, color: Color) -> Self
pub fn new(font: Font, font_size: f64, color: Color) -> Self
Build a default appearance from its typed components.
Sourcepub fn to_da_string(&self) -> String
pub fn to_da_string(&self) -> String
Render as the PDF /DA string per ISO 32000-1 §12.7.3.3.
Examples:
Font::Helvetica, 12.0,Color::gray(0.0)→/Helvetica 12 Tf 0 gFont::Custom("CJK"), 14.0,Color::rgb(0.0, 0.0, 0.0)→/CJK 14 Tf 0 0 0 rg
Trait Implementations§
Source§impl Clone for DefaultAppearance
impl Clone for DefaultAppearance
Source§fn clone(&self) -> DefaultAppearance
fn clone(&self) -> DefaultAppearance
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more