@@ -233,8 +233,8 @@ pub trait DrawingBackend: Sized {
233
233
. layout_box ( text)
234
234
. map_err ( |e| DrawingErrorKind :: FontError ( Box :: new ( e) ) ) ?;
235
235
let ( ( min_x, min_y) , ( max_x, max_y) ) = layout;
236
- let width = ( max_x - min_x) as i32 ;
237
- let height = ( max_y - min_y) as i32 ;
236
+ let width = max_x - min_x;
237
+ let height = max_y - min_y;
238
238
let dx = match style. anchor ( ) . h_pos {
239
239
HPos :: Left => 0 ,
240
240
HPos :: Right => -width,
@@ -247,15 +247,16 @@ pub trait DrawingBackend: Sized {
247
247
} ;
248
248
let trans = style. transform ( ) ;
249
249
let ( w, h) = self . get_size ( ) ;
250
- match style. draw ( text, ( 0 , 0 ) , |x, y, color| {
250
+ let drawing_result = style. draw ( text, ( 0 , 0 ) , |x, y, color| {
251
251
let ( x, y) = trans. transform ( x + dx - min_x, y + dy - min_y) ;
252
252
let ( x, y) = ( pos. 0 + x, pos. 1 + y) ;
253
253
if x >= 0 && x < w as i32 && y >= 0 && y < h as i32 {
254
254
self . draw_pixel ( ( x, y) , color)
255
255
} else {
256
256
Ok ( ( ) )
257
257
}
258
- } ) {
258
+ } ) ;
259
+ match drawing_result {
259
260
Ok ( drawing_result) => drawing_result,
260
261
Err ( font_error) => Err ( DrawingErrorKind :: FontError ( Box :: new ( font_error) ) ) ,
261
262
}
0 commit comments