Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
8191758: Match WebKit's font weight rendering with JavaFX
Reviewed-by: kcr, ajoseph
- Loading branch information
|
@@ -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")); |
|
|
}); |
|
|
} |
|
|
} |