Skip to content

Commit

Permalink
Centralise font size specification for statistic items (and reduce sl…
Browse files Browse the repository at this point in the history
…ightly)
  • Loading branch information
peppy committed Jul 7, 2023
1 parent 4849d77 commit e308969
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private void updateDisplay()

Container axisFlow;

const float axis_font_size = 12;
Padding = new MarginPadding { Horizontal = 5 };

InternalChild = new GridContainer
{
Expand All @@ -147,7 +147,7 @@ private void updateDisplay()
axisFlow = new Container
{
RelativeSizeAxes = Axes.X,
Height = axis_font_size,
Height = StatisticItem.FONT_SIZE,
}
},
},
Expand All @@ -167,7 +167,7 @@ private void updateDisplay()
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = "0",
Font = OsuFont.GetFont(size: axis_font_size, weight: FontWeight.SemiBold)
Font = OsuFont.GetFont(size: StatisticItem.FONT_SIZE, weight: FontWeight.SemiBold)
});

for (int i = 1; i <= axis_points; i++)
Expand All @@ -184,7 +184,7 @@ private void updateDisplay()
X = -position / 2,
Alpha = alpha,
Text = axisValue.ToString("-0"),
Font = OsuFont.GetFont(size: axis_font_size, weight: FontWeight.SemiBold)
Font = OsuFont.GetFont(size: StatisticItem.FONT_SIZE, weight: FontWeight.SemiBold)
});

axisFlow.Add(new OsuSpriteText
Expand All @@ -195,7 +195,7 @@ private void updateDisplay()
X = position / 2,
Alpha = alpha,
Text = axisValue.ToString("+0"),
Font = OsuFont.GetFont(size: axis_font_size, weight: FontWeight.SemiBold)
Font = OsuFont.GetFont(size: StatisticItem.FONT_SIZE, weight: FontWeight.SemiBold)
});
}
}
Expand Down
12 changes: 6 additions & 6 deletions osu.Game/Screens/Ranking/Statistics/PerformanceBreakdownChart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ private void load()
{
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 14),
Font = OsuFont.GetFont(weight: FontWeight.Regular, size: StatisticItem.FONT_SIZE),
Text = "Achieved PP",
Colour = Color4Extensions.FromHex("#66FFCC")
},
achievedPerformance = new OsuSpriteText
{
Origin = Anchor.CentreRight,
Anchor = Anchor.CentreRight,
Font = OsuFont.GetFont(weight: FontWeight.SemiBold, size: 14),
Font = OsuFont.GetFont(weight: FontWeight.SemiBold, size: StatisticItem.FONT_SIZE),
Colour = Color4Extensions.FromHex("#66FFCC")
}
},
Expand All @@ -115,15 +115,15 @@ private void load()
{
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 14),
Font = OsuFont.GetFont(weight: FontWeight.Regular, size: StatisticItem.FONT_SIZE),
Text = "Maximum",
Colour = OsuColour.Gray(0.7f)
},
maximumPerformance = new OsuSpriteText
{
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 14),
Font = OsuFont.GetFont(weight: FontWeight.Regular, size: StatisticItem.FONT_SIZE),
Colour = OsuColour.Gray(0.7f)
}
}
Expand Down Expand Up @@ -208,7 +208,7 @@ private Drawable[] createAttributeRow(PerformanceDisplayAttribute attribute, Per
{
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 14),
Font = OsuFont.GetFont(weight: FontWeight.Regular, size: StatisticItem.FONT_SIZE),
Text = attribute.DisplayName,
Colour = Colour4.White
},
Expand All @@ -233,7 +233,7 @@ private Drawable[] createAttributeRow(PerformanceDisplayAttribute attribute, Per
{
Origin = Anchor.CentreRight,
Anchor = Anchor.CentreRight,
Font = OsuFont.GetFont(weight: FontWeight.SemiBold, size: 14),
Font = OsuFont.GetFont(weight: FontWeight.SemiBold, size: StatisticItem.FONT_SIZE),
Text = percentage.ToLocalisableString("0%"),
Colour = Colour4.White
}
Expand Down
4 changes: 2 additions & 2 deletions osu.Game/Screens/Ranking/Statistics/SimpleStatisticItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ protected SimpleStatisticItem(string name)
Text = Name,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Font = OsuFont.GetFont(size: 14)
Font = OsuFont.GetFont(size: StatisticItem.FONT_SIZE)
},
value = new OsuSpriteText
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold)
Font = OsuFont.GetFont(size: StatisticItem.FONT_SIZE, weight: FontWeight.Bold)
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ private partial class Spacer : CompositeDrawable
public Spacer()
{
RelativeSizeAxes = Axes.Both;
Padding = new MarginPadding { Vertical = 4 };

InternalChild = new CircularContainer
{
Expand Down
5 changes: 5 additions & 0 deletions osu.Game/Screens/Ranking/Statistics/StatisticItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ namespace osu.Game.Screens.Ranking.Statistics
/// </summary>
public class StatisticItem
{
/// <summary>
/// The recommended font size to use in statistic items to make sure they match others.
/// </summary>
public const float FONT_SIZE = 12;

/// <summary>
/// The name of this item.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private static Drawable createHeader(StatisticItem item)
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Text = item.Name,
Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold),
Font = OsuFont.GetFont(size: StatisticItem.FONT_SIZE, weight: FontWeight.SemiBold),
}
}
};
Expand Down
4 changes: 2 additions & 2 deletions osu.Game/Screens/Ranking/Statistics/User/RankingChangeRow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private void load()
new OsuSpriteText
{
Text = Label,
Font = OsuFont.Default.With(size: 14)
Font = OsuFont.Default.With(size: StatisticItem.FONT_SIZE)
},
new FillFlowContainer
{
Expand Down Expand Up @@ -90,7 +90,7 @@ private void load()
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Font = OsuFont.Default.With(size: 14, weight: FontWeight.Bold)
Font = OsuFont.Default.With(size: StatisticItem.FONT_SIZE, weight: FontWeight.Bold)
},
}
},
Expand Down

0 comments on commit e308969

Please sign in to comment.