Re-baseline testTextBounds after the LazyBitmapFont origin fix - #2386
Re-baseline testTextBounds after the LazyBitmapFont origin fix#2386Delfayne wants to merge 3 commits into
Conversation
…nally the glyph rectangle was pinned to the left edge, but was nudged out when the borders changed due to the bug. I think this was a case of test-following-behaviour rather than being investigated as its own fix See: korlibs/korlibs#211
|
I will trigger a new Korlibs 7.0.0-SNAPSHOT release with PR 211 and then run the unit tests here. Thanks for the fix! :) |
|
Thanks! I imagine we'll still be blocked on the Mac stuff tho, hmm |
Yes, that is right. But as you can see in the history, we have this e2e-macos-swiftui test case already failing since some time. I just could not yet fix it. It will not block your PR. |
|
We have another test failing: Could you check that, too? Thanks. |
|
Please be patient with me :) |
|
I had missed your message. Yes I will check |
…t origin fix The text ink in test_0.png moved 2px right and 2px down. The glyph bitmaps themselves are unchanged (both inks span 9x11) and both checkbox squares are pixel-identical; only the "hi" label moved. The new position is the correct one. UIBaseCheckBox places the text block at x = height + 4 = 36 (UI_DEFAULT_SIZE is 100x32), and the old render started the 'h' ink at x=35, one pixel outside the block's own left edge. It now starts at 37, a normal left side bearing.
|
The numbers may look slightly different between these two. IF you check the In both cases the actual ink moved down and right by two pixels. However as it turns out, this is wholly by coincidence.
The on-screen shift is therefore
Measured from the built fonts, after the fix: You can see that the two fonts now agree on every offset. Before the fix they did not, purely because their And to fully clarify, before the fix, the ink for the text in this case was drawing outside it's own bounding box. (as per my screenshot in the previous post) |
|
Awesome! Thank you for your contribution. |
|
@Delfayne Could you reintroduce the changes from korlibs/korlibs#211 in Korlibs and create a PR which comes from your Korlibs fork and has the same branch name as this here? That would allow us to integrate this PR together with your previous PR in Korlibs. For details about the integration process please have a look here: https://github.com/korlibs/korlibs/blob/main/docs/contributing-cross-repo-changes.md Many thanks :) |

Originally the glyph rectangle was pinned to the left edge, but was nudged out when the borders changed due to the bug. I think this was a case of test-following-behaviour rather than being investigated as its own fix
korlibs/korlibs#211 fixed
LazyBitmapFonttaking each glyph's offsets from the untrimmed bitmap's coordinates, which left every glyphborderpx from its own left edge and shifted all text right. That moves this assertion:Only the origin moves. Width and height are unchanged.
The
x=2was written in 1f55e52 ("Lazy dynamic BitmapFont from VectorFont", #1113) and in the same commit that introduced that code (and the bug), back when korim was still a directory in this repo. It recorded whatever the new path emitted rather than a derived value.x=0is what this test asserted beforeLazyBitmapFontexisted, and is the correct answer for text placed at the origin.