@@ -83,12 +83,27 @@ impl Drawable for Label {
83
83
}
84
84
85
85
fn draw ( & self ) -> Vec < Rect > {
86
+ /*
87
+ println!("\nLabel::draw()");
88
+ println!("\nLabel frame: {}", self.frame());
89
+ */
86
90
let onto = & mut self . get_slice ( ) ;
87
- let font_size = Size :: new ( 8 , 10 ) ;
91
+ //println!("\nOnto frame: {}", onto.frame() );
88
92
let mut cursor = Point :: zero ( ) ;
89
93
for ch in self . text . borrow ( ) . chars ( ) {
90
- draw_char ( onto, ch, & cursor, self . color , & font_size) ;
91
- cursor. x += font_size. width ;
94
+ /*
95
+ draw_char(onto, ch, &cursor, self.color, &self.font_size);
96
+ cursor.x += self.font_size.width;
97
+ */
98
+ let mut drawn_ch = DrawnCharacter :: new ( cursor, self . color , ch, self . font_size ) ;
99
+ let ( bounding_box, glyph_metrics) =
100
+ draw_char_with_font_onto ( & mut drawn_ch, & self . font , onto) ;
101
+ //let scaled_glyph_metrics = scaled_metrics_for_codepoint(&self.font, self.font_size, ch);
102
+ //let scaled_glyph_metrics = scaled_metrics_for_codepoint(&self.font, self.font_size, ch);
103
+ //cursor.x += scaled_glyph_metrics.advance_width as isize;
104
+ cursor. x += glyph_metrics. advance_width as isize ;
105
+ //cursor.x += bounding_box.width();
106
+ //cursor.x += scaled_glyph_metrics.advance_width as isize;
92
107
}
93
108
// TODO: Damages
94
109
vec ! [ ]
0 commit comments