Skip to content

Default text rendering to use subpixel rendering#3937

Merged
swharden merged 3 commits intoScottPlot:mainfrom
bforl:main
Jun 13, 2024
Merged

Default text rendering to use subpixel rendering#3937
swharden merged 3 commits intoScottPlot:mainfrom
bforl:main

Conversation

@bforl
Copy link
Contributor

@bforl bforl commented Jun 12, 2024

I noticed that the font spacing between characters was not consistent. This resulted in spacing between characters that almost looks like white space, as can be seen in the image below :

image

To correct this, there is a property on the skia Paint object that enables subpixel text rendering. Enabling this results in much more consistent spacing between characters.

In the image below, the lines with the '!' at the end have SubpixelText set to true.
It's very subtle, but notice how they have a consistent 1 pixel gap between the characters?
Where as the ones below (without the '!', with SubpixelText set to false) have either a 2 pixel gap, 1 pixel gap or no pixel gap.

image

The cookbook example now also looks better

image

I have added this property to the Label class with the default being set to true.

@swharden
Copy link
Member

Thanks for tracking this issue down @bforlgreen!

It's amazing how less than a pixel of spacing can drive you nuts once you realize it's there 🤪

@swharden swharden merged commit 05394f8 into ScottPlot:main Jun 13, 2024
KroMignon added a commit to KroMignon/ScottPlot that referenced this pull request Jun 24, 2024
* upstream/main: (317 commits)
  CI: autoformat
  Population: new primitive with methods for statistics, testing, and plotting (ScottPlot#3944)
  Axes: Improve automatic axis limit expansion for extremely large values
  Default text rendering to use subpixel rendering (ScottPlot#3937)
  Added LabelFormatter to DateTimeFixedInterval (ScottPlot#3936)
  Fonts: use a ConcurrentDictionary for typeface caching
  ScottPlot 5.0.35
  SignalXY: Improved cookbook recipe demonstrating SignalXY plots with markers at each point
  Sandbox: simplify app
  SignalXY: fix GetRangeY() scaling bug
  SignalXY: Improve behavior of off-screen single-point signals
  SignalXY: improve interpolation of edge points when step mode is enabled
  SignalXY: add scaling and offset to last point
  DataLogger and DataStreamer: do not manage axes if data is empty
  CI: autoformat
  Cookbook: heatmap with custom tick formatter
  Update Color.cs (ScottPlot#3924)
  Heatmap: ManualRange
  CI: autoformat
  SignalXY: improve behavior of rotated and inverted plots
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants