1
0
Fork 0
forked from wry/wry

text: add metrics and dynamic height

This commit is contained in:
Julian Orth 2022-07-30 16:16:35 +02:00
parent 2568b7b1f5
commit 8b93957f31
4 changed files with 84 additions and 28 deletions

View file

@ -168,7 +168,7 @@ impl OutputNode {
};
let title = match text::render_fitting(
&ctx,
texture_height,
Some(texture_height),
&font,
&ws.name,
tc,
@ -219,14 +219,21 @@ impl OutputNode {
break 'set_status;
}
let tc = self.state.theme.colors.bar_text.get();
let title =
match text::render_fitting(&ctx, texture_height, &font, &status, tc, true, scale) {
Ok(t) => t,
Err(e) => {
log::error!("Could not render status {}: {}", status, ErrorFmt(e));
break 'set_status;
}
};
let title = match text::render_fitting(
&ctx,
Some(texture_height),
&font,
&status,
tc,
true,
scale,
) {
Ok(t) => t,
Err(e) => {
log::error!("Could not render status {}: {}", status, ErrorFmt(e));
break 'set_status;
}
};
let mut width = title.width();
if let Some(scale) = scale {
width = (width as f64 / scale).round() as _;

View file

@ -61,7 +61,7 @@ impl PlaceholderNode {
let font = format!("monospace {}", width / 10);
match text::render_fitting(
&ctx,
height,
Some(height),
&font,
"Fullscreen",
self.toplevel.state.theme.colors.unfocused_title_text.get(),