PreprocessedFontFace

Struct PreprocessedFontFace 

Source
pub struct PreprocessedFontFace<'a>(/* private fields */);
Expand description

Font face that has been preprocessed for subsetting.

See FontFace::preprocess_for_subsetting().

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

Source

pub fn underlying_blob(&self) -> Blob<'_>

Gets the blob underlying this font face.

Useful when you want to output the font face to a file.

Returns an empty blob if referencing face data is not possible.

Source

pub fn glyph_count(&self) -> usize

Fetches the glyph-count value of the specified face object.

Source

pub fn covered_codepoints(&self) -> Result<CharSet<'_>, AllocationError>

Collects all of the Unicode characters covered by the font face.

Source

pub fn nominal_glyph_mapping( &self, ) -> Result<Map<'static, char, u32>, AllocationError>

Collects the mapping from Unicode characters to nominal glyphs of the face.

Source

pub fn preprocess_for_subsetting(&self) -> PreprocessedFontFace<'a>

Preprocesses the face and attaches data that will be needed by the subsetter.

Future subsetting operations can use the precomputed data to speed up the subsetting operation. The preprocessing operation may take longer than the time it takes to produce a subset from the source font. Thus the main performance gains are made when a preprocessed face is reused for multiple subsetting operations.

§Example
let font = FontFace::new(Blob::from_file("tests/fonts/NotoSans.ttf")?)?;
let processed = font.preprocess_for_subsetting();
for subset in subsets() {
    subset.subset_font(&processed)?;
}
Source

pub fn as_raw(&self) -> *mut hb_face_t

Exposes the raw inner pointer without transferring the ownership.

Unlike Self::into_raw, this method does not transfer the ownership of the pointer to the caller.

Source

pub fn ot_name( &self, name: impl Into<hb_ot_name_id_t>, language: Language, ) -> String

Gets value from OpenType name table for given language.

Instead of using this method directly, consider using one of the convenience methods for getting the correct string directly.

If language is null(), English is assumed.

Source

pub fn copyright(&self) -> String

Gets copyright notice.

§Example
let font = FontFace::new(Blob::from_file("tests/fonts/NotoSans.ttf")?)?;
assert_eq!(font.copyright(), "Copyright 2022 The Noto Project Authors (https://github.com/notofonts/latin-greek-cyrillic)");
Source

pub fn font_family(&self) -> String

Gets font family name.

§Example
let font = FontFace::new(Blob::from_file("tests/fonts/NotoSans.ttf")?)?;
assert_eq!(font.font_family(), "Noto Sans");
Source

pub fn font_subfamily(&self) -> String

Gets font subfamily name.

§Example
let font = FontFace::new(Blob::from_file("tests/fonts/NotoSans.ttf")?)?;
assert_eq!(font.font_subfamily(), "Regular");
Source

pub fn unique_id(&self) -> String

Gets unique font identifier.

§Example
let font = FontFace::new(Blob::from_file("tests/fonts/NotoSans.ttf")?)?;
assert_eq!(font.unique_id(), "2.013;GOOG;NotoSans-Regular");
Source

pub fn full_name(&self) -> String

Gets full font name that reflects all family and relevant subfamily descriptors.

§Example
let font = FontFace::new(Blob::from_file("tests/fonts/NotoSans.ttf")?)?;
assert_eq!(font.full_name(), "Noto Sans Regular");
Source

pub fn version_string(&self) -> String

Gets version string.

§Example
let font = FontFace::new(Blob::from_file("tests/fonts/NotoSans.ttf")?)?;
assert_eq!(font.version_string(), "Version 2.013; ttfautohint (v1.8.4.7-5d5b)");
Source

pub fn postscript_name(&self) -> String

Gets PostScript name for the font.

§Example
let font = FontFace::new(Blob::from_file("tests/fonts/NotoSans.ttf")?)?;
assert_eq!(font.postscript_name(), "NotoSans-Regular");
Source

pub fn trademark(&self) -> String

Gets trademark information.

§Example
let font = FontFace::new(Blob::from_file("tests/fonts/NotoSans.ttf")?)?;
assert_eq!(font.trademark(), "Noto is a trademark of Google LLC.");
Source

pub fn manufacturer(&self) -> String

Gets manufacturer name.

§Example
let font = FontFace::new(Blob::from_file("tests/fonts/NotoSans.ttf")?)?;
assert_eq!(font.manufacturer(), "Monotype Imaging Inc.");
Source

pub fn designer(&self) -> String

Gets designer name.

§Example
let font = FontFace::new(Blob::from_file("tests/fonts/NotoSans.ttf")?)?;
assert_eq!(font.designer(), "Monotype Design Team");
Source

pub fn description(&self) -> String

Gets description.

§Example
let font = FontFace::new(Blob::from_file("tests/fonts/NotoSans.ttf")?)?;
assert_eq!(font.description(), "Designed by Monotype design team, Irene Vlachou.");
Source

pub fn vendor_url(&self) -> String

Gets URL of font vendor.

§Example
let font = FontFace::new(Blob::from_file("tests/fonts/NotoSans.ttf")?)?;
assert_eq!(font.vendor_url(), "http://www.google.com/get/noto/");
Source

pub fn designer_url(&self) -> String

Gets URL of typeface designer.

§Example
let font = FontFace::new(Blob::from_file("tests/fonts/NotoSans.ttf")?)?;
assert_eq!(font.designer_url(), "http://www.monotype.com/studio");
Source

pub fn license(&self) -> String

Gets license description.

§Example
let font = FontFace::new(Blob::from_file("tests/fonts/NotoSans.ttf")?)?;
assert_eq!(font.license(), "This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is available with a FAQ at: https://scripts.sil.org/OFL");
Source

pub fn license_url(&self) -> String

Gets URL where additional licensing information can be found.

§Example
let font = FontFace::new(Blob::from_file("tests/fonts/NotoSans.ttf")?)?;
assert_eq!(font.license_url(), "https://scripts.sil.org/OFL");
Source

pub fn typographic_family(&self) -> String

Gets typographic family name.

Source

pub fn typographic_subfamily(&self) -> String

Gets typographic subfamily name.

Source

pub fn mac_full_name(&self) -> String

Gets compatible full name for MacOS.

Source

pub fn sample_text(&self) -> String

Gets sample text.

Source

pub fn cid_findfont_name(&self) -> String

Gets PostScript CID findfont name.

Source

pub fn wws_family(&self) -> String

Gets WWS family Name.

Source

pub fn wws_subfamily(&self) -> String

Gets WWS subfamily Name.

Source

pub fn light_background(&self) -> String

Gets light background palette.

Source

pub fn dark_background(&self) -> String

Gets dark background palette.

Source

pub fn variations_ps_prefix(&self) -> String

Gets variations PostScript name prefix.

Trait Implementations§

Source§

impl<'a> Deref for PreprocessedFontFace<'a>

Source§

type Target = FontFace<'a>

The resulting type after dereferencing.
Source§

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

Dereferences the value.

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.