@@ -233,8 +233,8 @@ pub trait DrawingBackend: Sized {
233233 . layout_box ( text)
234234 . map_err ( |e| DrawingErrorKind :: FontError ( Box :: new ( e) ) ) ?;
235235 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;
238238 let dx = match style. anchor ( ) . h_pos {
239239 HPos :: Left => 0 ,
240240 HPos :: Right => -width,
@@ -247,15 +247,16 @@ pub trait DrawingBackend: Sized {
247247 } ;
248248 let trans = style. transform ( ) ;
249249 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| {
251251 let ( x, y) = trans. transform ( x + dx - min_x, y + dy - min_y) ;
252252 let ( x, y) = ( pos. 0 + x, pos. 1 + y) ;
253253 if x >= 0 && x < w as i32 && y >= 0 && y < h as i32 {
254254 self . draw_pixel ( ( x, y) , color)
255255 } else {
256256 Ok ( ( ) )
257257 }
258- } ) {
258+ } ) ;
259+ match drawing_result {
259260 Ok ( drawing_result) => drawing_result,
260261 Err ( font_error) => Err ( DrawingErrorKind :: FontError ( Box :: new ( font_error) ) ) ,
261262 }
0 commit comments