Skip to content
Permalink
Browse files

8191758: Match WebKit's font weight rendering with JavaFX

Reviewed-by: kcr, ajoseph
  • Loading branch information
bhawesh authored and kevinrushforth committed Apr 30, 2020
1 parent 66c3b38 commit 8ad5805272eef7021703cd2b8f8fef4573eca5f0
@@ -71,7 +71,7 @@ std::unique_ptr<FontPlatformData> FontPlatformData::create(
family,
fontDescription.computedSize(),
isItalic(fontDescription.italic()),
isFontWeightBold(fontDescription.weight()));
fontDescription.weight() >= boldWeightValue());
return !wcFont ? nullptr : std::make_unique<FontPlatformData>(wcFont, fontDescription.computedSize());
}

@@ -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(
"<!DOCTYPE html><html><head></head>" +
"<body>" +
" <div style=\"font: 19px system-ui\">" +
" <div style=\"font-style: italic;\">" +
" <span id=\"six\" style=\"font-weight: 600;\">Hello, World</span>" +
" <span id=\"nine\" style=\"font-weight: 900;\">Hello, World</span>" +
" </div>" +
" </div>" +
"</body> </html>"
);
submit(() -> {
assertFalse("Font weight test failed ",
(Boolean) getEngine().executeScript(
"document.getElementById('six').offsetWidth == document.getElementById('nine').offsetWidth"));
});
}
}

0 comments on commit 8ad5805

Please sign in to comment.