< prev index next >
src/java.desktop/share/classes/sun/font/FontRunIterator.java
Print this page
@@ -117,12 +117,44 @@
return false;
}
int ch = nextCodePoint(lim);
int sl = mapper.charToGlyph(ch) & CompositeGlyphMapper.SLOTMASK;
+ int secondPosition = pos;
+ int preChar = ch;
+ boolean consumed = false;
slot = sl >>> 24;
- while ((ch = nextCodePoint(lim)) != DONE && (mapper.charToGlyph(ch) & CompositeGlyphMapper.SLOTMASK) == sl);
+ while ((ch = nextCodePoint(lim)) != DONE ) {
+ if (CharToGlyphMapper.isVariationSelector(ch) &&
+ CharToGlyphMapper.isVSBaseChar(preChar) &&
+ consumed == false) {
+ consumed = true;
+ int[] chars = {preChar, ch};
+ int[] glyphs = {0, 0};
+ mapper.charsToGlyphs(2, chars, glyphs);
+ int vsSize = 1;
+ if (ch >= 0x10000) {
+ vsSize = 2;
+ }
+ if (secondPosition + vsSize == pos) { // Real slot
+ sl = glyphs[0] & CompositeGlyphMapper.SLOTMASK;
+ slot = sl >>> 24;
+ }
+ if ((glyphs[0] & CompositeGlyphMapper.SLOTMASK) != sl) {
+ pushback(ch);
+ pushback(preChar);
+ return true;
+ }
+ } else {
+ consumed = false;
+ if ((mapper.charToGlyph(ch) & CompositeGlyphMapper.SLOTMASK)
+ != sl) {
+ break;
+ }
+ }
+ preChar = ch;
+ }
pushback(ch);
return true;
}
< prev index next >