Computing TextMetrics is the only way to get the correct size of a piece of text in the canvas. So far, we used a clumsy hack to make text metrics available to client code. With this PR, we still use a hack (in form of an auto-implicit utility for computing text metrics, which is derived from CanvasRenderingContext2D), but it's far less clumsy.
Computing
TextMetrics
is the only way to get the correct size of a piece of text in the canvas. So far, we used a clumsy hack to make text metrics available to client code. With this PR, we still use a hack (in form of an auto-implicit utility for computing text metrics, which is derived fromCanvasRenderingContext2D
), but it's far less clumsy.