fontdue icon indicating copy to clipboard operation
fontdue copied to clipboard

Bug: When calling ".clear()" on the Layout, it adds an empty line

Open therocode opened this issue 9 months ago • 0 comments

I'm pretty sure this is a bug because I can't figure out how this behaviour would make sense.

The Layout object has a .clear() method which I assume is meant to be used to clear all text and then re-use it. However, after resetting the Vec of line_metrics it calls self.line_metrics.push(LinePosition::default());, i.e. it pushes a line from glyph 0..0 with completely default metrics. It doesn't do this when the self.line_metrics is initially created, and it screws up code that relies on line_metrics to work out layouted lines.

Am I missing something in saying that this line should simply be removed?

therocode avatar Mar 31 '25 04:03 therocode