Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to easily set the plot to the very same font than the rest of a WinForms application #1469

Open
maettu-this opened this issue Feb 7, 2020 · 3 comments

Comments

@maettu-this
Copy link

Feature description

I have struggled with setting the plot to the very same font than the rest of the WinFormsApp, in order to follow "Use only one font" at https://oxyplot.readthedocs.io/en/latest/guidelines/design.html:

plotView.Model.DefaultFont = SystemFonts.DefaultFont.Name;
plotView.Model.DefaultFontSize = SystemFonts.DefaultFont.SizeInPoints;

...results in too small font. Also, it is not clear what size (e.g. Points) Oxy expects.

plotView.Model.DefaultFont = SystemFonts.DefaultFont.Name;
plotView.Model.DefaultFontSize = SystemFonts.DefaultFont.Height;

…looks old-fashioned.

Why not reuse the apps font rather than fixing to "Segoe UI" and 12?
At least there should be an example showing how to achieve "Use only one font".

@objorke
Copy link
Member

objorke commented Feb 8, 2020

Agree it should by default look like the default font used in the current framework. Currently it is set to "Segoe UI" to match WPF.

I suggest to change the default values to undefined, and then let WinForms/WPF/etc. decide which font and size to use.

@VisualMelon
Copy link
Contributor

The GraphicsRenderContext has a FontScale property which defaults to 0.8 (this may account for text appearing smaller than expected).

I don't understand the rational for this, unless it is a crude mapping from Pixels (usually what you end up with as the PageUnit of a Graphics object) to Points.


Adding a DefaultFontFamily to GraphicsRenderContext would be easy enough, but how would we address different font sizes for title plot elements? Just use the default font size again, or multiply by some factor?

@Joe-Dunleavy
Copy link

Joe-Dunleavy commented Jul 19, 2022

I'm happy to address this issue.

As well as the PlotModel font/size getting set to non-default values, the Class Diagrams font also targets Segoe UI and sets the default font size to 9.

How do we intend on addressing title and subtitle font size? As suggested by VisualMelon, multiplying by some factor of the default size is probably a good idea.

Also, we might want to consider not multiplying the font size by 0.8, (The Fontscale property in GraphicsRendercontext) as this makes the font size appear too small, especially when using the system default font size value.

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

No branches or pull requests

4 participants