| 12345678910111213141516171819202122232425262728293031323334 |
- using System.Linq;
- using Robust.Client.ResourceManagement;
- using Robust.Client.UserInterface.RichText;
- using Robust.Shared.IoC;
- using Robust.Shared.Prototypes;
- using Robust.Shared.Utility;
- namespace Content.Client.UserInterface.RichText;
- /// <summary>
- /// Sets the font to a monospaced variant
- /// </summary>
- public sealed class MonoTag : IMarkupTag
- {
- [ValidatePrototypeId<FontPrototype>] public const string MonoFont = "Monospace";
- [Dependency] private readonly IResourceCache _resourceCache = default!;
- [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
- public string Name => "mono";
- /// <inheritdoc/>
- public void PushDrawContext(MarkupNode node, MarkupDrawingContext context)
- {
- var font = FontTag.CreateFont(context.Font, node, _resourceCache, _prototypeManager, MonoFont);
- context.Font.Push(font);
- }
- /// <inheritdoc/>
- public void PopDrawContext(MarkupNode node, MarkupDrawingContext context)
- {
- context.Font.Pop();
- }
- }
|