I am using OxyPlot.SkiaSharp in a .NET 8 project on AWS Lambda.
The PDF export fails because there are no fonts available at runtime. This happens when using the SkiaSharp.NativeAssets.Linux.NoDependencies package, which is made for Lambda or headless Linux environments.
In .NET 6, the default font is available and everything works fine. But in .NET 8, no font is available anymore. As a result, the PdfExporter.Export() method crashes if UseTextShaping is set to true (which is required to show any text).
The problem is that:
OxyPlot.PlotModel.DefaultFont only accepts a font family name (string)
- But we cannot load a custom font into
SKFontManager.Default
- So we cannot provide a valid font to OxyPlot
There is already an open issue in SkiaSharp that describes this problem:
mono/SkiaSharp#3271
Maybe OxyPlot could let us inject a SKTypeface directly, or allow another way to provide a custom font ?
Thank you for your work and help!