using Quik.CommandMachine; using Quik.Media; using Quik.Typography; namespace Quik.Controls { public class Label : Control { public string Text { get; set; } 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); } } }