Skip to content

Commit 520fc3a

Browse files
committed
[libgui] draw_char_with_font_onto provides bounding box and glyph metrics
1 parent 135d56e commit 520fc3a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

rust_programs/libgui/src/font.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -180,20 +180,21 @@ pub fn draw_char_with_font_onto(
180180
drawn_ch: &mut DrawnCharacter,
181181
font: &Font,
182182
onto: &mut Box<dyn LikeLayerSlice>,
183-
) {
184-
drawn_ch.draw_box = render_char_onto(
183+
) -> (Rect, GlyphMetrics) {
184+
let (bounding_box, glyph_metrics) = render_char_onto(
185185
drawn_ch.value,
186186
font,
187187
onto,
188188
drawn_ch.pos,
189189
drawn_ch.color,
190190
drawn_ch.font_size,
191-
)
192-
.0;
191+
);
192+
drawn_ch.draw_box = bounding_box;
193+
(bounding_box, glyph_metrics)
193194
}
194195

195196
pub fn load_font(path: &str) -> Font {
196-
let font_bytes = {
197+
let font_bytes: Vec<u8> = {
197198
#[cfg(target_os = "axle")]
198199
{
199200
let file_read_request = ReadFile::new(path);

0 commit comments

Comments
 (0)