WICG / canvas-formatted-text

Other
82 stars 17 forks source link

Make wrapWidth on measureFormattedText optional #3

Closed travisleithead closed 3 years ago

travisleithead commented 4 years ago

Copied from: https://github.com/MicrosoftEdge/MSEdgeExplainers/issues/371

In scenarios where text metrics are desired for formatted text, but text wrapping is not needed, the measureFormattedText API must be called with a wrapWidth second parameter of sufficiently large size so that the API doesn't attempt to wrap the text. This is because the scenarios for getting formatted text metrics and for calculating wrapping positions are tied together in this single API call.

Early experimentation suggests it may be useful to make the 2nd parameter to measureFormattedText optional and have it default (when not provided) to +Infinity, such that no line-breaking is attempted when computing line metrics.