<Swing Dev> RFR: 8231286: HTML font size too large with high-DPI scaling and W3C_UNIT_LENGTHS

Prasanta Sadhukhan psadhukhan at openjdk.java.net
Fri Dec 4 17:38:22 UTC 2020


Issue is when using a JEditorPane to render HTML views with W3C_UNIT_LENGTHS enabled, font-sizes set using CSS are much larger than the same font size outside the HTML.
It's because CSS LengthUnit uses screen resolution to calculate units so for hidpi screens, the html font size is bigger. 
Fix is to calculate the units based on the CSS absolute length mentioned in https://drafts.csswg.org/css-values-3/#absolute-lengths so hidpi scaling is not applied twice in CSS and again by Java.

-------------

Commit messages:
 - jcheck fix
 - CSS fix

Changes: https://git.openjdk.java.net/jdk/pull/1628/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1628&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8231286
  Stats: 124 lines in 2 files changed: 113 ins; 4 del; 7 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1628.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1628/head:pull/1628

PR: https://git.openjdk.java.net/jdk/pull/1628


More information about the swing-dev mailing list