Merge pull request #8259 from peppy/torus

Switch game to use new font (Torus)
This commit is contained in:
Dean Herbert 2020-03-15 03:21:22 +09:00 committed by GitHub
commit b9cdb317c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 42 additions and 46 deletions

View File

@ -51,7 +51,7 @@
<Reference Include="Java.Interop" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.304.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.315.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.312.0" />
</ItemGroup>
</Project>

View File

@ -12,7 +12,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.Chat;
using osu.Game.Overlays;
using osu.Game.Overlays.Chat;
@ -78,7 +77,7 @@ namespace osu.Game.Tests.Visual.Online
AddAssert($"msg #{index} has {linkAmount} link(s)", () => newLine.Message.Links.Count == linkAmount);
AddAssert($"msg #{index} has the right action", hasExpectedActions);
AddAssert($"msg #{index} is " + (isAction ? "italic" : "not italic"), () => newLine.ContentFlow.Any() && isAction == isItalic());
//AddAssert($"msg #{index} is " + (isAction ? "italic" : "not italic"), () => newLine.ContentFlow.Any() && isAction == isItalic());
AddAssert($"msg #{index} shows {linkAmount} link(s)", isShowingLinks);
bool hasExpectedActions()
@ -97,7 +96,7 @@ namespace osu.Game.Tests.Visual.Online
return true;
}
bool isItalic() => newLine.ContentFlow.Where(d => d is OsuSpriteText).Cast<OsuSpriteText>().All(sprite => sprite.Font.Italics);
//bool isItalic() => newLine.ContentFlow.Where(d => d is OsuSpriteText).Cast<OsuSpriteText>().All(sprite => sprite.Font.Italics);
bool isShowingLinks()
{

View File

@ -30,8 +30,15 @@ namespace osu.Game.Graphics
/// <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(Typeface typeface = Typeface.Exo, 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);
public static FontUsage GetFont(Typeface typeface = Typeface.Torus, float size = DEFAULT_FONT_SIZE, FontWeight weight = FontWeight.Medium, bool italics = false, bool fixedWidth = false)
=> new FontUsage(GetFamilyString(typeface), size, GetWeightString(typeface, weight), getItalics(italics), fixedWidth);
private static bool getItalics(in bool italicsRequested)
{
// right now none of our fonts support italics.
// should add exceptions to this rule if they come up.
return false;
}
/// <summary>
/// Retrieves the string representation of a <see cref="Typeface"/>.
@ -42,9 +49,6 @@ namespace osu.Game.Graphics
{
switch (typeface)
{
case Typeface.Exo:
return "Exo2.0";
case Typeface.Venera:
return "Venera";
@ -62,7 +66,13 @@ namespace osu.Game.Graphics
/// <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(Typeface typeface, FontWeight weight)
=> GetWeightString(GetFamilyString(typeface), weight);
{
if (typeface == Typeface.Torus && weight == FontWeight.Medium)
// torus doesn't have a medium; fallback to regular.
weight = FontWeight.Regular;
return GetWeightString(GetFamilyString(typeface), weight);
}
/// <summary>
/// Retrieves the string representation of a <see cref="FontWeight"/>.
@ -96,7 +106,6 @@ namespace osu.Game.Graphics
public enum Typeface
{
Exo,
Venera,
Torus
}

View File

@ -173,7 +173,7 @@ namespace osu.Game.Graphics.UserInterface
new HoverClickSounds()
};
Active.BindValueChanged(active => Text.Font = Text.Font.With(Typeface.Exo, weight: active.NewValue ? FontWeight.Bold : FontWeight.Medium), true);
Active.BindValueChanged(active => Text.Font = Text.Font.With(Typeface.Torus, weight: active.NewValue ? FontWeight.Bold : FontWeight.Medium), true);
}
protected override void OnActivated() => fadeActive();

View File

@ -78,7 +78,7 @@ namespace osu.Game.Graphics.UserInterface
new HoverClickSounds()
};
Active.BindValueChanged(active => Text.Font = Text.Font.With(Typeface.Exo, weight: active.NewValue ? FontWeight.Bold : FontWeight.Medium), true);
Active.BindValueChanged(active => Text.Font = Text.Font.With(Typeface.Torus, weight: active.NewValue ? FontWeight.Bold : FontWeight.Medium), true);
}
protected virtual string CreateText() => (Value as Enum)?.GetDescription() ?? Value.ToString();

View File

@ -138,30 +138,17 @@ namespace osu.Game
dependencies.Cache(LocalConfig);
AddFont(Resources, @"Fonts/osuFont");
AddFont(Resources, @"Fonts/Exo2.0-Medium");
AddFont(Resources, @"Fonts/Exo2.0-MediumItalic");
AddFont(Resources, @"Fonts/Torus-Regular");
AddFont(Resources, @"Fonts/Torus-Light");
AddFont(Resources, @"Fonts/Torus-SemiBold");
AddFont(Resources, @"Fonts/Torus-Bold");
AddFont(Resources, @"Fonts/Noto-Basic");
AddFont(Resources, @"Fonts/Noto-Hangul");
AddFont(Resources, @"Fonts/Noto-CJK-Basic");
AddFont(Resources, @"Fonts/Noto-CJK-Compatibility");
AddFont(Resources, @"Fonts/Exo2.0-Regular");
AddFont(Resources, @"Fonts/Exo2.0-RegularItalic");
AddFont(Resources, @"Fonts/Exo2.0-SemiBold");
AddFont(Resources, @"Fonts/Exo2.0-SemiBoldItalic");
AddFont(Resources, @"Fonts/Exo2.0-Bold");
AddFont(Resources, @"Fonts/Exo2.0-BoldItalic");
AddFont(Resources, @"Fonts/Exo2.0-Light");
AddFont(Resources, @"Fonts/Exo2.0-LightItalic");
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-Light");
AddFont(Resources, @"Fonts/Venera-Bold");
AddFont(Resources, @"Fonts/Venera-Black");

