using Dashboard.CommandMachine; using Dashboard.Media; using Dashboard.Typography; namespace Dashboard.Controls { public class Label : Control { public string Text { get; set; } = string.Empty; public QFont? Font { get; set; } public float TextSize { get; set; } public bool AutoSize { get; set; } = true; protected override void ValidateLayout() { if (AutoSize) { QVec2 size = Typesetter.MeasureHorizontal(Text, TextSize, Font!); Size = size; } } protected override void ValidateVisual(CommandList cmd) { float padding = Padding; QVec2 origin = new QVec2(padding, padding); cmd.TypesetHorizontalDirect(Text, origin, TextSize, Font!); } } }