[−][src]Struct bookbinder_common::fonts::LIMITED_FONT_DB
a minimal font db containing default sans and serif fonts which are guaranteed to be present
Methods from Deref<Target = Database>
pub fn is_empty(&self) -> bool
[src]
Returns true
if the Database
contains no font faces.
pub fn len(&self) -> usize
[src]
Returns the number of font faces in the Database
.
Note that Database
stores font faces, not fonts.
For example, if a caller will try to load a font collection (*.ttc
) that contains 5 faces,
then the Database
will load 5 font faces and this method will return 5, not 1.
pub fn query(&self, query: &Query<'_>) -> Option<ID>
[src]
Performs a CSS-like query and returns the best matched font face.
pub fn faces(&self) -> &[FaceInfo]
[src]
Returns a reference to an internal storage.
This can be used for manual font matching.
pub fn face(&self, id: ID) -> Option<&FaceInfo>
[src]
Selects a FaceInfo
by id
.
Returns None
if a face with such ID was already removed,
or this ID belong to the other Database
.
pub fn face_source(&self, id: ID) -> Option<(Arc<Source>, u32)>
[src]
Returns font face storage and the face index by ID
.
pub fn with_face_data<P, T>(&self, id: ID, p: P) -> Option<T> where
P: FnOnce(&[u8], u32) -> T,
[src]
P: FnOnce(&[u8], u32) -> T,
Executes a closure with a font's data.
We can't return a reference to a font binary data because of lifetimes. So instead, you can use this method to process font's data.
The closure accepts raw font data and font face index.
In case of Source::File
, the font file will be memory mapped.
Returns None
when font file loading failed.
Example
let is_variable = db.with_font_data(id, |font_data, face_index| { let font = ttf_parser::Font::from_data(font_data, face_index).unwrap(); font.is_variable() })?;
Trait Implementations
impl Deref for LIMITED_FONT_DB
[src]
impl LazyStatic for LIMITED_FONT_DB
[src]
pub fn initialize(lazy: &Self)
[src]
Auto Trait Implementations
impl RefUnwindSafe for LIMITED_FONT_DB
impl Send for LIMITED_FONT_DB
impl Sync for LIMITED_FONT_DB
impl Unpin for LIMITED_FONT_DB
impl UnwindSafe for LIMITED_FONT_DB
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,