Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 8ad5805
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
Expand Up @@ -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());
}

Expand Down
Expand Up @@ -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;
Expand Down Expand Up @@ -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.