pub struct BitmapGlyph<'a> {}Expand description
An embedded bitmap glyph.
A bitmap is positioned in two steps. The outer bearings offset the glyph origin in font units, so they scale with the font size. The inner bearings then position the image’s corner in pixels of the strike, so they scale by the ratio of the font size to the strike size.
Fields§
§glyph: GlyphId§source: BitmapSource§pixels: Pixels<'a>§width: u32§height: u32§x_bearing: i32§y_bearing: i32§inner_x_bearing: i32§inner_y_bearing: i32§h_advance: Option<u32>§ppem_x: u16§ppem_y: u16§origin: Origin§units_per_em: u16The font’s units per em, to convert pixels to font units.
Implementations§
Source§impl<'a> BitmapGlyph<'a>
impl<'a> BitmapGlyph<'a>
fn from_bdt( glyph: GlyphId, source: BitmapSource, size: &BitmapSize, data: &BitmapData<'a>, units_per_em: u16, ) -> Option<Self>
Sourcepub fn glyph(&self) -> GlyphId
pub fn glyph(&self) -> GlyphId
Returns the glyph ID of this bitmap.
For an sbix entry that reuses another glyph’s image, this is the
requested glyph.
Sourcepub fn source(&self) -> BitmapSource
pub fn source(&self) -> BitmapSource
Returns the table that contains the bitmap.
Sourcepub fn x_bearing(&self) -> i32
pub fn x_bearing(&self) -> i32
Returns the horizontal offset of the image’s origin from the glyph origin, in font units.
This is the hmtx bearing for an sbix glyph with an outline, and
zero otherwise.
Sourcepub fn y_bearing(&self) -> i32
pub fn y_bearing(&self) -> i32
Returns the vertical offset of the image’s origin above the glyph origin, in font units.
This is the bottom of the outline’s bounding box for an sbix glyph
with an outline, and zero otherwise.
Sourcepub fn inner_x_bearing(&self) -> i32
pub fn inner_x_bearing(&self) -> i32
Returns the horizontal position of the origin
corner, in pixels to the right of the image’s origin.
Sourcepub fn inner_y_bearing(&self) -> i32
pub fn inner_y_bearing(&self) -> i32
Returns the vertical position of the origin corner,
in pixels above the image’s origin.
Sourcepub fn h_advance(&self) -> Option<u32>
pub fn h_advance(&self) -> Option<u32>
Returns the advance width in pixels, if the table provides one.
This is always None for sbix.
Sourcepub fn ppem_x(&self) -> u16
pub fn ppem_x(&self) -> u16
Returns the horizontal pixels per em of the strike that contains the glyph.
Sourcepub fn ppem_y(&self) -> u16
pub fn ppem_y(&self) -> u16
Returns the vertical pixels per em of the strike that contains the glyph.
Sourcepub fn ppem(&self) -> u16
pub fn ppem(&self) -> u16
Returns the size of the strike.
This is the larger of the horizontal and vertical pixels per em.
Sourcepub fn extents(&self) -> GlyphExtents<f32>
pub fn extents(&self) -> GlyphExtents<f32>
Returns the ink extents of the bitmap, in font units.
Each value is scaled from pixels by the strike size and rounded to a whole unit. The bearing is to the top left corner, whatever corner the table uses. The table’s outer bearings are not included.
Sourcefn pixel_extents(&self) -> GlyphExtents<i32>
fn pixel_extents(&self) -> GlyphExtents<i32>
The ink extents in pixels from the image’s origin, with the bearing to the top left corner.
Trait Implementations§
Source§impl<'a> Clone for BitmapGlyph<'a>
impl<'a> Clone for BitmapGlyph<'a>
Source§fn clone(&self) -> BitmapGlyph<'a>
fn clone(&self) -> BitmapGlyph<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more