diff --git a/modules/javafx.web/src/main/native/Source/WebCore/platform/graphics/java/FontPlatformDataJava.cpp b/modules/javafx.web/src/main/native/Source/WebCore/platform/graphics/java/FontPlatformDataJava.cpp index 90cbb0d523..e4025b38a3 100644 --- a/modules/javafx.web/src/main/native/Source/WebCore/platform/graphics/java/FontPlatformDataJava.cpp +++ b/modules/javafx.web/src/main/native/Source/WebCore/platform/graphics/java/FontPlatformDataJava.cpp @@ -71,7 +71,7 @@ std::unique_ptr FontPlatformData::create( family, fontDescription.computedSize(), isItalic(fontDescription.italic()), - isFontWeightBold(fontDescription.weight())); + fontDescription.weight() >= boldWeightValue()); return !wcFont ? nullptr : std::make_unique(wcFont, fontDescription.computedSize()); } diff --git a/modules/javafx.web/src/test/java/test/javafx/scene/web/WebViewTest.java b/modules/javafx.web/src/test/java/test/javafx/scene/web/WebViewTest.java index 889af53f16..7c5e05524d 100644 --- a/modules/javafx.web/src/test/java/test/javafx/scene/web/WebViewTest.java +++ b/modules/javafx.web/src/test/java/test/javafx/scene/web/WebViewTest.java @@ -26,6 +26,7 @@ package test.javafx.scene.web; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import java.io.File; import java.util.concurrent.FutureTask; @@ -89,4 +90,28 @@ private void setZoom(final WebView view, final float zoom) throws Exception { view.setZoom(zoom); }); } + + /** + * @test + * @bug 8191758 + * To make sure extra-heavy weights of the system font can be achieved + */ + @Test public void testFontWeights() { + loadContent( + "" + + "" + + "
" + + "
" + + " Hello, World" + + " Hello, World" + + "
" + + "
" + + " " + ); + submit(() -> { + assertFalse("Font weight test failed ", + (Boolean) getEngine().executeScript( + "document.getElementById('six').offsetWidth == document.getElementById('nine').offsetWidth")); + }); + } }