-
Notifications
You must be signed in to change notification settings - Fork 981
Closed
Labels
Description
How can I use my own fonts in ScottPlot, which are located in application resources? For example, there is the PDFsharp library. It has a font substitution mechanism that allows you to get a font in any available way. It looks something like this (very simplified):
using Avalonia.Platform;
using PdfSharp.Fonts;
namespace TestApp.Main;
internal sealed partial class PdfDocument {
private sealed class CustomFontResolver : IFontResolver {
public byte[]? GetFont(string faceName) {
using (var memory = new MemoryStream()) {
using (var asset = AssetLoader.Open(new Uri(faceName))) {
asset.CopyTo(memory);
memory.Position = 0;
return memory.ToArray();
}
}
}
public FontResolverInfo? ResolveTypeface(string familyName, bool isBold, bool isItalic) =>
new($"avares://TestApp.Fonts/Assets/NotoSans-{(isBold ? "Bold" : "Regular")}.ttf");
}
}Is there something similar for ScottPlot?
ScottPlot Version: 5.0.25
Reactions are currently unavailable