JDK-8191758 : Match WebKit's font weight rendering with JavaFX
  • Type: Bug
  • Component: javafx
  • Sub-Component: web
  • Affected Version: 8u172,10
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2017-11-22
  • Updated: 2020-08-25
  • Resolved: 2020-04-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 Other
8u271Fixed openjfx11.0.9Fixed
Related Reports
Relates :  
Description
DRT test "fast/text/system-font-weight-italic.html" is failing due to incorrect weight matching.
Comments
Changeset: 8ad58052 Author: bhawesh <bhawesh.choudhary@oracle.com> Committer: Kevin Rushforth <kcr@openjdk.org> Date: 2020-04-30 16:22:03 +0000 URL: https://git.openjdk.java.net/jfx/commit/8ad58052
30-04-2020

changes looks fine.. Need to find out why this test case passed in linux..
22-11-2017

is this issue specific to OSX and windows ? I see in linux, the DRT fast/text/system-font-weight-italic.html is PASSED. can you point me the code in webcore where isFontWeightBold() returns true for weight greater than 600.
22-11-2017

diff -r b9d70970b14e modules/javafx.web/src/main/native/Source/WebCore/platform/graphics/java/FontPlatformDataJava.cpp --- a/modules/javafx.web/src/main/native/Source/WebCore/platform/graphics/java/FontPlatformDataJava.cpp Fri Nov 17 12:08:39 2017 +0530 +++ b/modules/javafx.web/src/main/native/Source/WebCore/platform/graphics/java/FontPlatformDataJava.cpp Wed Nov 22 11:32:06 2017 +0530 @@ -71,7 +71,7 @@ family, fontDescription.computedSize(), fontDescription.italic(), - isFontWeightBold(fontDescription.weight())); + fontDescription.weight() >= boldWeightValue()); return !wcFont ? nullptr : std::make_unique<FontPlatformData>(wcFont, fontDescription.computedSize()); }
22-11-2017

It is working in previous WebKit because "isBold" parameter ensures it, but in the new WebKit "isBold" parameter is dropped and only "fontWeight" is passed to the platform. Currently we use "isFontWeightBold()" method to determine whether it is bold or not. "isFontWeightBold()" return true for weight value greater than 600, but JavaFX considers bold only if FontWeight is >= 700. Please refer "PrismFontLoader.font" method and FontWeight doc[1] // REMIND. Some day need to have better granularity. boolean bold = weight != null && weight.ordinal() >= FontWeight.BOLD.ordinal(); (Note: JavaFX also doesn't support font weight properly, only normal and bold is supported.) [1] https://docs.oracle.com/javase/9/docs/api/javafx/scene/text/FontWeight.html#BOLD
22-11-2017