Add medium -> regular fallback for torus

This commit is contained in:
Dean Herbert 2020-03-13 13:33:55 +09:00
parent 288470c313
commit c45f9cafd4
1 changed files with 7 additions and 1 deletions

View File

@ -59,7 +59,13 @@ public static string GetFamilyString(Typeface typeface)
/// <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"/>.