diff --git a/crates/horizon-client/src/hud_overlays.rs b/crates/horizon-client/src/hud_overlays.rs index 3f26cf467..ecc23a5ee 100644 --- a/crates/horizon-client/src/hud_overlays.rs +++ b/crates/horizon-client/src/hud_overlays.rs @@ -294,6 +294,7 @@ impl Titles { let t = self.overlay_time as f32 - partial; let alpha = ((t * 255.0 / 20.0) as i32).min(255); if alpha > 0 { + let message = message.resolve_legacy(); out.push(GuiDraw::Push(vec![PoseOp::Translate( (w / 2) as f32, (h - 68) as f32, @@ -303,16 +304,8 @@ impl Titles { } else { crate::hud_layout::argb(alpha as u32, 255, 255, 255) }; - let width = width(font, message); - text_with_backdrop( - &mut out, - message.clone(), - -width / 2, - -4, - width, - color, - background, - ); + let width = width(font, &message); + text_with_backdrop(&mut out, message, -width / 2, -4, width, color, background); out.push(GuiDraw::Pop); } out @@ -344,16 +337,17 @@ impl Titles { } let alpha = alpha.clamp(0, 255); if alpha > 0 { + let title = title.resolve_legacy(); out.push(GuiDraw::Push(vec![PoseOp::Translate( (w / 2) as f32, (h / 2) as f32, )])); out.push(GuiDraw::Push(vec![PoseOp::Scale(4.0, 4.0)])); - let title_width = width(font, title); + let title_width = width(font, &title); let color = crate::hud_layout::argb(alpha as u32, 255, 255, 255); text_with_backdrop( &mut out, - title.clone(), + title, -title_width / 2, -10, title_width, @@ -362,11 +356,12 @@ impl Titles { ); out.push(GuiDraw::Pop); if let Some(subtitle) = &self.subtitle { + let subtitle = subtitle.resolve_legacy(); out.push(GuiDraw::Push(vec![PoseOp::Scale(2.0, 2.0)])); - let subtitle_width = width(font, subtitle); + let subtitle_width = width(font, &subtitle); text_with_backdrop( &mut out, - subtitle.clone(), + subtitle, -subtitle_width / 2, 5, subtitle_width, @@ -506,10 +501,11 @@ pub fn boss_overlay(w: i32, h: i32, bars: &[BossBar], font: &Font) -> Vec 0 { part(&mut out, progress, "progress"); } - let width = width(font, &bar.name); + let name = bar.name.resolve_legacy(); + let width = width(font, &name); text( &mut out, - bar.name.clone(), + name, w / 2 - width / 2, y_offset - 9, crate::hud_layout::WHITE, diff --git a/tools/hud_parity_cases.py b/tools/hud_parity_cases.py index 7d1f50333..7cd3e3f53 100644 --- a/tools/hud_parity_cases.py +++ b/tools/hud_parity_cases.py @@ -73,7 +73,9 @@ def effects(rng, n): TITLES = [{'text': 'Hello'}, {'text': 'Boss fight!', 'color': 'red', 'bold': True}, {'text': 'Wave 3', 'italic': True}, {'text': 'A long title over the whole screen'}, {'text': ''}, ['Mixed ', {'text': 'parts', 'color': 'gold'}], - {'text': 'Ünïcödé ★'}] + {'text': 'Ünïcödé ★'}, + # Servers send legacy formatting codes inside a component's text; the font applies them: + {'text': '§8[§fAny questions? §8] §e§l/support en'}, {'text': '§cRed §rreset §', 'color': 'blue'}] def title(rng, n):