Skip to content

Finding glyph control point information in recent versions. #313

Answered by Mavichist
Mavichist asked this question in Q&A
Discussion options

You must be logged in to vote

The public-facing mechanism for doing this is apparently part of SixLabors.ImageSharp.Drawing (via the TextBuilder class) rather than directly through SixLabors.Fonts.

if (SystemFonts.TryGet(fontFamily, out var family))
{
    var font = family.CreateFont(size);
    
    foreach (var character in characters)
    {
        var paths = TextBuilder.GenerateGlyphs(character.ToString(), new TextOptions(font));
        foreach (var path in paths)
        {
            var simplePaths = path.Flatten().ToArray();
            foreach (var simplePath in simplePaths)
            {
                foreach (var point in simplePath.Points.ToArray())
                {
                    Console.WriteLine(

Replies: 3 comments 9 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
7 replies
@Mavichist
Comment options

@JimBobSquarePants
Comment options

@JimBobSquarePants
Comment options

@Mavichist
Comment options

@JimBobSquarePants
Comment options

Comment options

You must be logged in to vote
2 replies
@tocsoft
Comment options

@Mavichist
Comment options

Answer selected by Mavichist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants