Thanks to visit codestin.com
Credit goes to github.com

Skip to content

No fonts in .NET 8 with OxyPlot.SkiaSharp and SkiaSharp.NativeAssets.Linux.NoDependencies on AWS Lambda #2145

@Rodriguevb

Description

@Rodriguevb

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions