/* This defines the preference order for cmap subtables */ if (threeStar) { if (three10 != 0) {
cmap = createCMap(cmapBuffer, three10, null);
} elseif (three0 != 0) { /* The special case treatment of these fonts leads to *anomalieswhereausercanview"wingdings"and"wingdings2" *andthelattershowsallitscodepointsintheunicode *privateuseareaat0xF000->0XF0FFandtheformershows *ascatteredsubsetofitsglyphsthatareknownmappingsto *unicodecodepoints. *Theprimarypurposeofthesemappingswastofacilitate *displayofsymbolcharsetcincompositefonts,however *thisisnotneededasallthesecodepointsarecovered *bysomeotherplatformsymbolfont. *Commentingthisoutreducestheroleofthesetwofiles *(assumingthattheycontinuetobeusedinfont.properties) *tojustoneofcontributingtotheoverallcomposite *fontmetrics,andalsoAWTcanstillaccessthefonts. *Clientswhichexplicitlyaccessedthesefontsasnames *"Symbol"and"Wingdings"(ieasphysicalfonts)and *expectedtoseeascatteringofthesecharacterswill *seethemnowasmissing.Howmuchofaproblemisthis? *Perhapswecouldstillsupportthismappingjustfor *"Symbol.ttf"butIsuspectsomeuserswouldpreferit *tobemappedintotheLatinrangeasthatishow *the"symbol"fontisusedinnativeapps.
*/ // String name = font.platName.toLowerCase(Locale.ENGLISH); // if (name.endsWith("symbol.ttf")) { // cmap = createSymbolCMap(cmapBuffer, three0, Symbols_b2c); // } else if (name.endsWith("wingding.ttf")) { // cmap = createSymbolCMap(cmapBuffer, three0, WingDings_b2c); // } else {
cmap = createCMap(cmapBuffer, three0, null); // }
} elseif (three1 != 0) {
cmap = createCMap(cmapBuffer, three1, null);
} elseif (three2 != 0) {
cmap = createCMap(cmapBuffer, three2,
getConverterMap(ShiftJISEncoding));
} elseif (three3 != 0) {
cmap = createCMap(cmapBuffer, three3,
getConverterMap(GBKEncoding));
} elseif (three4 != 0) {
cmap = createCMap(cmapBuffer, three4,
getConverterMap(Big5Encoding));
} elseif (three5 != 0) {
cmap = createCMap(cmapBuffer, three5,
getConverterMap(WansungEncoding));
} elseif (three6 != 0) {
cmap = createCMap(cmapBuffer, three6,
getConverterMap(JohabEncoding));
}
} else { /* No 3,* subtable was found. Just use whatever is the first *tablelisted.Notveryusefulbutmaybebetterthan *rejectingthefontentirely?
*/
cmap = createCMap(cmapBuffer, cmapBuffer.getInt(8), null);
} // For Unicode Variation Sequences if (cmap != null && zero5 != 0) {
cmap.createUVS(cmapBuffer, zero5);
} return cmap;
}
/* speed up the converting by setting the range for double *bytecharacters;
*/ staticchar[] getConverter(short encodingID) { int dBegin = 0x8000; int dEnd = 0xffff;
String encoding;
// ensure single byte ascii for (int i = 0x20; i <= 0x7e; i++) {
convertedChars[i] = (char)i;
}
//sjis halfwidth katakana if (encodingID == ShiftJISEncoding) { for (int i = 0xa1; i <= 0xdf; i++) {
convertedChars[i] = (char)(i - 0xa1 + 0xff61);
}
}
/* It would save heap space (approx 60Kbytes for each of these *converters)ifstoredonlyvalidranges(iereturned *outputCharsdirectly.Butthisistrickysincewantto *includetheASCIIrangetoo.
*/ // System.err.println("oc.len="+outputChars.length); // System.err.println("cc.len="+convertedChars.length); // System.err.println("dbegin="+dBegin);
System.arraycopy(outputChars, 0, convertedChars, dBegin,
outputChars.length);
//return convertedChars; /* invert this map as now want it to map from Unicode *tootherencoding.
*/ char [] invertedChars = newchar[65536]; for (int i=0;i<65536;i++) { if (convertedChars[i] != noSuchChar) {
invertedChars[convertedChars[i]] = (char)i;
}
} return invertedChars;
/* *CMAPformat4definesseveralfieldsforoptimizedsearchof *thesegmentlist(entrySelector,searchRange,rangeShift). *However,benefitsarenegligibleandsomefontshaveincorrect *data-soweusestraightforwardbinarysearch(seebug6247425)
*/ int left = 0, right = startCount.length;
index = startCount.length >> 1; while (left < right) { if (endCount[index] < charCode) {
left = index + 1;
} else {
right = index;
}
index = (left + right) >> 1;
}
if (charCode >= startCount[index] && charCode <= endCount[index]) { int rangeOffset = idRangeOffset[index];
if (rangeOffset == 0) {
glyphCode = (char)(charCode + idDelta[index]);
} else { /* Calculate an index into the glyphIds array */
/* skip 6 bytes of format, length, and version */ int len = buffer.getChar(offset+2);
cmap = newbyte[len-6];
buffer.position(offset+6);
buffer.get(cmap);
}
// Format 8: mixed 16-bit and 32-bit coverage // Seems unlikely this code will ever get tested as we look for // MS platform Cmaps and MS states (in the Opentype spec on their website) // that MS doesn't support this format staticclass CMapFormat8 extends CMap { byte[] is32 = newbyte[8192]; int nGroups; int[] startCharCode; int[] endCharCode; int[] startGlyphID;
CMapFormat8(ByteBuffer bbuffer, int offset, char[] xlat) {
bbuffer.position(12);
bbuffer.get(is32);
nGroups = bbuffer.getInt() & INTMASK; // A map group record is three uint32's making for 12 bytes total if (bbuffer.remaining() < (12 * (long)nGroups)) { thrownew RuntimeException("Format 8 table exceeded");
}
startCharCode = newint[nGroups];
endCharCode = newint[nGroups];
startGlyphID = newint[nGroups];
}
char getGlyph(int charCode) { if (xlat != null) { thrownew RuntimeException("xlat array for cmap fmt=8");
} return0;
}
}
// Format 4-byte 10: Trimmed table mapping // Seems unlikely this code will ever get tested as we look for // MS platform Cmaps and MS states (in the Opentype spec on their website) // that MS doesn't support this format staticclass CMapFormat10 extends CMap {
long firstCode; int entryCount; char[] glyphIdArray;
CMapFormat10(ByteBuffer bbuffer, int offset, char[] xlat) {
bbuffer.position(offset+12);
firstCode = bbuffer.getInt() & INTMASK;
entryCount = bbuffer.getInt() & INTMASK; // each glyph is a uint16, so 2 bytes per value. if (bbuffer.remaining() < (2 * (long)entryCount)) { thrownew RuntimeException("Format 10 table exceeded");
}
CharBuffer buffer = bbuffer.asCharBuffer();
glyphIdArray = newchar[entryCount]; for (int i=0; i< entryCount; i++) {
glyphIdArray[i] = buffer.get();
}
}
char getGlyph(int charCode) {
if (xlat != null) { thrownew RuntimeException("xlat array for cmap fmt=10");
}
UVS(ByteBuffer buffer, int offset) {
buffer.position(offset+6);
numSelectors = buffer.getInt() & INTMASK; // A variation selector record is one 3 byte int + two int32's // making for 11 bytes per record. if (buffer.remaining() < (11 * (long)numSelectors)) { thrownew RuntimeException("Variations exceed buffer");
}
selector = newint[numSelectors];
numUVSMapping = newint[numSelectors];
unicodeValue = newint[numSelectors][];
glyphID = newchar[numSelectors][];
for (int i = 0; i < numSelectors; i++) {
buffer.position(offset + 10 + i * 11);
selector[i] = (buffer.get() & 0xff) << 16; //UINT24
selector[i] += (buffer.get() & 0xff) << 8;
selector[i] += buffer.get() & 0xff;
//skip Default UVS Table
//for Non-Default UVS Table int tableOffset = buffer.getInt(offset + 10 + i * 11 + 7); if (tableOffset == 0) {
numUVSMapping[i] = 0;
} elseif (tableOffset > 0) {
buffer.position(offset+tableOffset);
numUVSMapping[i] = buffer.getInt() & INTMASK; // a UVS mapping record is one 3 byte int + uint16 // making for 5 bytes per record. if (buffer.remaining() < (5 * (long)numUVSMapping[i])) { thrownew RuntimeException("Variations exceed buffer");
}
unicodeValue[i] = newint[numUVSMapping[i]];
glyphID[i] = newchar[numUVSMapping[i]];
staticfinalint VS_NOGLYPH = 0; privateint getGlyph(int charCode, int variationSelector) { int targetSelector = -1; for (int i = 0; i < numSelectors; i++) { if (selector[i] == variationSelector) {
targetSelector = i; break;
}
} if (targetSelector == -1) { return VS_NOGLYPH;
} if (numUVSMapping[targetSelector] > 0) { int index = java.util.Arrays.binarySearch(
unicodeValue[targetSelector], charCode); if (index >= 0) { return glyphID[targetSelector][index];
}
} return VS_NOGLYPH;
}
}
char getVariationGlyph(int charCode, int variationSelector) { char glyph = 0; if (uvs == null) {
glyph = getGlyph(charCode);
} else { int result = uvs.getGlyph(charCode, variationSelector); if (result > 0) {
glyph = (char)(result & 0xFFFF);
} else {
glyph = getGlyph(charCode);
}
} return glyph;
}
}
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.30Bemerkung:
(vorverarbeitet am 2026-06-11)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.