Struct pdf_writer::writers::FontDescriptor

source ·
pub struct FontDescriptor<'a> { /* private fields */ }
Expand description

Writer for a font descriptor dictionary.

This struct is created by Chunk::font_descriptor.

Implementations§

source§

impl<'a> FontDescriptor<'a>

source

pub fn name(&mut self, name: Name<'_>) -> &mut Self

Write the /FontName attribute. Required.

source

pub fn family(&mut self, family: Str<'_>) -> &mut Self

Write the /FontFamily attribute. Recommended for Type 3 fonts in Tagged PDFs. PDF 1.5+.

source

pub fn stretch(&mut self, stretch: FontStretch) -> &mut Self

Write the /FontStretch attribute. Recommended for Type 3 fonts in Tagged PDFs. PDF 1.5+.

source

pub fn weight(&mut self, weight: u16) -> &mut Self

Write the /FontWeight attribute. Should be between 100 (lightest) and 900 (heaviest), 400 is normal weight, 700 is bold. Recommended for Type 3 fonts in Tagged PDFs. PDF 1.5+.

source

pub fn flags(&mut self, flags: FontFlags) -> &mut Self

Write the /Flags attribute. Required.

source

pub fn bbox(&mut self, bbox: Rect) -> &mut Self

Write the /FontBBox attribute. Required, except for Type 3 fonts.

source

pub fn italic_angle(&mut self, angle: f32) -> &mut Self

Write the /ItalicAngle attribute. Required.

source

pub fn ascent(&mut self, ascent: f32) -> &mut Self

Write the /Ascent attribute. Required.

source

pub fn descent(&mut self, descent: f32) -> &mut Self

Write the /Descent attribute. Required.

source

pub fn leading(&mut self, leading: f32) -> &mut Self

Write the /Leading attribute.

source

pub fn cap_height(&mut self, cap_height: f32) -> &mut Self

Write the /CapHeight attribute. Required for fonts with Latin characters, except for Type 3 fonts.

source

pub fn x_height(&mut self, x_height: f32) -> &mut Self

Write the /XHeight attribute.

source

pub fn stem_v(&mut self, stem_v: f32) -> &mut Self

Write the /StemV attribute. Required, except for Type 3 fonts.

source

pub fn stem_h(&mut self, stem_h: f32) -> &mut Self

Write the /StemH attribute.

source

pub fn avg_width(&mut self, avg_width: f32) -> &mut Self

Write the /AvgWidth attribute.

source

pub fn max_width(&mut self, max_width: f32) -> &mut Self

Write the /MaxWidth attribute.

source

pub fn missing_width(&mut self, missing_width: f32) -> &mut Self

Write the /MissingWidth attribute.

source

pub fn font_file(&mut self, id: Ref) -> &mut Self

Write the /FontFile attribute, referecing Type 1 font data.

source

pub fn font_file2(&mut self, id: Ref) -> &mut Self

Write the /FontFile2 attribute, referencing TrueType font data. PDF 1.1+.

source

pub fn font_file3(&mut self, id: Ref) -> &mut Self

Write the /FontFile3 attribute, referencing CFF font data. PDF 1.2+ or PDF 1.3+ for CID-keyed fonts.

source

pub fn char_set(&mut self, names: Str<'_>) -> &mut Self

Write the /CharSet attribute, encoding the character names of a font subset as a string. This is only relevant for Type 1 fonts. PDF 1.1+.

Methods from Deref<Target = Dict<'a>>§

source

pub fn len(&self) -> i32

The number of written pairs.

source

pub fn is_empty(&self) -> bool

Whether no pairs have been written so far.

source

pub fn insert(&mut self, key: Name<'_>) -> Obj<'_>

Start writing a pair with an arbitrary value.

source

pub fn pair<T: Primitive>(&mut self, key: Name<'_>, value: T) -> &mut Self

Write a pair with a primitive value.

This is a shorthand for dict.insert(key).primitive(value).

source

pub fn pairs<'n, T: Primitive>( &mut self, pairs: impl IntoIterator<Item = (Name<'n>, T)> ) -> &mut Self

Write a sequence of pairs with primitive values.

Trait Implementations§

source§

impl<'a> Deref for FontDescriptor<'a>

§

type Target = Dict<'a>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'a> DerefMut for FontDescriptor<'a>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<'a, 'any> Rewrite<'a> for FontDescriptor<'any>

§

type Output = FontDescriptor<'a>

The writer with the rewritten lifetime.
source§

impl<'a> Writer<'a> for FontDescriptor<'a>

source§

fn start(obj: Obj<'a>) -> Self

Start writing the object.

Auto Trait Implementations§

§

impl<'a> Freeze for FontDescriptor<'a>

§

impl<'a> RefUnwindSafe for FontDescriptor<'a>

§

impl<'a> Send for FontDescriptor<'a>

§

impl<'a> Sync for FontDescriptor<'a>

§

impl<'a> Unpin for FontDescriptor<'a>

§

impl<'a> !UnwindSafe for FontDescriptor<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Finish for T

source§

fn finish(self)

Does nothing but move self, equivalent to drop.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.