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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DefaultAppearance
impl RefUnwindSafe for DefaultAppearance
impl Send for DefaultAppearance
impl Sync for DefaultAppearance
impl Unpin for DefaultAppearance
impl UnsafeUnpin for DefaultAppearance
impl UnwindSafe for DefaultAppearance
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more