|
|
@ -12,7 +12,7 @@ use ::packer::{Packer, GrowingPacker, SkylinePacker}; |
|
|
|
/// Wraps a rusttype font and provides atlas packing and rasterization functions.
|
|
|
|
#[derive(Clone)]
|
|
|
|
pub struct Font<'a> {
|
|
|
|
font: rusttype::Font<'a>,
|
|
|
|
pub font: rusttype::Font<'a>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[allow(dead_code)]
|
|
|
@ -74,7 +74,6 @@ impl<'a> Font<'a> { |
|
|
|
None => return None, // propogate missing glyphs out of the function
|
|
|
|
}.scaled(rusttype::Scale::uniform(scale));
|
|
|
|
|
|
|
|
let h_metrics = glyph.h_metrics();
|
|
|
|
let glyph = glyph.positioned(rusttype::Point {x: 0., y: 0.});
|
|
|
|
let bbox = match glyph.pixel_bounding_box() {
|
|
|
|
Some(b) => b,
|
|
|
@ -94,9 +93,6 @@ impl<'a> Font<'a> { |
|
|
|
w: bbox.width() as usize,
|
|
|
|
h: bbox.height() as usize,
|
|
|
|
},
|
|
|
|
|
|
|
|
advance_width: h_metrics.advance_width,
|
|
|
|
left_bearing: h_metrics.left_side_bearing,
|
|
|
|
};
|
|
|
|
|
|
|
|
Some((data, out))
|
|
|
|