jdk
jdk copied to clipboard
8165943: LineBreakMeasurer does not measure correctly if TextAttribute.TRACKING is set.
This is a fix for LineBreakMeasurer. It takes into account the TextAttribute.TRACKING value (not eq 0) while calculating the line breaks.
Tested on Linux x64, Windows x64, macOS x64 with the reproducer (LineBreakSample.java) attached to JDK-8165943 and the following group of tests:
$JTREG_HOME/bin/jtreg -jdk:$BUILD_HOME ./test/jdk/java/awt/font
Progress
- [ ] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
- [x] Change must not contain extraneous whitespace
- [x] Commit message must refer to an issue
Issue
- JDK-8165943: LineBreakMeasurer does not measure correctly if TextAttribute.TRACKING is set.
Contributors
- Jason Fordham
<[email protected]>
Reviewing
Using git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10289/head:pull/10289
$ git checkout pull/10289
Update a local copy of the PR:
$ git checkout pull/10289
$ git pull https://git.openjdk.org/jdk pull/10289/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 10289
View PR using the GUI difftool:
$ git pr show -t 10289
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10289.diff
:wave: Welcome back omikhaltcova! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.
/contributor add Jason Fordham [email protected]
@omikhaltsova
Contributor Jason Fordham <[email protected]> successfully added.
@omikhaltsova The following label will be automatically applied to this pull request:
client
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.
Webrevs
- 05: Full - Incremental (34764d82)
- 04: Full - Incremental (b0d44ce0)
- 03: Full - Incremental (c136384f)
- 02: Full - Incremental (b1b4b146)
- 01: Full - Incremental (1818c7d5)
- 00: Full (3564751d)
@omikhaltsova This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!
gentle ping; pls review this pr!
@prrace Could you please take a look at the proposed changes! Is this fix needed or not? It fixes JDK-8165943/JDK-6598756. I opened PR on JDK-8165943 because it had more active conversation. But maybe I made a mistake and it should be opened on JDK-6598756 (created by you) because it was created earlier then JDK-8165943?
I haven't had time to look at this. Maybe I can look at it some time in the 1st week of December. Ping me then.
Thanks! I'll ping you in 1,5 weeks.
Hi @prrace, this came to our attention as a customer issue. The reproducer we used was the one from JDK-8165943.
As a reminder of the issue and an illustration of the desired outcome, here are some screen captures.
Existing code, TRACKING = 0.0:

Existing code, TRACKING = 0.1:

Submitted code, TRACKING = 0.1:

Mailing list message from Patrick Chen on client-libs-dev:
I think it is good reviewed
Le lun. 21 nov. 2022 ? 16:08, azul-jf <duke at openjdk.org> a ?crit :
-------------- next part -------------- An HTML attachment was scrubbed... URL: <https://mail.openjdk.org/pipermail/client-libs-dev/attachments/20221122/c90ebeb2/attachment.htm>
Change looks okay to me. Verified the fix locally and line break works properly with tracking now.
Attached image with tracking 0.1 before and after fix.
Before fix :

After fix :

