Stylesheets: Take advantage of Font stacking (#5111)

Depends on https://github.com/space-wizards/RobustToolbox/pull/2182
 - Adds Noto Sans Symbols and its sequel, Noto Sans Symbols 2: Revenge
   of the Unicode.
 - Uses a stack of Noto Sans, Symbols, and Symbols 2 in all places where
   Noto Sans/Noto Sans Display are used.

If you _really_ wanted to, you could use this to add Noto Emoji too.

In considering this, please remember that not everything that _can_ be
done, _should_ be done.
This commit is contained in:
E F R
2021-11-04 03:32:03 +00:00
committed by GitHub
parent 6739bbc85b
commit 1b5b32c8a6
7 changed files with 92 additions and 17 deletions

View File

@@ -27,5 +27,23 @@ namespace Content.Client.Resources
{
return cache.GetFont(new ResourcePath(path), size);
}
public static Font GetFont(this IResourceCache cache, ResourcePath[] path, int size)
{
var fs = new Font[path.Length];
for (var i = 0; i < path.Length; i++)
fs[i] = new VectorFont(cache.GetResource<FontResource>(path[i]), size);
return new StackedFont(fs);
}
public static Font GetFont(this IResourceCache cache, string[] path, int size)
{
var rp = new ResourcePath[path.Length];
for (var i = 0; i < path.Length; i++)
rp[i] = new ResourcePath(path[i]);
return cache.GetFont(rp, size);
}
}
}