From 0d3ca8dde197428a2eef2ec2bc4d49d614ccea28 Mon Sep 17 00:00:00 2001 From: Gagah Pangeran Rosfatiputra Date: Thu, 6 May 2021 08:43:38 +0700 Subject: [PATCH] change font weight of table header --- .../Markdown/OsuMarkdownTableCell.cs | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownTableCell.cs b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownTableCell.cs index d8b9145228..fca85e02a8 100644 --- a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownTableCell.cs +++ b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownTableCell.cs @@ -6,6 +6,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers.Markdown; using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; using osu.Game.Overlays; namespace osu.Game.Graphics.Containers.Markdown @@ -30,7 +31,6 @@ namespace osu.Game.Graphics.Containers.Markdown RelativeSizeAxes = Axes.X, }; - // TODO : Change font weight to 700 for heading if (isHeading) { border.Colour = colourProvider.Background3; @@ -48,5 +48,23 @@ namespace osu.Game.Graphics.Containers.Markdown AddInternal(border); } + + public override MarkdownTextFlowContainer CreateTextFlow() => new TableCellTextFlowContainer + { + Weight = isHeading ? FontWeight.Bold : FontWeight.Regular, + Padding = new MarginPadding(10), + }; + + private class TableCellTextFlowContainer : OsuMarkdownTextFlowContainer + { + public FontWeight Weight { get; set; } + + protected override SpriteText CreateSpriteText() + { + var spriteText = base.CreateSpriteText(); + spriteText.Font = spriteText.Font.With(weight: Weight); + return spriteText; + } + } } }