pub struct Type1Font<'a> { /* private fields */ }
Expand description
Writer for a Type-1 font dictionary.
This struct is created by Chunk::type1_font
.
Implementations§
source§impl<'a> Type1Font<'a>
impl<'a> Type1Font<'a>
sourcepub fn name(&mut self, name: Name<'_>) -> &mut Self
pub fn name(&mut self, name: Name<'_>) -> &mut Self
Write the /Name
attribute, which is the name of the font in the
current resource dictionary. Required in PDF 1.0, discouraged in PDF
1.1+.
sourcepub fn base_font(&mut self, name: Name<'_>) -> &mut Self
pub fn base_font(&mut self, name: Name<'_>) -> &mut Self
Write the /BaseFont
attribute. This is the PostScript name of the
font. Required.
In PDF/A files, the standard 14 fonts are unavailable, so you must embed the font data.
sourcepub fn first_char(&mut self, first: u8) -> &mut Self
pub fn first_char(&mut self, first: u8) -> &mut Self
Write the FirstChar
attribute, defining the first character code in
the font’s widths array. Required (except for standard 14 fonts
before PDF 1.5).
sourcepub fn last_char(&mut self, last: u8) -> &mut Self
pub fn last_char(&mut self, last: u8) -> &mut Self
Write the LastChar
attribute, defining the last character code in the
font’s widths array. Required (except for standard 14 fonts before
PDF 1.5).
sourcepub fn widths(&mut self, widths: impl IntoIterator<Item = f32>) -> &mut Self
pub fn widths(&mut self, widths: impl IntoIterator<Item = f32>) -> &mut Self
Write the /Widths
array. Should be of length last - first + 1
.
Required (except for standard 14 fonts before PDF 1.5).
sourcepub fn font_descriptor(&mut self, id: Ref) -> &mut Self
pub fn font_descriptor(&mut self, id: Ref) -> &mut Self
Write the /FontDescriptor
attribute. Required (except for standard 14
fonts before PDF 1.5).
sourcepub fn encoding_predefined(&mut self, encoding: Name<'_>) -> &mut Self
pub fn encoding_predefined(&mut self, encoding: Name<'_>) -> &mut Self
Write the /Encoding
attribute as a predefined encoding. Either this or
encoding_custom
is required.
sourcepub fn encoding_custom(&mut self) -> Encoding<'_>
pub fn encoding_custom(&mut self) -> Encoding<'_>
Start writing an /Encoding
dictionary. Either this or
encoding_predefined
is required.
sourcepub fn to_unicode(&mut self, id: Ref) -> &mut Self
pub fn to_unicode(&mut self, id: Ref) -> &mut Self
Write the /ToUnicode
attribute. PDF 1.2+.
A suitable character map can be built with UnicodeCmap
.
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.