JBR-7556 Check negative glyphID in HBShaper

(cherry picked from commit 76852278f4)
This commit is contained in:
Nikita Gubarkov
2024-09-16 18:13:49 +02:00
committed by Vitaly Provodin
parent c8aa5b1b3f
commit 99a842f887

View File

@@ -343,6 +343,7 @@ public class HBShaper {
Font2D font2D = scopedVars.get().font();
int glyphID = font2D.charToGlyph(unicode);
if (glyphID < 0) glyphID = 0;
@SuppressWarnings("restricted")
MemorySegment glyphIDPtr = glyph.reinterpret(4);
glyphIDPtr.setAtIndex(JAVA_INT, 0, glyphID);
@@ -359,6 +360,7 @@ public class HBShaper {
) {
Font2D font2D = scopedVars.get().font();
int glyphID = font2D.charToVariationGlyph(unicode, variation_selector);
if (glyphID < 0) glyphID = 0;
@SuppressWarnings("restricted")
MemorySegment glyphIDPtr = glyph.reinterpret(4);
glyphIDPtr.setAtIndex(JAVA_INT, 0, glyphID);