-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8353230: Emoji rendering regression after JDK-8208377 #24412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
👋 Welcome back dgredler! A progress list of the required criteria for merging this PR into |
@gredler 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 94 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, @honkar-jdk) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
Webrevs
|
We had similar emoji-related regressions at JetBrains. Although our font-related code diverged from OpenJDK a bit, porting this patch seems to resolve them too. I am not an OpenJDK reviewer, but LGTM nevertheless. |
By the way, I see that in each implementation, both |
@YaaZ: Thanks for the additional feedback, please see my thoughts below:
I don't know if I would call two changes to
True, but again keep in mind that there are only 5 implementations, only one of which (the macOS
We'd still need separate methods for
I prefer to think of it as controlling whether or not any transformations to Any ideas for what this refactoring might look like? |
I was talking about the explosion because there is a scenario in my mind, which I didn't make clear for everybody else. There is a change which I didn't have time to contribute, but would like to: it's related to composite fonts and variation selectors. We may need 2 variants for retrieving a glyph with a variation selector - one strictly matching a variation selector and another with a fallback to the base glyph, multiplied by raw/transformed versions, which adds 2 more methods. Not like it's a big problem, but given that they all end up calling a single method anyway... You get the point.
Are those scenarios specific to a patricular mapper/font type? I was thinking that those transformations are generic.
I was thinking about moving this default-ignorable or any potential generic transformation into base |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, this one fell off the radar. I see my testing - a long time ago now - passed.
The code changes make sense, so I'm ready to approve.
But its been so long I think I should re-test with the latest version on the latest repo.
And indeed the tests just finished and a test (not the new one, a previous one : IgnoredWhitespaceTest.java) failed on macOS x64 and ARM .. java.lang.RuntimeException: for text '\t\t\t\t\tXXXXX' with font java.awt.Font[family=Dialog,name=Dialog,style=plain,size=40]: java.awt.Rectangle[x=300,y=271,width=123,height=28] != java.awt.Rectangle[x=365,y=271,width=123,height=28] JavaTest Message: Test threw exception: java.lang.RuntimeException: for text '\t\t\t\t\tXXXXX' with font java.awt.Font[family=Dialog,name=Dialog,style=plain,size=40]: java.awt.Rectangle[x=300,y=271,width=123,height=28] != java.awt.Rectangle[x=365,y=271,width=123,height=28] |
Yep, that's the test added in PR #23665 (with which this PR had a conflict). |
@YaaZ I had a look at your suggestion to push up the |
@prrace This is ready for review again. I've updated the code to combine nicely with the recent whitespace fixes. The Once these changes are integrated it should be relatively simple to address JDK-8356803 ("Test TextLayout/TestControls fails on windows & linux: line and paragraph separator show non-zero advance") and JDK-8356812 ("Create an automated version of TextLayout/TestControls"). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took me a while, but I think the code looks OK.
Automated testing passed, and I did some manual playing around in Font2DTest.
@@ -2482,7 +2484,7 @@ protected String removeControlChars(String s) { | |||
|
|||
for (int i = 0; i < len; i++) { | |||
char c = in_chars[i]; | |||
if (c > '\r' || c < '\t' || c == '\u000b' || c == '\u000c') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm. looks like you are fixing a bug here. I think those == were supposed to be !=
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hah, I've had to check it a few times but I do think the code was correct -- just formulated in a confusing way, probably as a micro-optimization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I do think we will end up wanting to add Vertical Tab and Form Feed to the list of ignored whitespace chars later, as part of JDK-8356803.
@gredler In the process of reviewing this PR. Just a headsup, JDK 25 RDP1 is next week (https://openjdk.org/projects/jdk/25/) in case you are planning to get the following fixes into 25: |
@honkar-jdk Thanks! It shouldn't take me more than a day to address those two issues once this PR has been integrated, so I think it will just depend on how long the reviews take. I'll keep a close eye out to keep things quick on my end, though. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/integrate |
/sponsor |
Going to push as commit 94039e2.
Your commit was automatically rebased without conflicts. |
@honkar-jdk @gredler Pushed as commit 94039e2. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
It looks like this regression actually fits into a longer series of fixes / regressions in this area:
We have two different types of use cases pulling
CharToGlyphMapper
in two different directions: the users who need raw, untransformed glyph info, and the users who need normalized / transformed glyph info.It looks to me like, in the current code base, the only
CharToGlyphMapper
user which requires raw font data is HarfBuzz (explicitly confirmed with the HarfBuzz team here: harfbuzz/harfbuzz#5234).The regression mechanism at play here is that the HarfBuzz font callbacks are currently providing HarfBuzz with transformed glyph info (e.g. ZWJ -> INVISIBLE_GLYPH_ID), which prevents HarfBuzz from recognizing and applying the correct font GSUB substitutions (which involve ZWJ).
In order to fix this without (yet again) breaking metrics and display behavior elsewhere, I've added two methods to
CharToGlyphMapper
which provide access to raw glyph info, to be used by the HarfBuzz font callbacks:charToGlyphRaw(int)
andcharToVariationGlyphRaw(int)
.Note two intricacies related to
CompositeGlyphMapper
:CompositeGlyphMapper.SLOTMASK
to check glyph slots (e.g.FontRunIterator
andCTextPipe
) will "see" invisible glyphs as having come from slot 0. This isn't new, and I think it's OK, but something to be aware of.The glyph cache handling in
CCharToGlyphMapper
(for macOS) also requires care to avoid mixing value types.Please also note that I'm not sure if the tweak to
sunFont.c
is being tested, since FFM is being used by default for HarfBuzz integration. (Is there a plan to remove the JNI version soon?)This PR includes a self-contained regression test. It includes a small font created just for this test, which exercises the ligature / glyph substitution infrastructure. The font tests, including the new regression test, all pass locally on Linux, Windows and macOS (
make test TEST="jtreg:test/jdk/java/awt/font"
).Interestingly, the changes for JDK-7017058 (mentioned above) included a test (
ZWJLigatureTest
) which I think would have caught this last regression, but it depends on optional Windows fonts which I guess do not exist on any commonly-used test infrastructure. This should not be an issue with the new test, since it does not depend on any external fonts.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24412/head:pull/24412
$ git checkout pull/24412
Update a local copy of the PR:
$ git checkout pull/24412
$ git pull https://git.openjdk.org/jdk.git pull/24412/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 24412
View PR using the GUI difftool:
$ git pr show -t 24412
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24412.diff
Using Webrev
Link to Webrev Comment