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>
impl<'a> FontDescriptor<'a>
sourcepub fn name(&mut self, name: Name<'_>) -> &mut Self
pub fn name(&mut self, name: Name<'_>) -> &mut Self
Write the /FontName
attribute. Required, except for Type 3 fonts.
sourcepub fn family(&mut self, family: Str<'_>) -> &mut Self
pub fn family(&mut self, family: Str<'_>) -> &mut Self
Write the /FontFamily
attribute. Recommended for Type 3 fonts in
Tagged PDFs. PDF 1.5+.
sourcepub fn stretch(&mut self, stretch: FontStretch) -> &mut Self
pub fn stretch(&mut self, stretch: FontStretch) -> &mut Self
Write the /FontStretch
attribute. Recommended for Type 3 fonts in
Tagged PDFs. PDF 1.5+.
sourcepub fn weight(&mut self, weight: u16) -> &mut Self
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+.
sourcepub fn bbox(&mut self, bbox: Rect) -> &mut Self
pub fn bbox(&mut self, bbox: Rect) -> &mut Self
Write the /FontBBox
attribute. Required, except for Type 3 fonts.
sourcepub fn italic_angle(&mut self, angle: f32) -> &mut Self
pub fn italic_angle(&mut self, angle: f32) -> &mut Self
Write the /ItalicAngle
attribute. Required.
sourcepub fn cap_height(&mut self, cap_height: f32) -> &mut Self
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.
sourcepub fn stem_v(&mut self, stem_v: f32) -> &mut Self
pub fn stem_v(&mut self, stem_v: f32) -> &mut Self
Write the /StemV
attribute. Required, except for Type 3 fonts.
sourcepub fn missing_width(&mut self, missing_width: f32) -> &mut Self
pub fn missing_width(&mut self, missing_width: f32) -> &mut Self
Write the /MissingWidth
attribute.
sourcepub fn font_file(&mut self, id: Ref) -> &mut Self
pub fn font_file(&mut self, id: Ref) -> &mut Self
Write the /FontFile
attribute, referecing Type 1 font data.
sourcepub fn font_file2(&mut self, id: Ref) -> &mut Self
pub fn font_file2(&mut self, id: Ref) -> &mut Self
Write the /FontFile2
attribute, referencing TrueType font data. PDF
1.1+.
sourcepub fn font_file3(&mut self, id: Ref) -> &mut Self
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.
sourcepub fn char_set(&mut self, names: Str<'_>) -> &mut Self
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+.
If present in PDF/A, this must include all characters in the subset, even if they are not used in the document.
source§impl FontDescriptor<'_>
impl FontDescriptor<'_>
Additional FontDescriptor
attributes for CIDFonts.
sourcepub fn style(&mut self, class: u8, subclass: u8, panose: [u8; 10]) -> &mut Self
pub fn style(&mut self, class: u8, subclass: u8, panose: [u8; 10]) -> &mut Self
Write the /Style
attribute. Optional.
The class and subclass values should be extracted from the
sFamilyClass
field of the OS/2 table. The panose
array should be
extracted from the panose
field of the OS/2 table.
sourcepub fn descriptor_override(&mut self) -> FontDescriptorOverride<'_>
pub fn descriptor_override(&mut self) -> FontDescriptorOverride<'_>
Start writing the /FD
attribute. Optional.
Overrides the global font descriptor for specific glyphs.
Methods from Deref<Target = Dict<'a>>§
sourcepub fn insert(&mut self, key: Name<'_>) -> Obj<'_>
pub fn insert(&mut self, key: Name<'_>) -> Obj<'_>
Start writing a pair with an arbitrary value.
sourcepub fn pair<T: Primitive>(&mut self, key: Name<'_>, value: T) -> &mut Self
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)
.
sourcepub fn pairs<'n, T: Primitive>(
&mut self,
pairs: impl IntoIterator<Item = (Name<'n>, T)>,
) -> &mut Self
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.