Everything: Rich text redux (#5625)
* lord save me * UI/ChatBox: Use the new `defStyle` param for `RenderMarkup` The previous iteration didn't work because `AddMessage` can't inherit its color from the PushColor (since we're not doing actual tag stacks anymore). * rebase touchup
This commit is contained in:
@@ -4,6 +4,7 @@ using Robust.Client.ResourceManagement;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Content.Client.Stylesheets
|
||||
@@ -39,28 +40,57 @@ namespace Content.Client.Stylesheets
|
||||
|
||||
protected StyleBoxTexture BaseAngleRect { get; }
|
||||
|
||||
protected IFontLibrary FontLib { get; }
|
||||
|
||||
protected StyleBase(IResourceCache resCache)
|
||||
{
|
||||
var notoSans12 = resCache.GetFont
|
||||
(
|
||||
new []
|
||||
{
|
||||
"/Fonts/NotoSans/NotoSans-Regular.ttf",
|
||||
"/Fonts/NotoSans/NotoSansSymbols-Regular.ttf",
|
||||
"/Fonts/NotoSans/NotoSansSymbols2-Regular.ttf"
|
||||
},
|
||||
12
|
||||
);
|
||||
var notoSans12Italic = resCache.GetFont
|
||||
(
|
||||
new []
|
||||
{
|
||||
"/Fonts/NotoSans/NotoSans-Italic.ttf",
|
||||
"/Fonts/NotoSans/NotoSansSymbols-Regular.ttf",
|
||||
"/Fonts/NotoSans/NotoSansSymbols2-Regular.ttf"
|
||||
},
|
||||
12
|
||||
FontLib = new FontLibrary(
|
||||
new FontClass(Id: "notosans", Style: (FontStyle) default, Size: (FontSize) 12)
|
||||
) as IFontLibrary;
|
||||
|
||||
FontLib.AddFont("notosans",
|
||||
new FontVariant
|
||||
(
|
||||
FontStyle.Normal,
|
||||
new []
|
||||
{
|
||||
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"),
|
||||
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSansSymbols-Regular.ttf"),
|
||||
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSansSymbols2-Regular.ttf")
|
||||
}
|
||||
),
|
||||
new FontVariant
|
||||
(
|
||||
FontStyle.Italic,
|
||||
new []
|
||||
{
|
||||
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Italic.ttf"),
|
||||
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSansSymbols-Regular.ttf"),
|
||||
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSansSymbols2-Regular.ttf")
|
||||
}
|
||||
),
|
||||
new FontVariant
|
||||
(
|
||||
FontStyle.Bold,
|
||||
new []
|
||||
{
|
||||
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Bold.ttf"),
|
||||
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSansSymbols-Bold.ttf"),
|
||||
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSansSymbols2-Regular.ttf")
|
||||
}
|
||||
),
|
||||
new FontVariant
|
||||
(
|
||||
FontStyle.Bold | FontStyle.Italic,
|
||||
new []
|
||||
{
|
||||
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-BoldItalic.ttf"),
|
||||
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSansSymbols-Bold.ttf"),
|
||||
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSansSymbols2-Regular.ttf")
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
var textureCloseButton = resCache.GetTexture("/Textures/Interface/Nano/cross.svg.png");
|
||||
|
||||
// Button styles.
|
||||
@@ -151,7 +181,8 @@ namespace Content.Client.Stylesheets
|
||||
new SelectorElement(null, null, null, null),
|
||||
new[]
|
||||
{
|
||||
new StyleProperty("font", notoSans12),
|
||||
new StyleProperty("font-library", FontLib),
|
||||
new StyleProperty("font", new FontClass("notosans", (FontStyle) default, (FontSize) 12)),
|
||||
}),
|
||||
|
||||
// Default font.
|
||||
@@ -159,7 +190,7 @@ namespace Content.Client.Stylesheets
|
||||
new SelectorElement(null, new[] {StyleClassItalic}, null, null),
|
||||
new[]
|
||||
{
|
||||
new StyleProperty("font", notoSans12Italic),
|
||||
new StyleProperty("font", new FontClass("notosans", FontStyle.Italic, (FontSize) 12)),
|
||||
}),
|
||||
|
||||
// Window close button base texture.
|
||||
|
||||
Reference in New Issue
Block a user