[jdk11u-dev] RFR: 8328896: Fontmetrics for large Fonts has zero width

Martin Doerr mdoerr at openjdk.org
Fri Jun 28 11:20:44 UTC 2024


Backport of [JDK-8328896](https://bugs.openjdk.org/browse/JDK-8328896). Applies cleanly except one hunk which is omitted:

--- src/java.desktop/macosx/native/libawt_lwawt/font/CGGlyphImages.m
+++ src/java.desktop/macosx/native/libawt_lwawt/font/CGGlyphImages.m
@@ -1020,4 +1020,20 @@ @implementation CGGI_GlyphCanvas
             CTFontGetAdvancesForGlyphs(font, kCTFontDefaultOrientation, glyphs, advances, count);
         }
     }
-}+    int MAX_SIZE = 1 << 30;
+    if (bboxes) {
+        for (int i = 0; i < count; i++) {
+           if (bboxes[i].origin.x > (double)MAX_SIZE) bboxes[i].origin.x = 0;
+           if (bboxes[i].origin.y > (double)MAX_SIZE) bboxes[i].origin.y = 0;
+           if (bboxes[i].size.width > (double)MAX_SIZE) bboxes[i].size.width = 0;
+           if (bboxes[i].size.height > (double)MAX_SIZE) bboxes[i].size.height = 0;
+        }
+    }
+    if (advances) {
+        for (int i = 0; i < count; i++) {
+           if (advances[i].width > (double)MAX_SIZE) advances[i].width = 0;
+           if (advances[i].height > (double)MAX_SIZE) advances[i].height = 0;
+        }
+    }
+}
+

[JDK-8263583](https://bugs.openjdk.org/browse/JDK-8263583) is not in 11u.

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

Commit messages:
 - Backport 25871af36b1397bdc3715ab0edc589f0483ea0b1

Changes: https://git.openjdk.org/jdk11u-dev/pull/2826/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk11u-dev&pr=2826&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8328896
  Stats: 149 lines in 4 files changed: 148 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk11u-dev/pull/2826.diff
  Fetch: git fetch https://git.openjdk.org/jdk11u-dev.git pull/2826/head:pull/2826

PR: https://git.openjdk.org/jdk11u-dev/pull/2826


More information about the jdk-updates-dev mailing list