Skip to content

Font: add support for weight, slant, and width#4873

Closed
Christoph-Wagner wants to merge 5 commits intoScottPlot:mainfrom
Christoph-Wagner:font-selection
Closed

Font: add support for weight, slant, and width#4873
Christoph-Wagner wants to merge 5 commits intoScottPlot:mainfrom
Christoph-Wagner:font-selection

Conversation

@Christoph-Wagner
Copy link
Contributor

Instead of just specifying if a font should be bold and/or italic, this now allows to choose exact styles everywhere. The old interfaces have been kept for backwards compatibility.

ScottPlot.Plot myPlot = new();
myPlot.Font.SetExact("Myriad Pro", SKFontStyleWeight.Normal, SKFontStyleSlant.Upright, SKFontStyleWidth.Condensed);

@aespitia
Copy link
Contributor

aespitia commented Jun 2, 2025

would there be a way to have it figure out the weight/style just based on the font itself? i think we've run into some issues where a font's default was that it was Condensed or Book or some other non-normal setting by default and the font wasn't detected at all. I think most people won't know that they have to use those other settings, they just know the font name they want to use.

This would be a great addition, I've definitely run into some font issues before, I hope this gets merged in!

@swharden
Copy link
Member

Hi @Christoph-Wagner, thanks so much for this PR! It took me longer to get to it than typical (#4975) but I'm happy to be reviewing it now.

I definitely want to get these new features implemented, but I hesitate because I think I would prefer to keep SkiaSharp types out of ScottPlot's primitives (FontStyle and LabelStyle).

If you want to create ScottPlot primitives for weight, slant, and width that have extension methods to convert them to SkiaSharp primitives, that would be a good option.

If someone gets to this before I do I will be happy to review it soon, otherwise I'll mark this as "defer" and I'll close some of the other open PRs and loop back around to this and make that change myself.

Thanks again for this new feature! 🚀

@swharden swharden added the defer Action is required, so Scott will focus on closing simpler issues and PRs then return to this label Jun 14, 2025
@swharden swharden changed the title Make all styles available for font selection Font: add support for weight, slant, and width Jun 14, 2025
@aespitia
Copy link
Contributor

I think i might need/want some of the updates included on this PR, @Christoph-Wagner or @swharden, would you care if I make the updates requested and put in a PR for that? from what I understand the main request is to have a native version of: SKFontStyleWeight, SKFontStyleSlant, and SKFontStyleWidth, correct?

@swharden
Copy link
Member

Hey @aespitia, your idea could work! If you create a new PR building on these changes, here's a sequence of events leading to this getting into the next NuGet package

  • You could copy these changes into a new PR and make the requested modifications
  • You can add your own features too
  • I'm out of town until Monday 8/4
  • When I get back I'll review your PR and merge it early in the week
  • The merge will tag both of you as authors
  • I'll then publish a NuGet package probably sometime next week

Does that work for you? I really like the direction this PR is going, and I'd love to have these features in the next version! 🚀

@aespitia
Copy link
Contributor

aespitia commented Jul 30, 2025

Hey @aespitia, your idea could work! If you create a new PR building on these changes, here's a sequence of events leading to this getting into the next NuGet package

* You could copy these changes into a new PR and make the requested modifications

* You can add your own features too

* I'm out of town until Monday 8/4

* When I get back I'll review your PR and merge it early in the week

* The merge will tag both of you as authors

* I'll then publish a NuGet package probably sometime next week

Does that work for you? I really like the direction this PR is going, and I'd love to have these features in the next version! 🚀

submitting PR now #5013

@swharden
Copy link
Member

@Christoph-Wagner, thank you SO MUCH for this PR! The commits have been made in #5013 and extended, and when I merge that PR I'll credit you as a co-author. I'll close this PR since the changes are being tracked over there 👍

@swharden swharden closed this Jul 30, 2025
@Christoph-Wagner Christoph-Wagner deleted the font-selection branch October 2, 2025 02:09
@Christoph-Wagner
Copy link
Contributor Author

I’m glad this went ahead and even got improved, I got busy and this got lost in the cracks. Thanks everyone :)

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

Labels

defer Action is required, so Scott will focus on closing simpler issues and PRs then return to this

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants