From be9be5dee258f08cd53112e8e01d3429293f5a4f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 20 Feb 2019 21:04:18 +0900 Subject: [PATCH] Add some xmldocs --- osu.Game/Graphics/OsuFont.cs | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/osu.Game/Graphics/OsuFont.cs b/osu.Game/Graphics/OsuFont.cs index 54c6ca48a0..82c6f9e572 100644 --- a/osu.Game/Graphics/OsuFont.cs +++ b/osu.Game/Graphics/OsuFont.cs @@ -7,13 +7,33 @@ namespace osu.Game.Graphics { public struct OsuFont { + /// + /// The default font size. + /// public const float DEFAULT_FONT_SIZE = 16; + /// + /// The default font. + /// public static FontUsage Default => GetFont(); + /// + /// Retrieves a . + /// + /// The font typeface. + /// The size of the text in local space. For a value of 16, a single line will have a height of 16px. + /// The font weight. + /// Whether the font is italic. + /// Whether all characters should be spaced the same distance apart. + /// The . 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); + /// + /// Retrieves the string representation of a . + /// + /// The . + /// The string representation. public static string GetFamilyString(Typeface typeface) { switch (typeface) @@ -29,9 +49,21 @@ namespace osu.Game.Graphics return null; } + /// + /// Retrieves the string representation of a . + /// + /// The . + /// The . + /// The string representation of in the specified . public static string GetWeightString(Typeface typeface, FontWeight weight) => GetWeightString(GetFamilyString(typeface), weight); + /// + /// Retrieves the string representation of a . + /// + /// The . + /// The . + /// The string representation of in the specified . public static string GetWeightString(string family, FontWeight weight) { string weightString = weight.ToString(); @@ -46,6 +78,15 @@ namespace osu.Game.Graphics public static class OsuFontExtensions { + /// + /// Creates a new by applying adjustments to this . + /// + /// The font typeface. If null, the value is copied from this . + /// The text size. If null, the value is copied from this . + /// The font weight. If null, the value is copied from this . + /// Whether the font is italic. If null, the value is copied from this . + /// Whether all characters should be spaced apart the same distance. If null, the value is copied from this . + /// The resulting . public static FontUsage With(this FontUsage usage, Typeface? typeface = null, float? size = null, FontWeight? weight = null, bool? italics = null, bool? fixedWidth = null) { string familyString = typeface != null ? OsuFont.GetFamilyString(typeface.Value) : usage.Family;