Skip to content

Choosing installed custom fonts at runtime #169

Answered by tocsoft
Toafeek asked this question in Q&A
Discussion options

You must be logged in to vote

When you call FontCollection.Install(stream) you will have a FontFamily returned. Using the FontFamily you can new up a Font instance from it.

var fonts = new FontCollection();
var fontFamily = fonts.Install(stream);
var pointSize = 36;
var font = new Font(fontFamily, pointSize);

As long as you only have a single font installed into the specific FontCollection you will get whatever variant you installed no matter the FontStyle specified. The way we currently use FontStyle is more of a hint than a specific requirement.

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@Toafeek
Comment options

@tocsoft
Comment options

@Toafeek
Comment options

@Toafeek
Comment options

Answer selected by JimBobSquarePants
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants