change font weight of table header

This commit is contained in:
Gagah Pangeran Rosfatiputra 2021-05-06 08:43:38 +07:00
parent 550e6c0fbb
commit 0d3ca8dde1
No known key found for this signature in database
GPG Key ID: 25F6F17FD29031E2

View File

@ -6,6 +6,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers.Markdown; using osu.Framework.Graphics.Containers.Markdown;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Game.Overlays; using osu.Game.Overlays;
namespace osu.Game.Graphics.Containers.Markdown namespace osu.Game.Graphics.Containers.Markdown
@ -30,7 +31,6 @@ namespace osu.Game.Graphics.Containers.Markdown
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
}; };
// TODO : Change font weight to 700 for heading
if (isHeading) if (isHeading)
{ {
border.Colour = colourProvider.Background3; border.Colour = colourProvider.Background3;
@ -48,5 +48,23 @@ namespace osu.Game.Graphics.Containers.Markdown
AddInternal(border); 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;
}
}
} }
} }