8165943: LineBreakMeasurer does not measure correctly if TextAttribute.TRACKING is set.#10289
8165943: LineBreakMeasurer does not measure correctly if TextAttribute.TRACKING is set.#10289omikhaltsova wants to merge 10 commits intoopenjdk:masterfrom
Conversation
…e.TRACKING is set.
|
👋 Welcome back omikhaltcova! A progress list of the required criteria for merging this PR into |
|
/contributor add Jason Fordham jclf@azul.com |
|
@omikhaltsova |
|
@omikhaltsova The following label will be automatically applied to this pull request:
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
|
|
@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 Le lun. 21 nov. 2022 ? 16:08, azul-jf <duke at openjdk.org> a ?crit : -------------- next part -------------- |
|
Its better if we can add jtreg(regression) test along with fix. |
|
I'm sure an automated test is possible - it should be easy enough to adjust the tracking and verify the breaks are different. |
| /* | ||
| @test | ||
| @key headful | ||
| @bug 8165943 |
There was a problem hiding this comment.
headful isn't needed on manual tests.
Also whilst you can keep this manual test, I still think an automated test that verifies tracking is making a difference to the advance should be provided.
| if (lineMeasurer == null) { | ||
| Float regular = new Float(16.0); | ||
| Float big = new Float(24.0); | ||
|
|
There was a problem hiding this comment.
LineBreakWithTracking.java:74: warning: [removal] Float(double) in Float has been deprecated and marked for removal
Float regular = new Float(16.0);
^
LineBreakWithTracking.java:75: warning: [removal] Float(double) in Float has been deprecated and marked for removal
Float big = new Float(24.0);
Use Float.valueOf(float) instead
| JButton btn = new JButton("Pass"); | ||
| btn.addActionListener(new ActionListener(){ | ||
| public void actionPerformed(ActionEvent e){ | ||
| System.exit(0); |
There was a problem hiding this comment.
Do not call System.exit() in jtreg tests - even manual ones or ones that run in their own VM.
Instead dispose() the UI and then either let main() exit normally or throw RuntimeException() to indicate failure.
Also be sure that ALL exit paths clean up windows.
You may want to use PassFailJFrame.java to help you avoid writing the boilerplate and to get some of these things right
https://github.com/openjdk/jdk/blob/master/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java
|
The following fixes are made:
|
| class LineBreakPanel extends JPanel implements ActionListener { | ||
|
|
||
| private float textTracking = 0.0f; | ||
| private static String fontName = "Bitstream Cyberbit"; |
There was a problem hiding this comment.
Did you previously use this font ? I must have over-looked that.
Do not use fonts that aren't available on the OS .. no SQE person will ever install - or even know a test uses it - and JDK will just use Dialog instead and people will get confused over why their experience is different than yours.
And of course each OS (desktop) will have different fonts. Overall best to just pick a logical font. If you want to know if the font supports all your code points you can iterate over your text using Font.canDisplay(int codePoint)
I'll submit a test job using your automated test.
There was a problem hiding this comment.
I noticed the usage of this font "Bitstream Cyberbit" in TestJustification.java that was added by you. I used the test string from there because it includes Latin, Arabic, CJK and Hebrew. "Bitstream Cyberbit" has all nessesary symbols used in the test string. At the moment I have no idea what font I can use instead.
There was a problem hiding this comment.
I'm pretty sure it wasn't me who created that.
I may have updated it at some point (actually I suspect what you see is that I moved
it from closed to open) but that test was created by someone else 23 years ago (1999).
Different world back then. Likely it should not use the font either.
Your best best is to use Dialog. On all platforms where a decent set of fonts is installed then all those scripts will be supported by Dialog.
prrace
left a comment
There was a problem hiding this comment.
This now is fine by me. It didn't break any of our automated tests.
|
@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: 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
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 |
|
Thanks a lot for reviewing! |
|
@omikhaltsova |
|
/sponsor |
|
Going to push as commit 8edb98d.
Your commit was automatically rebased without conflicts. |
|
@bae @omikhaltsova Pushed as commit 8edb98d. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |





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/fontProgress
Issue
Reviewers
Contributors
<jclf@azul.com>Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10289/head:pull/10289$ git checkout pull/10289Update a local copy of the PR:
$ git checkout pull/10289$ git pull https://git.openjdk.org/jdk pull/10289/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 10289View PR using the GUI difftool:
$ git pr show -t 10289Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10289.diff