fix(text): show selected formatting and style controls
Use category-filtered font and selected-item dropdowns, separate horizontal and vertical alignment, and reuse the border-color palette templates for text color. Persist vertical alignment additively. Follow the established static text-source pattern: https://obsproject.com/kb/text-sources
This commit is contained in:
@@ -59,6 +59,7 @@ public sealed class TextOverlayRenderer
|
||||
source.TextItalic,
|
||||
source.TextUnderline,
|
||||
source.TextAlignment,
|
||||
source.TextVerticalAlignment,
|
||||
RasterDimension(source.Width),
|
||||
RasterDimension(source.Height));
|
||||
|
||||
@@ -100,7 +101,13 @@ public sealed class TextOverlayRenderer
|
||||
};
|
||||
if (config.Underline)
|
||||
formatted.SetTextDecorations(TextDecorations.Underline, 0, config.Content.Length);
|
||||
drawing.DrawText(formatted, new Point(0, 0));
|
||||
var top = config.VerticalAlignment switch
|
||||
{
|
||||
TextLayerVerticalAlignment.Center => Math.Max(0, (config.Height - formatted.Height) / 2),
|
||||
TextLayerVerticalAlignment.Bottom => Math.Max(0, config.Height - formatted.Height),
|
||||
_ => 0,
|
||||
};
|
||||
drawing.DrawText(formatted, new Point(0, top));
|
||||
}
|
||||
|
||||
var bitmap = new RenderTargetBitmap(config.Width, config.Height, 96, 96, PixelFormats.Pbgra32);
|
||||
@@ -145,6 +152,7 @@ public sealed class TextOverlayRenderer
|
||||
bool Italic,
|
||||
bool Underline,
|
||||
TextLayerAlignment Alignment,
|
||||
TextLayerVerticalAlignment VerticalAlignment,
|
||||
int Width,
|
||||
int Height);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user