提交 b5334201 编写于 作者: D dmarkov

8052396: Catch exceptions resulting from missing font cmap

Reviewed-by: bae, serb
上级 2c7eac47
......@@ -453,6 +453,17 @@ public class FileFontStrike extends PhysicalStrike {
/* Only look in the cache */
long getCachedGlyphPtr(int glyphCode) {
try {
return getCachedGlyphPtrInternal(glyphCode);
} catch (Exception e) {
NullFontScaler nullScaler =
(NullFontScaler)FontScaler.getNullScaler();
long nullSC = NullFontScaler.getNullScalerContext();
return nullScaler.getGlyphImage(nullSC, glyphCode);
}
}
private long getCachedGlyphPtrInternal(int glyphCode) {
switch (glyphCacheFormat) {
case INTARRAY:
return intGlyphImages[glyphCode] & INTMASK;
......@@ -480,6 +491,27 @@ public class FileFontStrike extends PhysicalStrike {
}
private synchronized long setCachedGlyphPtr(int glyphCode, long glyphPtr) {
try {
return setCachedGlyphPtrInternal(glyphCode, glyphPtr);
} catch (Exception e) {
switch (glyphCacheFormat) {
case INTARRAY:
case SEGINTARRAY:
StrikeCache.freeIntPointer((int)glyphPtr);
break;
case LONGARRAY:
case SEGLONGARRAY:
StrikeCache.freeLongPointer(glyphPtr);
break;
}
NullFontScaler nullScaler =
(NullFontScaler)FontScaler.getNullScaler();
long nullSC = NullFontScaler.getNullScalerContext();
return nullScaler.getGlyphImage(nullSC, glyphCode);
}
}
private long setCachedGlyphPtrInternal(int glyphCode, long glyphPtr) {
switch (glyphCacheFormat) {
case INTARRAY:
if (intGlyphImages[glyphCode] == 0) {
......
......@@ -59,7 +59,11 @@ public class TrueTypeGlyphMapper extends CharToGlyphMapper {
}
missingGlyph = 0; /* standard for TrueType fonts */
ByteBuffer buffer = font.getTableBuffer(TrueTypeFont.maxpTag);
numGlyphs = buffer.getChar(4); // offset 4 bytes in MAXP table.
if (buffer != null && buffer.capacity() >= 6) {
numGlyphs = buffer.getChar(4); // offset 4 bytes in MAXP table.
} else {
handleBadCMAP();
}
if (FontUtilities.isSolaris && isJAlocale && font.supportsJA()) {
needsJAremapping = true;
if (FontUtilities.isSolaris8 &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册