fix(slices): center badge letter via widgetset TextRect

Manual TextWidth/TextHeight centering pushed the glyph up-left on the
substituted monospace font (Linux). Let the widgetset center it with a
taCenter/tlCenter TTextStyle, fixing the A/×/SPLIT/TX badges.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 13:26:12 +03:00
co-authored by Claude Opus 4.8
parent 30a6616dbe
commit 3049f919a3
+10 -2
View File
@@ -592,6 +592,8 @@ end;
procedure TVfoOverlay.DrawBadge(C: TCanvas; const R: TRect; const Lbl: string;
BgColor, TxtColor: TColor);
var
TS: TTextStyle;
begin
C.Brush.Color := BgColor;
C.Brush.Style := bsSolid;
@@ -603,8 +605,14 @@ begin
C.Font.Style := [fsBold];
C.Font.Color := TxtColor;
C.Brush.Style := bsClear;
C.TextOut(R.Left + (R.Right - R.Left - C.TextWidth(Lbl)) div 2,
R.Top + (R.Bottom - R.Top - C.TextHeight('A')) div 2, Lbl);
// Центровку доверяем виджетсету (TextRect со стилем) — ручной расчёт по
// TextWidth/Height на подменном шрифте уводил глиф влево-вверх.
FillChar(TS, SizeOf(TS), 0);
TS.Alignment := taCenter;
TS.Layout := tlCenter;
TS.SingleLine := True;
TS.Clipping := True;
C.TextRect(R, R.Left, R.Top, Lbl, TS);
end;
procedure TVfoOverlay.DrawSpeaker(C: TCanvas; X, Y: Integer; Muted: Boolean);