11use std:: path:: MAIN_SEPARATOR_STR ;
22
3- use cosmic_text:: { Attrs , Family } ;
3+ use cosmic_text:: { Attrs , Family , Metrics } ;
44use regex:: Regex ;
55
66use crate :: {
7- config,
87 edges:: margin:: Margin ,
9- utils:: text:: { create_file_system_by_fonts_folder, FontRenderer } ,
108 utils:: { code:: calc_wh_with_min_width, color:: RgbaColor } ,
119} ;
1210
@@ -24,6 +22,10 @@ pub struct Breadcrumbs {
2422}
2523
2624impl Component for Breadcrumbs {
25+ fn name ( & self ) -> & ' static str {
26+ "Breadcrumbs"
27+ }
28+
2729 fn children ( & self ) -> & Vec < Box < dyn Component > > {
2830 & self . children
2931 }
@@ -59,7 +61,7 @@ impl Component for Breadcrumbs {
5961 pixmap : & mut tiny_skia:: Pixmap ,
6062 context : & super :: interface:: component:: ComponentContext ,
6163 render_params : & super :: interface:: component:: RenderParams ,
62- style : & super :: interface:: style:: ComponentStyle ,
64+ _style : & super :: interface:: style:: ComponentStyle ,
6365 _parent_style : & ComponentStyle ,
6466 ) -> super :: interface:: render_error:: Result < ( ) > {
6567 let config = context. take_snapshot_params . code_config . breadcrumbs . clone ( ) ;
@@ -79,17 +81,10 @@ impl Component for Breadcrumbs {
7981 & context. take_snapshot_params . code_config . font_family ,
8082 ) ) ;
8183
82- FontRenderer :: new (
83- 12. ,
84- LINE_HEIGHT ,
85- context. scale_factor ,
86- create_file_system_by_fonts_folder ( & context. take_snapshot_params . fonts_folder ) ,
87- )
88- . draw_text (
84+ context. font_renderer . lock ( ) . unwrap ( ) . draw_text (
8985 render_params. x ,
9086 render_params. y ,
91- style. width ,
92- LINE_HEIGHT ,
87+ Metrics :: new ( 12. , LINE_HEIGHT ) ,
9388 vec ! [ ( & path, attrs) ] ,
9489 pixmap,
9590 ) ;
0 commit comments