mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 20:27:33 +00:00
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:
+10
-2
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user