Line wrap occurs when it shouldn't with device fonts
Describe the bug
Click the play button to show a timestamp. In ruffle, the last character of the timestamp does not appear, while in Flash Player it does. This is because a line wrap is being added by ruffle before the last character.
Expected behavior
It should look as it does in Flash Player.
Content Location
https://homestuck.com/002730 https://storage.homestuck.com/story/homestuck/media/flashes/act-3/00830.swf
Affected platform
Desktop app
Operating system
Windows 11
Browser
Firefox 156
Additional information
I believe this issue is actually caused by the logic I added in https://github.com/ruffle-rs/ruffle/pull/14204 to round the width of letters to the nearest pixel for device fonts. This was needed both to fix https://github.com/ruffle-rs/ruffle/issues/14185 and to accurately calculate the ActionScript textWidth when device fonts are being used (as seen in the test I added in that PR, avm1/device_font_spacing).
The problem with the logic as I implemented it, is that Flash Player's calculation of when a line wrap should occur seems to NOT round the width of the last character in the line - so that in FP, there can be text with width 29.7 in a box of width 29.8, and no wrap will occur. But in my implementation the text's width gets rounded up to 30 and there will be a wrap.
This means that in a correct implementation we need to be able to calculate the rounded or unrounded width, depending on context. (I'm tracking this as an issue instead of just fixing it because I haven't currently figured out a good approach for doing that.)
Source: ruffle-rs/ruffle