Skip to content

Feature Request: Add a .FromTtf overload that accepts a Stream #19

@Apostolique

Description

@Apostolique

Currently, I'm loading ttf files using this code:

using MemoryStream ms = new MemoryStream();
TitleContainer.OpenStream($"{Content.RootDirectory}/Fonts/FontFile.ttf").CopyTo(ms);
byte[] fontBytes = ms.ToArray();
DynamicSpriteFont font = DynamicSpriteFont.FromTtf(fontBytes, 30);

It would be nice if the MemoryStream part could be done from DynamicSpriteFont's side. Then I could do:

Stream fontStream = TitleContainer.OpenStream($"{Content.RootDirectory}/Fonts/FontFile.ttf");
DynamicSpriteFont font = DynamicSpriteFont.FromTtf(fontStream, 30);

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