Skip to content

Custom Fonts #536

@bclehmann

Description

@bclehmann

What can we do to make ScottPlot better?
Currently, the font of all text is decided like this:

  1. The plottable (or axis, legend, etc) decides if they want a Serif, Sans Serif, or Monospace font name
  2. The ScottPlot.Config.Fonts class has a list of fonts of each type and returns the name of the first installed font of that type
    2.1 If there are no installed fonts of that type it returns the name of the system default font name

I'm conflicted as to what the best alternative would be. The most obvious option is for every piece of text to receive an optional parameter to choose a different font, but that is overkill, a lot of time to implement, and not a good user experience, as they may have to change every font on every plottable/axis/legend/etc just to fit with their theme.

So my suggestion is to allow the user to call something like Config.Fonts.SetSansSerifFontName(string fontName) which adds the font to the beginning of the sans serif (or serif or monspace) list of fonts. Then it will be used (if the specified font is installed) everywhere there is sans serif text.

Worth noting that currently Config.Fonts.GetDefaultFontName() returns the first valid Sans Serif font, which should probably be changed. If the user wants to set comic sans as the font for their plottables it probably shouldn't affect the axis in my opinion. Your opinion may differ. Lots of plottables use this method, when they probably should use GetSansFontName.

Does your proposed feature allow users to do new things in source code? If so, show us how you'd like to be able to use the new feature:

Config.SetSansFontName(string "Comic Sans MS");

Check the ScottPlot Roadmap to see if your feature is already planned for an upcoming release:
https://github.com/swharden/ScottPlot/blob/master/dev/roadmap.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions