#5264·ScottPlot

Labels ignoring bold/italic attributes after font is set

Author: Martin12350Created Aug 4, 2026Updated Aug 4, 2026

Issue: If we set the font on the plot, it will also set the Font inside of the Labels. And when the label is drawn (ApplyTextPaint), the SKTypeface is set as following: paint.SKTypeface = Font ?? Fonts.GetTypeface(FontName, Bold, Italic);

In that moment, Font is no longer null, and the bold/italic attributes are lost. Resulting in a chart with labels that will never be bold nor italic (unless specified directly in the Font).

It was working in v5.0.55 as expected. PS: It was not so simple to figure out what is happening, since updating Skia resulted in different default font on Linux...

ScottPlot Version: v5.1.59

Code Sample:

cs
Plot plot = new();
plot.XLabel("X label");
plot.YLabel("Y label");

plot.Font.Set(Fonts.Default); //set some font

//Dirty fix: setting fonts back to null
//Why does it work? Because the proper font still will be used since the FontName is properly set,
//but it will also use the bold/italic flags now.

//plot.Axes.Bottom.Label.Font = null;
//plot.Axes.Left.Label.Font = null;

plot.SavePng("plot.png", 500, 500);