oxyplot / oxyplot

A cross-platform plotting library for .NET
https://oxyplot.github.io/
MIT License
3.28k stars 960 forks source link

What is MeasureText #1551

Open VisualMelon opened 4 years ago

VisualMelon commented 4 years ago

The IRenderContext.MeasureText method doesn't have a formal specification, and is implemented in different ways all over the place.

We should consider formalising its behaviour so that we can make everything consistent before attempting to address inconsistencies in multi-line text rendering between platforms (see Issue #1538 and discussion in PR #1549).

Jonarw commented 4 years ago

There appear to be some different nomenclatures around this topic. To be sure we are talking about the same thing, I will use the same nomenclature as in this blog post: http://www.cyrilchandelier.com/understanding-fonts-and-uifont

Some thoughts:

Height

Width

VisualMelon commented 4 years ago

Thanks for putting that so clearly.

It's not immediately obvious how to implement the width computing manually in some APIs, but in practice the width doesn't seem to be much of an issue.

Jonarw commented 4 years ago

Yes, probably most of the APIs do exactly this computation under the hood, and if there is no issue there would be no need to change anything. The definition should only serve as a reference in case of doubts / inconsistencies.