@@ -56,7 +56,7 @@ impl Error for FontError {}
56
56
impl FontData for FontDataInternal {
57
57
// TODO: can we rename this to `Error`?
58
58
type ErrorType = FontError ;
59
- fn new ( family : FontFamily < ' _ > , style : FontStyle ) -> Result < Self , Self :: ErrorType > {
59
+ fn new ( family : FontFamily < ' _ > , _style : FontStyle ) -> Result < Self , Self :: ErrorType > {
60
60
Ok ( Self {
61
61
font_ref : FONTS
62
62
. read ( )
@@ -69,7 +69,7 @@ impl FontData for FontDataInternal {
69
69
// TODO: ngl, it makes no sense that this uses the same error type as `new`
70
70
fn estimate_layout ( & self , size : f64 , text : & str ) -> Result < LayoutBox , Self :: ErrorType > {
71
71
let pixel_per_em = size / 1.24 ;
72
- let units_per_em = self . font_ref . units_per_em ( ) . unwrap ( ) ;
72
+ // let units_per_em = self.font_ref.units_per_em().unwrap();
73
73
let font = self . font_ref . as_scaled ( size as f32 ) ;
74
74
75
75
let mut x_pixels = 0f32 ;
@@ -108,14 +108,13 @@ impl FontData for FontDataInternal {
108
108
prev = Some ( c) ;
109
109
let glyph = font. scaled_glyph ( c) ;
110
110
if let Some ( q) = font. outline_glyph ( glyph) {
111
- use :: std:: panic:: { self , AssertUnwindSafe } ;
112
111
let rect = q. px_bounds ( ) ;
113
112
let y_shift = ( ( size as f32 ) / 2.0 + rect. min . y ) as i32 ;
114
113
let x_shift = x_shift as i32 ;
115
114
let mut buf = vec ! [ ] ;
116
115
q. draw ( |x, y, c| buf. push ( ( x, y, c) ) ) ;
117
116
for ( x, y, c) in buf {
118
- draw ( x as i32 + x_shift, y as i32 + y_shift, c) . map_err ( |e | {
117
+ draw ( x as i32 + x_shift, y as i32 + y_shift, c) . map_err ( |_e | {
119
118
// Note: If ever `plotters` adds a tracing or logging crate,
120
119
// this would be a good place to use it.
121
120
FontError :: Unknown
0 commit comments