View File

@ -132,7 +132,7 @@ namespace osu.Game.Overlays.AccountCreation
usernameDescription.AddText("This will be your public presence. No profanity, no impersonation. Avoid exposing your own personal details, too!");
emailAddressDescription.AddText("Will be used for notifications, account verification and in the case you forget your password. No spam, ever.");
emailAddressDescription.AddText(" Make sure to get it right!", cp => cp.Font = cp.Font.With(Typeface.Exo, weight: FontWeight.Bold));
emailAddressDescription.AddText(" Make sure to get it right!", cp => cp.Font = cp.Font.With(Typeface.Torus, weight: FontWeight.Bold));
passwordDescription.AddText("At least ");
characterCheckText = passwordDescription.AddText("8 characters long");

View File

@ -93,6 +93,7 @@ namespace osu.Game.Overlays.Changelog
Direction = FillDirection.Full,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
TextAnchor = Anchor.BottomLeft,
}
}
};
@ -125,7 +126,7 @@ namespace osu.Game.Overlays.Changelog
title.AddText("by ", t =>
{
t.Font = fontMedium.With(italics: true);
t.Font = fontMedium;
t.Colour = entryColour;
t.Padding = new MarginPadding { Left = 10 };
});
@ -138,7 +139,7 @@ namespace osu.Game.Overlays.Changelog
Id = entry.GithubUser.UserId.Value
}, t =>
{
t.Font = fontMedium.With(italics: true);
t.Font = fontMedium;
t.Colour = entryColour;
});
}
@ -146,7 +147,7 @@ namespace osu.Game.Overlays.Changelog
{
title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, t =>
{
t.Font = fontMedium.With(italics: true);
t.Font = fontMedium;
t.Colour = entryColour;
});
}
@ -154,7 +155,7 @@ namespace osu.Game.Overlays.Changelog
{
title.AddText(entry.GithubUser.DisplayName, t =>
{
t.Font = fontMedium.With(italics: true);
t.Font = fontMedium;
t.Colour = entryColour;
});
}

View File

@ -75,7 +75,7 @@ namespace osu.Game.Overlays.News
Left = 25,
Bottom = 50,
},
Font = OsuFont.GetFont(Typeface.Exo, 24, FontWeight.Bold),
Font = OsuFont.GetFont(Typeface.Torus, 24, FontWeight.Bold),
Text = info.Title,
},
new OsuSpriteText
@ -87,7 +87,7 @@ namespace osu.Game.Overlays.News
Left = 25,
Bottom = 30,
},
Font = OsuFont.GetFont(Typeface.Exo, 16, FontWeight.Bold),
Font = OsuFont.GetFont(Typeface.Torus, 16, FontWeight.Bold),
Text = "by " + info.Author
}
};
@ -148,7 +148,7 @@ namespace osu.Game.Overlays.News
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.GetFont(Typeface.Exo, 12, FontWeight.Black, false, false),
Font = OsuFont.GetFont(Typeface.Torus, 12, FontWeight.Black, false, false),
Text = date.ToString("d MMM yyy").ToUpper(),
Margin = new MarginPadding
{

View File

@ -90,14 +90,14 @@ namespace osu.Game.Screens.Menu
}
};
textFlow.AddText("This project is an ongoing ", t => t.Font = t.Font.With(Typeface.Exo, 30, FontWeight.Light));
textFlow.AddText("work in progress", t => t.Font = t.Font.With(Typeface.Exo, 30, FontWeight.SemiBold));
textFlow.AddText("This project is an ongoing ", t => t.Font = t.Font.With(Typeface.Torus, 30, FontWeight.Light));
textFlow.AddText("work in progress", t => t.Font = t.Font.With(Typeface.Torus, 30, FontWeight.SemiBold));
textFlow.NewParagraph();
static void format(SpriteText t) => t.Font = OsuFont.GetFont(size: 15, weight: FontWeight.SemiBold);
textFlow.AddParagraph(getRandomTip(), t => t.Font = t.Font.With(Typeface.Exo, 20, FontWeight.SemiBold));
textFlow.AddParagraph(getRandomTip(), t => t.Font = t.Font.With(Typeface.Torus, 20, FontWeight.SemiBold));
textFlow.NewParagraph();
textFlow.NewParagraph();

View File

@ -77,7 +77,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
if (host.NewValue != null)
{
hostText.AddText("hosted by ");
hostText.AddUserLink(host.NewValue, s => s.Font = s.Font.With(Typeface.Exo, weight: FontWeight.Bold, italics: true));
hostText.AddUserLink(host.NewValue, s => s.Font = s.Font.With(Typeface.Torus, weight: FontWeight.Bold, italics: true));
flagContainer.Child = new UpdateableFlag(host.NewValue.Country) { RelativeSizeAxes = Axes.Both };
}

View File

@ -91,7 +91,7 @@ namespace osu.Game.Screens.Multi.Ranking.Pages
rankText.AddText($"#{index + 1} ", s =>
{
s.Font = s.Font.With(Typeface.Exo, weight: FontWeight.Bold);
s.Font = s.Font.With(Typeface.Torus, weight: FontWeight.Bold);
s.Colour = colours.YellowDark;
});

View File

@ -22,7 +22,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.304.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.315.0" />
<PackageReference Include="ppy.osu.Framework" Version="2020.312.0" />
<PackageReference Include="Sentry" Version="2.1.0" />
<PackageReference Include="SharpCompress" Version="0.24.0" />

View File

@ -70,7 +70,7 @@
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.304.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.315.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.312.0" />
</ItemGroup>
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->