@@ -186,15 +186,13 @@ pub fn set_wall(todos: &[String], dones: &[String]) {
186
186
187
187
if todos. len ( ) > 0 {
188
188
to_print. push ( "TODOS:" . to_string ( ) ) ;
189
- to_print. push ( "" . to_string ( ) ) ;
190
189
for ( i, todo) in todos. iter ( ) . enumerate ( ) {
191
190
to_print. push ( format ! ( "{}. {}" , i + 1 , todo) ) ;
192
191
}
193
192
}
194
193
if dones. len ( ) > 0 {
195
194
to_print. push ( "" . to_string ( ) ) ;
196
195
to_print. push ( "DONES:" . to_string ( ) ) ;
197
- to_print. push ( "" . to_string ( ) ) ;
198
196
for ( i, done) in dones. iter ( ) . enumerate ( ) {
199
197
to_print. push ( format ! ( "{}. {}" , i + 1 , done) ) ;
200
198
}
@@ -258,7 +256,7 @@ fn write_wallpaper(
258
256
} else {
259
257
2 * img_width / 3
260
258
} ) ,
261
- 0u32 ,
259
+ ( 0.1 * img_height as f32 ) as u32 ,
262
260
) ;
263
261
264
262
// 2. scale the font according to the image dimensions (with min and max - clamp)
@@ -301,15 +299,25 @@ fn write_wallpaper(
301
299
. blur ( 15f32 ) ;
302
300
img. copy_from ( & blurred_img, start_x as u32 , 0 ) ?;
303
301
304
- // 5. add text to the image leaving a margin of 2% of the image width and height
305
- wrapped_string. iter ( ) . enumerate ( ) . for_each ( |( i, line) | {
302
+ // adjust start_x to include the margin
303
+ let start_x = start_x + ( 0.02 * img_width as f32 ) as u32 ;
304
+
305
+ // y position of the text
306
+ let mut i: f32 = 0.0 ;
307
+
308
+ // 5. add text to the image
309
+ wrapped_string. iter ( ) . for_each ( |line| {
310
+ if line. len ( ) > 0 && line[ 1 ..] . starts_with ( ". " ) {
311
+ i += 1.5 ;
312
+ } else {
313
+ i += 1.0 ;
314
+ }
315
+
306
316
drawing:: draw_text_mut (
307
317
& mut img,
308
318
text_color,
309
- start_x as i32 + ( 0.02 * img_width as f32 ) as i32 ,
310
- start_y as i32
311
- + ( ( 1.15 * i as f32 * font_size. y ) as i32 )
312
- + ( 0.1 * img_height as f32 ) as i32 ,
319
+ start_x as i32 ,
320
+ start_y as i32 + ( ( 1.15 * i as f32 * font_size. y ) as i32 ) ,
313
321
font_size,
314
322
& font,
315
323
line,
@@ -396,3 +404,4 @@ fn wrap_string(text: String, bounding_box_width: usize, font: &Font, scale: &Sca
396
404
// TODO: use screen dimensions instead of image dimensions for:
397
405
// - font size
398
406
// - start and end of the image to use since the image is scaled and cropped accordingly by the DE
407
+ // TODO: name dark and light wallpapers differently
0 commit comments