mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:07:52 +08:00
Add torus font
This commit is contained in:
parent
655b1a9e9d
commit
f1f4f1ffbd
Binary file not shown.
Before Width: | Height: | Size: 4.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 67 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 67 KiB |
@ -175,7 +175,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
X = (flip ? -1 : 1) * 90,
|
||||
Y = -10,
|
||||
Colour = colour,
|
||||
Font = TournamentFont.GetFont(typeface: TournamentTypeface.Aquatico, weight: FontWeight.Regular, size: 20),
|
||||
Font = OsuFont.Torus.With(weight: FontWeight.Regular, size: 20),
|
||||
Origin = anchor,
|
||||
Anchor = anchor,
|
||||
},
|
||||
@ -211,7 +211,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
Origin = Anchor.Centre,
|
||||
Colour = Color4.White,
|
||||
Text = match.NewValue.Round.Value?.Name.Value ?? "Unknown Round",
|
||||
Font = TournamentFont.GetFont(typeface: TournamentTypeface.Aquatico, weight: FontWeight.Regular, size: 18),
|
||||
Font = OsuFont.Torus.With(weight: FontWeight.Regular, size: 18),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -123,8 +123,8 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
public bool Winning
|
||||
{
|
||||
set => DisplayedCountSpriteText.Font = value
|
||||
? TournamentFont.GetFont(typeface: TournamentTypeface.Aquatico, weight: FontWeight.Regular, size: 60)
|
||||
: TournamentFont.GetFont(typeface: TournamentTypeface.Aquatico, weight: FontWeight.Light, size: 40);
|
||||
? OsuFont.Torus.With(weight: FontWeight.Regular, size: 60)
|
||||
: OsuFont.Torus.With(weight: FontWeight.Light, size: 40);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = team?.FullName.Value.ToUpper() ?? "???",
|
||||
Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 40, FontWeight.Light),
|
||||
Font = OsuFont.Torus.With(size: 40, weight: FontWeight.Light),
|
||||
Colour = Color4.Black,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
@ -209,7 +209,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = teamName.ToUpper(),
|
||||
Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 20, FontWeight.Regular),
|
||||
Font = OsuFont.Torus.With(size: 20, weight: FontWeight.Regular),
|
||||
Colour = colour,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
|
@ -126,7 +126,7 @@ namespace osu.Game.Tournament.Screens.TeamWin
|
||||
Origin = Anchor.TopCentre,
|
||||
Colour = col,
|
||||
Text = "WINNER",
|
||||
Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 15, FontWeight.Regular),
|
||||
Font = OsuFont.Torus.With(size: 15, weight: FontWeight.Regular),
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
@ -134,7 +134,7 @@ namespace osu.Game.Tournament.Screens.TeamWin
|
||||
Origin = Anchor.TopCentre,
|
||||
Colour = col,
|
||||
Text = match.Round.Value?.Name.Value ?? "Unknown Round",
|
||||
Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 50, FontWeight.Light),
|
||||
Font = OsuFont.Torus.With(size: 50, weight: FontWeight.Light),
|
||||
Spacing = new Vector2(10, 0),
|
||||
},
|
||||
new OsuSpriteText
|
||||
@ -143,7 +143,7 @@ namespace osu.Game.Tournament.Screens.TeamWin
|
||||
Origin = Anchor.TopCentre,
|
||||
Colour = col,
|
||||
Text = match.Date.Value.ToUniversalTime().ToString("dd MMMM HH:mm UTC"),
|
||||
Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 20, FontWeight.Light),
|
||||
Font = OsuFont.Torus.With(size: 20, weight: FontWeight.Light),
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -203,7 +203,7 @@ namespace osu.Game.Tournament.Screens.TeamWin
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = team?.FullName.Value.ToUpper() ?? "???",
|
||||
Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 40, FontWeight.Light),
|
||||
Font = OsuFont.Torus.With(size: 40, weight: FontWeight.Light),
|
||||
Colour = Color4.Black,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
|
@ -1,75 +0,0 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Tournament
|
||||
{
|
||||
public static class TournamentFont
|
||||
{
|
||||
/// <summary>
|
||||
/// The default font size.
|
||||
/// </summary>
|
||||
public const float DEFAULT_FONT_SIZE = 16;
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="FontUsage"/>.
|
||||
/// </summary>
|
||||
/// <param name="typeface">The font typeface.</param>
|
||||
/// <param name="size">The size of the text in local space. For a value of 16, a single line will have a height of 16px.</param>
|
||||
/// <param name="weight">The font weight.</param>
|
||||
/// <param name="italics">Whether the font is italic.</param>
|
||||
/// <param name="fixedWidth">Whether all characters should be spaced the same distance apart.</param>
|
||||
/// <returns>The <see cref="FontUsage"/>.</returns>
|
||||
public static FontUsage GetFont(TournamentTypeface typeface = TournamentTypeface.Aquatico, float size = DEFAULT_FONT_SIZE, FontWeight weight = FontWeight.Medium, bool italics = false, bool fixedWidth = false)
|
||||
=> new FontUsage(GetFamilyString(typeface), size, GetWeightString(typeface, weight), italics, fixedWidth);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the string representation of a <see cref="TournamentTypeface"/>.
|
||||
/// </summary>
|
||||
/// <param name="typeface">The <see cref="TournamentTypeface"/>.</param>
|
||||
/// <returns>The string representation.</returns>
|
||||
public static string GetFamilyString(TournamentTypeface typeface)
|
||||
{
|
||||
switch (typeface)
|
||||
{
|
||||
case TournamentTypeface.Aquatico:
|
||||
return "Aquatico";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the string representation of a <see cref="FontWeight"/>.
|
||||
/// </summary>
|
||||
/// <param name="typeface">The <see cref="TournamentTypeface"/>.</param>
|
||||
/// <param name="weight">The <see cref="FontWeight"/>.</param>
|
||||
/// <returns>The string representation of <paramref name="weight"/> in the specified <paramref name="typeface"/>.</returns>
|
||||
public static string GetWeightString(TournamentTypeface typeface, FontWeight weight)
|
||||
=> GetWeightString(GetFamilyString(typeface), weight);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the string representation of a <see cref="FontWeight"/>.
|
||||
/// </summary>
|
||||
/// <param name="family">The family string.</param>
|
||||
/// <param name="weight">The <see cref="FontWeight"/>.</param>
|
||||
/// <returns>The string representation of <paramref name="weight"/> in the specified <paramref name="family"/>.</returns>
|
||||
public static string GetWeightString(string family, FontWeight weight)
|
||||
{
|
||||
string weightString = weight.ToString();
|
||||
|
||||
// Only exo has an explicit "regular" weight, other fonts do not
|
||||
if (weight == FontWeight.Regular && family != GetFamilyString(TournamentTypeface.Aquatico))
|
||||
weightString = string.Empty;
|
||||
|
||||
return weightString;
|
||||
}
|
||||
}
|
||||
|
||||
public enum TournamentTypeface
|
||||
{
|
||||
Aquatico
|
||||
}
|
||||
}
|
@ -54,9 +54,6 @@ namespace osu.Game.Tournament
|
||||
{
|
||||
Resources.AddStore(new DllResourceStore(typeof(TournamentGameBase).Assembly));
|
||||
|
||||
AddFont(Resources, @"Resources/Fonts/Aquatico-Regular");
|
||||
AddFont(Resources, @"Resources/Fonts/Aquatico-Light");
|
||||
|
||||
Textures.AddStore(new TextureLoaderStore(new ResourceStore<byte[]>(new StorageBackedResourceStore(storage))));
|
||||
|
||||
this.storage = storage;
|
||||
|
@ -19,6 +19,8 @@ namespace osu.Game.Graphics
|
||||
|
||||
public static FontUsage Numeric => GetFont(Typeface.Venera, weight: FontWeight.Regular);
|
||||
|
||||
public static FontUsage Torus => GetFont(Typeface.Torus, weight: FontWeight.Regular);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="FontUsage"/>.
|
||||
/// </summary>
|
||||
@ -45,6 +47,9 @@ namespace osu.Game.Graphics
|
||||
|
||||
case Typeface.Venera:
|
||||
return "Venera";
|
||||
|
||||
case Typeface.Torus:
|
||||
return "Torus";
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -65,16 +70,7 @@ namespace osu.Game.Graphics
|
||||
/// <param name="family">The family string.</param>
|
||||
/// <param name="weight">The <see cref="FontWeight"/>.</param>
|
||||
/// <returns>The string representation of <paramref name="weight"/> in the specified <paramref name="family"/>.</returns>
|
||||
public static string GetWeightString(string family, FontWeight weight)
|
||||
{
|
||||
string weightString = weight.ToString();
|
||||
|
||||
// Only exo has an explicit "regular" weight, other fonts do not
|
||||
if (family != GetFamilyString(Typeface.Exo) && weight == FontWeight.Regular)
|
||||
weightString = string.Empty;
|
||||
|
||||
return weightString;
|
||||
}
|
||||
public static string GetWeightString(string family, FontWeight weight) => weight.ToString();
|
||||
}
|
||||
|
||||
public static class OsuFontExtensions
|
||||
@ -102,6 +98,7 @@ namespace osu.Game.Graphics
|
||||
{
|
||||
Exo,
|
||||
Venera,
|
||||
Torus
|
||||
}
|
||||
|
||||
public enum FontWeight
|
||||
|
@ -157,6 +157,11 @@ namespace osu.Game
|
||||
AddFont(Resources, @"Fonts/Exo2.0-Black");
|
||||
AddFont(Resources, @"Fonts/Exo2.0-BlackItalic");
|
||||
|
||||
AddFont(Resources, @"Fonts/Torus-SemiBold");
|
||||
AddFont(Resources, @"Fonts/Torus-Bold");
|
||||
AddFont(Resources, @"Fonts/Torus-Regular");
|
||||
AddFont(Resources, @"Fonts/Torus-Light");
|
||||
|
||||
AddFont(Resources, @"Fonts/Venera");
|
||||
AddFont(Resources, @"Fonts/Venera-Light");
|
||||
AddFont(Resources, @"Fonts/Venera-Medium");
|
||||
|
Loading…
Reference in New Issue
Block a user