> When rendering Thai text, scaling fonts via `deriveFont(float)` seems to > always work correctly. However, when the font is scaled via > `deriveFont(AffineTransform)`, the vowels above the main line of text are > misplaced, mangling the meaning of the text. > > This appears to be caused by GPOS adjustments performed by HarfBuzz which are > calculated at the wrong scale if the full (point size + AffineTransform) > scale is not provided to HarfBuzz upon font creation. > > The fix must change both the FFM and JNI HarfBuzz integration code, so it > looks a bit longer than it actually is. The FFM and JNI changes were made in > separate commits, so it might be helpful to review only the FFM changes in a > first pass, and then have a look at the corresponding JNI changes (which are > in a separate commit). > > Some observations: > > - jdk_font_create_hbp() needs to incorporate font transform scaling, not just > the font point size scaling > - jdk_font_create_hbp() needs two independent font scales / point sizes (x > and y) > - jdk_font_create_hbp() applies devTx, only for it to be removed in > store_layout_results(); we might as well leave devTx out from the start > > Sequence of changes made to the FFM code: > > - Replace SDCache.gtx (glyph transform = font transform without translation, > plus point size scaling, plus device transform) with SDCache.ftx (font > transform including translation, plus point size scaling) > - Remove SDCache.delta (just keep translation components in new ftx field > instead) > - Remove SDCache.dtx (never used) > - Remove devScale from store_layout_results() parameters (dev scale no longer > included during layout, so doesn't need to be undone here) > - Remove destroy function param from jdk_font_create_hbp() (never used, > always NULL) > - Calculate x and y font point sizes in jdk_hb_shape (based on full font > transform, including font pt size), instead of using only font pt size > - Pass these x and y point sizes into jdk_font_create_hbp() > - Remove now-unused ptSize parameter from jdk_font_create_hbp() > - Remove now-unused devScale parameter from jdk_font_create_hbp() > - Remove now-unused ptSize parameter from jdk_hb_shape() > - Remove now-unused ptSize parameter from HBShaper.shape() > > Sequence of changes made to the JNI code: > > - Remove destroy function from _hb_jdk_font_create(), not used just like in > FFM code > - Use xPtSize and yPtSize in _hb_jdk_font_create(), instead of ptSize and > devScale > - Remove devScale from storeGVData (not used during layout, so doesn't need > to be undone at the end) > - Remove now...
Daniel Gredler has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision: - Merge branch 'openjdk:master' into JDK-8269888-bis - Update copyright years - GposTest: fix rounding issue on Windows, improve test failure messages - Fix JNI code - Fix FFM code - Add test ------------- Changes: - all: https://git.openjdk.org/jdk/pull/30953/files - new: https://git.openjdk.org/jdk/pull/30953/files/8312ab3d..4539fde8 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=30953&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=30953&range=00-01 Stats: 77252 lines in 1127 files changed: 18532 ins; 54607 del; 4113 mod Patch: https://git.openjdk.org/jdk/pull/30953.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/30953/head:pull/30953 PR: https://git.openjdk.org/jdk/pull/30953