Also client test run in our CI with this fix is green. Let's wait for Phil's review also.
Its better if we can add jtreg(regression) test along with fix. It can be a manual test, if we can't automate it.
I'm sure an automated test is possible - it should be easy enough to adjust the tracking and verify the breaks are different. The code paths here don't do complex text. Tracking doesn't really work for things like Arabic .. but it would be good to verify that Arabic measures as it lays out with tracking - ignoring it I expect, but I could be surprised if there's something I am overlooking. Hence why a test of that would be good.
The following fixes are made:
- fixed the lines breaks calculation for the negative tracking values;
- included an epsilon for floating point operation;
- fixed the manual test according to the above comments;
- added a simple automated test similar to TestLineBreakWithFontSub.
@omikhaltsova This change now passes all automated pre-integration checks.
ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.
After integration, the commit message for the final commit will be:
8165943: LineBreakMeasurer does not measure correctly if TextAttribute.TRACKING is set.
Co-authored-by: Jason Fordham <[email protected]>
Reviewed-by: prr
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.
At the time when this comment was updated there had been 1191 new commits pushed to the master branch:
- 39344840c7a5fbd37f6c6a972a89c3600396e878: 8298205: Prefer Member Initialization Lists for JFR classes in os_perf.hpp
- 389b8f4b788375821a8bb4b017e50f905abdad2d: 8297298: SequenceInputStream should override transferTo
- dd7385d1e86afe8af79587e80c5046af5c84b5cd: 8298202: [AIX] Dead code elimination removed jfr constructor used by AIX
- 29f1c3c6e39170e0f36949dc209edf183c2eb36b: 8298274: Problem list TestSPISigned on Windows
- 3de775094dab3c375a32ddabdd24456d177d3009: 8298177: Various java.lang.invoke cleanups
- 6ed36835ec9b3743430a8c1c71635f12c711f48a: 8297209: Serial: Refactor GenCollectedHeap::full_process_roots
- 86270e3068d3b2e80710227ae2dc79719df35788: 8269820: C2 PhaseIdealLoop::do_unroll get wrong opaque node
- cf63f2e3ea93cf339d08e2865034e128d683e515: 8298184: Incorrect record component type in record patterns
- 58170f657c2ccc7afd1e9056d7630a3b564207ef: 8298035: Provide better descriptions for JIT compiler JFR events
- bfcc238ed09cb432e4a003b89a803c3c10e8ac80: 8297964: Jetty.java fails "assert(_no_handle_mark_nesting == 0) failed: allocating handle inside NoHandleMark"
- ... and 1181 more: https://git.openjdk.org/jdk/compare/cea409cc2822ccdc9cbf6df04d46742e3c73b0fe...master
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.
As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@prrace) but any other Committer may sponsor as well.
➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).
/integrate
Thanks a lot for reviewing!
@omikhaltsova Your change (at version 34764d82faf3abb081566ed34329af2b885b5f44) is now ready to be sponsored by a Committer.
/sponsor
Going to push as commit 8edb98df3dd393103f2c80e929b011bc6b7993a3.
Since your change was applied there have been 1191 commits pushed to the master branch:
- 39344840c7a5fbd37f6c6a972a89c3600396e878: 8298205: Prefer Member Initialization Lists for JFR classes in os_perf.hpp
- 389b8f4b788375821a8bb4b017e50f905abdad2d: 8297298: SequenceInputStream should override transferTo
- dd7385d1e86afe8af79587e80c5046af5c84b5cd: 8298202: [AIX] Dead code elimination removed jfr constructor used by AIX
- 29f1c3c6e39170e0f36949dc209edf183c2eb36b: 8298274: Problem list TestSPISigned on Windows
- 3de775094dab3c375a32ddabdd24456d177d3009: 8298177: Various java.lang.invoke cleanups
- 6ed36835ec9b3743430a8c1c71635f12c711f48a: 8297209: Serial: Refactor GenCollectedHeap::full_process_roots
- 86270e3068d3b2e80710227ae2dc79719df35788: 8269820: C2 PhaseIdealLoop::do_unroll get wrong opaque node
- cf63f2e3ea93cf339d08e2865034e128d683e515: 8298184: Incorrect record component type in record patterns
- 58170f657c2ccc7afd1e9056d7630a3b564207ef: 8298035: Provide better descriptions for JIT compiler JFR events
- bfcc238ed09cb432e4a003b89a803c3c10e8ac80: 8297964: Jetty.java fails "assert(_no_handle_mark_nesting == 0) failed: allocating handle inside NoHandleMark"
- ... and 1181 more: https://git.openjdk.org/jdk/compare/cea409cc2822ccdc9cbf6df04d46742e3c73b0fe...master
Your commit was automatically rebased without conflicts.
@bae @omikhaltsova Pushed as commit 8edb98df3dd393103f2c80e929b011bc6b7993a3.
:bulb: You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.