changeset 6946:d71ed34d7bd5

RT-36924: [Font, Linux] PangoGlyphLayout not handling PangoGlyph special values
author Felipe Heidrich <felipe.heidrich@oracle.com>
date Wed, 30 Apr 2014 10:48:19 -0700
parents 52f27b865f51
children 084a6d5b5416
files modules/graphics/src/main/java/com/sun/javafx/font/freetype/PangoGlyphLayout.java
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/java/com/sun/javafx/font/freetype/PangoGlyphLayout.java	Wed Apr 30 13:23:23 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/javafx/font/freetype/PangoGlyphLayout.java	Wed Apr 30 10:48:19 2014 -0700
@@ -26,6 +26,7 @@
 package com.sun.javafx.font.freetype;
 
 import com.sun.javafx.font.CompositeFontResource;
+import com.sun.javafx.font.CompositeGlyphMapper;
 import com.sun.javafx.font.FontResource;
 import com.sun.javafx.font.FontStrike;
 import com.sun.javafx.font.PGFont;
@@ -138,7 +139,15 @@
                     for (int i = 0; i < g.num_glyphs; i++) {
                         int gii = gi + i;
                         if (slot != -1) {
-                            glyphs[gii] = (slot << 24) | g.glyphs[i];
+                            int gg = g.glyphs[i];
+
+                            /* Ignoring any glyphs outside the GLYPHMASK range.
+                             * Note that Pango uses PANGO_GLYPH_EMPTY (0x0FFFFFFF), PANGO_GLYPH_INVALID_INPUT (0xFFFFFFFF), 
+                             * and other values with special meaning.
+                             */
+                            if (0 <= gg && gg <= CompositeGlyphMapper.GLYPHMASK) {
+                                glyphs[gii] = (slot << 24) | gg;
+                            }
                         }
                         if (size != 0) {
                             width += g.widths[i];