Struct CharacterMetric
pub struct CharacterMetric<'a> {
pub code: i32,
pub name: Cow<'a, str>,
pub width_x: f32,
pub bbox: Option<BBox>,
}Expand description
One entry from a StartCharMetrics block.
§Examples
use std::borrow::Cow;
use adobe_font_metrics::{BBox, CharacterMetric};
let metric = CharacterMetric {
code: 65,
name: Cow::Borrowed("A"),
width_x: 667.0,
bbox: Some(BBox {
llx: 8.0,
lly: 0.0,
urx: 660.0,
ury: 718.0,
}),
};
assert_eq!(metric.name, "A");Fields§
§code: i32Encoding-table code, or -1 if the glyph is unencoded.
i32 to accommodate multi-byte CH <hex> codes (e.g. CJK
fonts where values exceed i16::MAX).
name: Cow<'a, str>PostScript glyph name (e.g. "A", "section").
width_x: f32Horizontal advance in 1/1000 em.
bbox: Option<BBox>Glyph bounding box if the AFM provided one.
Implementations§
§impl<'a> CharacterMetric<'a>
impl<'a> CharacterMetric<'a>
pub fn into_owned(self) -> CharacterMetric<'static>
pub fn into_owned(self) -> CharacterMetric<'static>
Lift to 'static by cloning any borrowed strings.
§Examples
use std::borrow::Cow;
use adobe_font_metrics::CharacterMetric;
let metric = CharacterMetric {
code: 65,
name: Cow::Borrowed("A"),
width_x: 667.0,
bbox: None,
};
let owned = metric.into_owned();
assert_eq!(owned.name, "A");Trait Implementations§
§impl<'a> Clone for CharacterMetric<'a>
impl<'a> Clone for CharacterMetric<'a>
§fn clone(&self) -> CharacterMetric<'a>
fn clone(&self) -> CharacterMetric<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl<'a> Debug for CharacterMetric<'a>
impl<'a> Debug for CharacterMetric<'a>
§impl<'a> PartialEq for CharacterMetric<'a>
impl<'a> PartialEq for CharacterMetric<'a>
impl<'a> StructuralPartialEq for CharacterMetric<'a>
Auto Trait Implementations§
impl<'a> Freeze for CharacterMetric<'a>
impl<'a> RefUnwindSafe for CharacterMetric<'a>
impl<'a> Send for CharacterMetric<'a>
impl<'a> Sync for CharacterMetric<'a>
impl<'a> Unpin for CharacterMetric<'a>
impl<'a> UnsafeUnpin for CharacterMetric<'a>
impl<'a> UnwindSafe for CharacterMetric<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more