Skip to content

PdfSharpCore won't use icon font #262

Closed
@Steve-OH

Description

@Steve-OH

I'm trying to use an icon font in PdfSharpCore, and it refuses to let me. Using this sample code:

using PdfSharpCore.Drawing;
using System.Drawing;

IEnumerable<string> fontFamilies = new List<string>
{
    "Material Icons",
    "GLYPHICONS Basic Set",
    "la-solid-900",
    "Font Awesome 6 Free Solid",
};

foreach (var family in fontFamilies)
{
    var font = new Font(family, 8);
    Console.WriteLine($"{font.FontFamily.Name} : {font.Name}");
}

foreach (var family in fontFamilies)
{
    var font = new XFont(family, 8);
    Console.WriteLine($"{font.FontFamily.Name} : {font.Name}");
}

The output is:

Material Icons : Material Icons
GLYPHICONS Basic Set : GLYPHICONS Basic Set
la-solid-900 : la-solid-900
Font Awesome 6 Free Solid : Font Awesome 6 Free Solid
Agency FB : Agency FB
Agency FB : Agency FB
Agency FB : Agency FB
Agency FB : Agency FB

I believe it's picking Agency FB simply because it's the first font in alphabetical order that it can find. Needless to say, Agency FB doesn't contain any of the glyphs that I'd like to use.

The fonts I'm trying to use:

Material Icons: https://github.com/google/material-design-icons/blob/master/font/MaterialIcons-Regular.ttf
Glyphicons: [commercial font; not available for download]
Line Awesome: https://github.com/icons8/line-awesome/blob/master/dist/line-awesome/fonts/la-solid-900.ttf
Font Awesome: https://use.fontawesome.com/releases/v6.1.1/fontawesome-free-6.1.1-desktop.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions