public void setFontData(sbyte[] data) { if (data == null) { this.m_textDirection = 0; this.m_lineDirection = 0; this.m_leading = 0; this.m_ascent = 0; this.m_descent = 0; this.m_spaceSpace = 0; this.m_charSpace = 0; this.m_numChars = 0; this.m_numGlyphs = 0; this.m_utfCodeArray = new ushort[0]; this.m_charDataOffsetArray = new ushort[0]; this.m_charData = new sbyte[0]; this.m_ISOOffsetMap = new ushort[0]; } else { DataInputStream dataInputStream1 = new DataInputStream((InputStream) new ByteArrayInputStream(data, 12)); int num = (int)dataInputStream1.readByte(); this.m_textDirection = (int)dataInputStream1.readByte(); this.m_lineDirection = (int)dataInputStream1.readByte(); this.m_leading = (int)dataInputStream1.readByte(); this.m_ascent = (int)dataInputStream1.readByte(); this.m_descent = (int)dataInputStream1.readByte(); this.m_spaceSpace = (int)dataInputStream1.readByte(); this.m_charSpace = (int)dataInputStream1.readByte(); this.m_numChars = (int)dataInputStream1.readShort(); this.m_numGlyphs = (int)dataInputStream1.readShort(); dataInputStream1.close(); this.m_utfCodeArray = new ushort[this.m_numChars]; this.m_charDataOffsetArray = new ushort[this.m_numChars + 1]; this.m_charData = new sbyte[2 * this.m_numChars + 6 * this.m_numGlyphs]; int bufLength = 12 + (this.m_utfCodeArray.Length + this.m_charDataOffsetArray.Length) * 2 + this.m_charData.Length; DataInputStream dataInputStream2 = new DataInputStream((InputStream) new ByteArrayInputStream(data, bufLength)); dataInputStream2.skip(12L); for (int index = 0; index != this.m_numChars; ++index) { this.m_utfCodeArray[index] = (ushort)dataInputStream2.readShort(); } for (int index = 0; index != this.m_numChars; ++index) { this.m_charDataOffsetArray[index] = (ushort)dataInputStream2.readShort(); } this.m_charDataOffsetArray[this.m_numChars] = ushort.MaxValue; for (int index = 0; index != this.m_charData.Length; ++index) { this.m_charData[index] = dataInputStream2.readByte(); } dataInputStream2.close(); this.setTransform(this.m_transform); this.m_ISOOffsetMap = new ushort[256]; for (int index = 0; index != 128; ++index) { this.m_ISOOffsetMap[index] = (ushort)SDKTextUtils.getCodePos(this.m_utfCodeArray, (ushort)index, this.m_numChars); } } }
public void refreshISOOffsets() { for (int index = 128; index != 256; ++index) { this.m_ISOOffsetMap[index] = (ushort)SDKTextUtils.getCodePos(this.m_utfCodeArray, SDKTextUtils.iso2utf((ushort)index), this.m_numChars); } this.m_isoCodeIndex = SDKTextUtils.getCurrentEncoding(); }
private static int getCodePos( ushort[] codeArray, ushort code, int startIndex, int endIndex, int codeArrayLength) { if (startIndex > endIndex) { return(codeArrayLength); } int index = startIndex + endIndex >> 1; ushort code1 = codeArray[index]; if ((int)code == (int)code1) { return(index); } return((int)code < (int)code1 ? SDKTextUtils.getCodePos(codeArray, code, startIndex, index - 1, codeArrayLength) : SDKTextUtils.getCodePos(codeArray, code, index + 1, endIndex, codeArrayLength)); }
public ushort getUTFCharOffset(ushort code) { return(this.m_charDataOffsetArray[SDKTextUtils.getCodePos(this.m_utfCodeArray, code, this.m_numChars)]); }
public static int getCodePos(ushort[] codeArray, ushort code, int codeArrayLength) { return(SDKTextUtils.getCodePos(codeArray, code, 0, codeArrayLength - 1, codeArrayLength)); }
public static ushort utf2iso(ushort code) { return((ushort)(SDKTextUtils.getCodePos(SDKTextUtils.s_charMapISO, code, 128) + 128)); }