Skip to main content

Type1Font

Struct Type1Font 

Source
pub struct Type1Font {
Show 15 fields name: Option<String>, full_name: Option<String>, family_name: Option<String>, weight: Option<String>, bbox: BoundingBox<Fixed>, italic_angle: i32, is_fixed_pitch: bool, underline_position: i32, underline_thickness: i32, matrix: ScaledFontMatrix, charstrings: Charstrings, subrs: Subrs, encoding: Option<RawEncoding>, weight_vector: Vec<Fixed>, unicode_charmap: Charmap,
}
Expand description

A Type1 font.

Fields§

§name: Option<String>§full_name: Option<String>§family_name: Option<String>§weight: Option<String>§bbox: BoundingBox<Fixed>§italic_angle: i32§is_fixed_pitch: bool§underline_position: i32§underline_thickness: i32§matrix: ScaledFontMatrix§charstrings: Charstrings§subrs: Subrs§encoding: Option<RawEncoding>§weight_vector: Vec<Fixed>§unicode_charmap: Charmap

Implementations§

Source§

impl Type1Font

Source

pub fn new(data: &[u8]) -> Result<Self, Error>

Creates a new Type1 font from the given data.

Source

fn new_impl(data: &[u8]) -> Option<Self>

Source

fn empty() -> Self

Source

fn from_dicts(base: &[u8], private: &[u8]) -> Option<Self>

Source

pub fn name(&self) -> Option<&str>

Returns the PostScript name.

Source

pub fn full_name(&self) -> Option<&str>

Returns the full font name.

Source

pub fn family_name(&self) -> Option<&str>

Returns the font family name.

Source

pub fn weight(&self) -> Option<&str>

Returns the weight or style name.

Source

pub fn italic_angle(&self) -> i32

Returns the italic angle.

Source

pub fn is_fixed_pitch(&self) -> bool

Returns true if the glyphs in this font have the same width.

Source

pub fn underline_position(&self) -> i32

Returns the position of the top of an underline decoration.

Source

pub fn underline_thickness(&self) -> i32

Returns the suggested size for an underline decoration.

Source

pub fn bbox(&self) -> BoundingBox<Fixed>

Returns the font bounding box.

Source

pub fn num_glyphs(&self) -> u32

Returns the number of glyphs in the Type1 font.

Source

pub fn upem(&self) -> i32

Returns the units per em.

Source

pub fn matrix(&self) -> FontMatrix

Returns the top level font matrix.

Source

pub fn transform(&self, ppem: Option<f32>) -> Transform

Returns the appropriate transform for adjusting points and metrics.

Source

pub fn encoding(&self) -> Option<Encoding<'_>>

Returns the character encoding.

Source

pub fn unicode_charmap(&self) -> &Charmap

Returns the Unicode charmap for this font.

Note that this is an empty mapping if the agl feature is not enabled.

Source

pub fn glyph_name(&self, gid: GlyphId) -> Option<&str>

Returns the glyph name for the given id.

Source

pub fn glyph_names(&self) -> impl Iterator<Item = (GlyphId, &str)>

Returns an iterator over the pairs of glyph ids and associated names in the Type1 font.

Source

pub fn remapped_gid(&self, original_gid: GlyphId) -> GlyphId

Given a glyph identifier in the original glyph order, returns the possibly remapped identifier.

This occurs if we remap or synthesize a .notdef glyph.

Source

pub fn evaluate_charstring( &self, gid: GlyphId, sink: &mut impl CommandSink, ) -> Result<Option<Fixed>, Error>

Evaluates the charstring for the requested glyph and sends the results to the given sink.

Returns the advance with of the glyph in font units if the charstring provides one.

Source

pub fn draw( &self, gid: GlyphId, ppem: Option<f32>, pen: &mut impl OutlinePen, ) -> Result<Option<f32>, Error>

Draws the glyph with an optional size in ppem to the given pen.

Returns the advance width of the glyph if the charstring provides one.

Trait Implementations§

Source§

impl CharstringContext for Type1Font

Source§

fn kind(&self) -> CharstringKind

Returns the type of the charstring.
Source§

fn seac_components( &self, base_code: i32, accent_code: i32, ) -> Result<[&[u8]; 2], Error>

Returns the base and accent charstrings for the seac (standard encoded accented character) operator.
Source§

fn subr(&self, index: i32) -> Result<&[u8], Error>

Returns the charstring for the local subroutine at the given index as encoded in the calling charstring.
Source§

fn global_subr(&self, _index: i32) -> Result<&[u8], Error>

Returns the charstring for the global subroutine at the given index as encoded in the calling charstring.
Source§

fn weight_vector(&self) -> &[Fixed]

Returns the current active weight vector for a multiple master font.

Auto Trait Implementations§

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> 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>,

Source§

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>,

Source§

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.