[Feature-WANT]Supported FontFamilyCache for using embedded font · Issue #2021 · oxyplot/oxyplot · GitHub
Skip to content

[Feature-WANT]Supported FontFamilyCache for using embedded font #2021

Closed as not planned

Description

@emako

I want to use the embedded font for OxyPlot.Wpf, but the code ff = new FontFamily(familyName); provided in class CanvasRenderContext can only use public FontFamily(string familyName) instead of public FontFamily(Uri baseUri, string familyName).

So the new feature wana to be provided and
Here is some code about my solution:

// FontFamilyCache.cs
public static class FontFamilyCache
{
    public static void AddFontFamilyCache(string familyName, FontFamily fontFamily)
    {
        CanvasRenderContext.AddFontFamilyCache(familyName, fontFamily);
    }
}
// CanvasRenderContext.cs
// Make fontFamilyCache static and add method named AddFontFamilyCache
        public static void AddFontFamilyCache(string familyName, FontFamily fontFamily)
        {
            if (!fontFamilyCache.TryGetValue(familyName, out _))
            {
                fontFamilyCache.Add(familyName, fontFamily);
            }
        }

Activity

  1. VisualMelon commented on Aug 16, 2023

    @VisualMelon
    Contributor

    This seems a reasonable idea to me, but I'm not sure where we'd include it. Linking #1556 because there may be API considerations (probably not, as this will need to be per platform)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions