diff --git a/src/client/spark/core/FontsAndColors/FontParams.cs b/src/client/spark/core/FontsAndColors/FontParams.cs
deleted file mode 100644
index f7fd132fb..000000000
--- a/src/client/spark/core/FontsAndColors/FontParams.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-using System;
-
-namespace mbts.ui.utility.text {
- ///
- /// Contains a font family, size, and foreground (uint).
- /// NOTE: does not account for font weight, or typeface.
- ///
- struct FontParams : IEquatable {
- public readonly FontFamily font_family;
- public readonly double font_size;
- public readonly uint foreground;
-
- public FontParams(FontFamily font_family, double font_size, uint foreground) {
- this.font_family = font_family;
- this.font_size = font_size;
- this.foreground = foreground;
- }
-
- public bool Equals(FontParams other) =>
- other.font_family == font_family &&
- other.font_size == font_size &&
- other.foreground == foreground;
-
- public override bool Equals(object obj) =>
- obj is FontParams fsk && Equals(fsk);
-
- public override int GetHashCode() =>
- font_family.GetHashCode() ^
- font_size.GetHashCode() ^
- foreground.GetHashCode();
-
- public static bool operator ==(FontParams x, FontParams y) =>
- x.Equals(y);
-
- public static bool operator !=(FontParams x, FontParams y) =>
- !x.Equals(y);
- }
-
- struct FontParamsKey where T : struct, IEquatable {
- public readonly T key;
- public readonly FontParams font_params;
-
- public FontParamsKey(T key, FontParams font_params) {
- this.key = key;
- this.font_params = font_params;
- }
-
- public bool Equals(FontParamsKey other) =>
- other.key.Equals(key) &&
- other.font_params == font_params;
-
- public override bool Equals(object obj) =>
- obj is FontParamsKey fpk && Equals(fpk);
-
- public override int GetHashCode() =>
- key.GetHashCode() ^
- font_params.GetHashCode();
-
- public static bool operator ==(FontParamsKey x, FontParamsKey y) =>
- x.Equals(y);
-
- public static bool operator !=(FontParamsKey x, FontParamsKey y) =>
- !x.Equals(y);
- }
-}
\ No newline at end of file
diff --git a/src/client/spark/view/Utility/TextUtils.cs b/src/client/spark/view/Utility/TextUtils.cs
index 808fe462a..1fcd420bd 100644
--- a/src/client/spark/view/Utility/TextUtils.cs
+++ b/src/client/spark/view/Utility/TextUtils.cs
@@ -1,5 +1,4 @@
using bts.utils;
-using mbts.spark.utilities;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
@@ -10,15 +9,10 @@ using System.Windows.Documents;
using System.Windows.Media;
namespace mbts.ui.utility.text {
- public enum FontFamily {
- Standard,
- Unknown
- }
-
static class TextUtils {
public const string WPFNewLine = "
";
public static readonly string StandardFontFamilyName;
- public static readonly System.Windows.Media.FontFamily StandardFontFamily;
+ public static readonly FontFamily StandardFontFamily;
public static readonly Typeface StandardTypeface;
public static readonly GlyphTypeface StandardGlyphTypeface;
public static readonly GlyphContext StandardGlyphContext;
@@ -26,9 +20,9 @@ namespace mbts.ui.utility.text {
static TextUtils() {
// try to guarentee a standard font
var preferred_fonts = new[] {
- new System.Windows.Media.FontFamily("Segoe UI"),
+ new FontFamily("Segoe UI"),
SystemFonts.MessageFontFamily,
- (System.Windows.Media.FontFamily)TextElement.FontFamilyProperty.DefaultMetadata.DefaultValue
+ (FontFamily)TextElement.FontFamilyProperty.DefaultMetadata.DefaultValue
};
foreach (var f in preferred_fonts) {
StandardTypeface = new Typeface(f, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);
@@ -64,7 +58,7 @@ namespace mbts.ui.utility.text {
public static Typeface with(this Typeface typeface, FontWeight font_weight) =>
new Typeface(typeface.FontFamily, typeface.Style, font_weight, typeface.Stretch);
- public static Typeface with(this Typeface typeface, System.Windows.Media.FontFamily font_family) =>
+ public static Typeface with(this Typeface typeface, FontFamily font_family) =>
new Typeface(font_family, typeface.Style, typeface.Weight, typeface.Stretch);
///
@@ -100,14 +94,7 @@ namespace mbts.ui.utility.text {
}
}
- public static FontFamily ParseFontFamily(string family_name) {
- // TODO
- switch (family_name) {
- default: return FontFamily.Standard;
- }
- }
-
- public static IEnumerable available_weights(this System.Windows.Media.FontFamily family) =>
+ public static IEnumerable available_weights(this FontFamily family) =>
family.FamilyTypefaces
.Select(ft => ft.Weight)
.Distinct()
@@ -119,13 +106,13 @@ namespace mbts.ui.utility.text {
.Select(p => (FontWeight)p.GetValue(null)).Distinct();
- public static string name(this System.Windows.Media.FontFamily font_family) =>
+ public static string name(this FontFamily font_family) =>
font_family.FamilyNames.Values.FirstOrDefault() ?? string.Empty;
- public static string display_name(this System.Windows.Media.FontFamily family, double size) =>
+ public static string display_name(this FontFamily family, double size) =>
$"{family}, {size} pt";
- public static string display_name(this System.Windows.Media.FontFamily family, FontWeight weight, double size) =>
+ public static string display_name(this FontFamily family, FontWeight weight, double size) =>
$"{family} {weight}, {size} pt";
public static bool is_space_type(this char c) => CharSets.spaces.Contains(c);