public ushort GetNumComponents(Table_EBLC.indexSubTable cIndexSubTable, uint nGlyphIndex, uint nStartGlyphIndex) { ushort nNumComponents = 0; int nIndexFormat = cIndexSubTable.header.indexFormat; int nImageFormat = cIndexSubTable.header.imageFormat; Debug.Assert(nImageFormat == 8 || nImageFormat == 9); // These images all have the same metrics as described in the indexSubTable so should have the proper image format // Debug.Assert( nIndexFormat != 2 && nIndexFormat != 5 ); // commented out the above assert because batang.ttc violates this too much if (nImageFormat == 8 || nImageFormat == 9) { if (nGlyphIndex >= nStartGlyphIndex) { uint nImageFormatOffset = getImageFormatOffset(cIndexSubTable, nGlyphIndex, nStartGlyphIndex); if (nImageFormatOffset != 0) { if (nImageFormat == 8) { nNumComponents = m_bufTable.GetUshort((uint)(nImageFormatOffset + smallGlyphMetrics.bufSize + 1)); } else // nImageFormat = 9 { nNumComponents = m_bufTable.GetUshort((uint)(nImageFormatOffset + bigGlyphMetrics.bufSize)); } } } } return(nNumComponents); }
public smallGlyphMetrics GetSmallMetrics(Table_EBLC.indexSubTable cIndexSubTable, uint nGlyphIndex, uint nStartGlyphIndex) { smallGlyphMetrics sgm = null; int nIndexFormat = cIndexSubTable.header.indexFormat; int nImageFormat = cIndexSubTable.header.imageFormat; Debug.Assert(nImageFormat == 1 || nImageFormat == 2 || nImageFormat == 8); // These images all have the same metrics as described in the indexSubTable so should have the proper image format // Debug.Assert( nIndexFormat != 2 && nIndexFormat != 5 ); // commented out the above assert because batang.ttc violates this too much if (nImageFormat == 1 || nImageFormat == 2 || nImageFormat == 8) { if (nGlyphIndex >= nStartGlyphIndex) { //EBDT table starts off with a version data so it would never be possible for this to be set to 0 uint nImageFormatOffset = getImageFormatOffset(cIndexSubTable, nGlyphIndex, nStartGlyphIndex); if (nImageFormatOffset != 0) { // All of the supported image formats start with this data first sgm = new smallGlyphMetrics(); sgm.height = m_bufTable.GetByte(nImageFormatOffset + (uint)smallGlyphMetrics.FieldOffsets.height); sgm.width = m_bufTable.GetByte(nImageFormatOffset + (uint)smallGlyphMetrics.FieldOffsets.width); sgm.BearingX = m_bufTable.GetSbyte(nImageFormatOffset + (uint)smallGlyphMetrics.FieldOffsets.BearingX); sgm.BearingY = m_bufTable.GetSbyte(nImageFormatOffset + (uint)smallGlyphMetrics.FieldOffsets.BearingY); sgm.Advance = m_bufTable.GetByte(nImageFormatOffset + (uint)smallGlyphMetrics.FieldOffsets.Advance); } } } return(sgm); }
public bool Validate_Format7(Validator v, string sIdentity, Table_EBLC.indexSubTable ist) { bool bOk = true; Table_EBLC.indexSubTableArray ista = ist.GetIndexSubTableArray(); for (ushort idGlyph = ista.firstGlyphIndex; idGlyph <= ista.lastGlyphIndex; idGlyph++) { // validate big metrics bigGlyphMetrics bgm = GetBigMetrics(ist, idGlyph, ista.firstGlyphIndex); if (bgm != null) { bigGlyphMetrics_val bgm_val = bigGlyphMetrics_val.CreateFromBigGlyphMetrics(bgm); if (!bgm_val.Validate(v, sIdentity + ", idGlyph=" + idGlyph, this)) { bOk = false; } // validate image data // - this is just bitmap data, any values should be valid } } return(bOk); }
public bool Validate_Format2(Validator v, string sIdentity, Table_EBLC.indexSubTable ist) { bool bOk = true; Table_EBLC.indexSubTableArray ista = ist.GetIndexSubTableArray(); for (ushort idGlyph = ista.firstGlyphIndex; idGlyph <= ista.lastGlyphIndex; idGlyph++) { // validate small metrics smallGlyphMetrics sgm = null; try { sgm = GetSmallMetrics(ist, idGlyph, ista.firstGlyphIndex); } catch (Exception e) { v.ApplicationError(T.EBDT_GlyphImageData, E._Table_E_Exception, m_tag, "EBDT.Format2: " + e.Message); bOk = false; return(bOk); } if (sgm != null) { smallGlyphMetrics_val sgm_val = smallGlyphMetrics_val.CreateFromSmallGlyphMetrics(sgm); if (!sgm_val.Validate(v, sIdentity + ", idGlyph=" + idGlyph, this)) { bOk = false; } // validate image data // - this is just bitmap data, any values should be valid } } return(bOk); }
private uint getImageFormatOffset(Table_EBLC.indexSubTable cIndexSubTable, uint nGlyphIndex, uint nStartGlyphIndex) { int nIndexFormat = cIndexSubTable.header.indexFormat; uint nGlyphImageDataOffset = 0; switch (nIndexFormat) { case 1: { nGlyphImageDataOffset = cIndexSubTable.header.imageDataOffset + ((Table_EBLC.indexSubTable1)cIndexSubTable).GetOffset((uint)(nGlyphIndex - nStartGlyphIndex)); break; } case 2: { nGlyphImageDataOffset = cIndexSubTable.header.imageDataOffset + 4 + bigGlyphMetrics.bufSize; nGlyphImageDataOffset += (uint)(((Table_EBLC.indexSubTable2)cIndexSubTable).imageSize * (nGlyphIndex - nStartGlyphIndex)); break; } case 3: { nGlyphImageDataOffset = cIndexSubTable.header.imageDataOffset + ((Table_EBLC.indexSubTable3)cIndexSubTable).GetOffset((uint)(nGlyphIndex - nStartGlyphIndex)); break; } case 4: { Table_EBLC.indexSubTable4 ist = (Table_EBLC.indexSubTable4)cIndexSubTable; for (uint i = 0; i < ist.numGlyphs; i++) { if (ist.GetCodeOffsetPair(i).glyphCode == nGlyphIndex) { nGlyphImageDataOffset = ist.header.imageDataOffset + ist.GetCodeOffsetPair(i).offset; break; } } break; } case 5: { for (uint i = 0; i < ((Table_EBLC.indexSubTable5)cIndexSubTable).numGlyphs; i++) { if (((Table_EBLC.indexSubTable5)cIndexSubTable).GetGlyphCode(i) == nGlyphIndex) { nGlyphImageDataOffset = cIndexSubTable.header.imageDataOffset + 4 + bigGlyphMetrics.bufSize + 4; nGlyphImageDataOffset += (uint)(((Table_EBLC.indexSubTable5)cIndexSubTable).numGlyphs * 2); nGlyphImageDataOffset += (uint)(i * ((Table_EBLC.indexSubTable5)cIndexSubTable).imageSize); break; } } break; } } return(nGlyphImageDataOffset); }
public bool Validate_Format4(Validator v, string sIdentity, Table_EBLC.indexSubTable ist) { bool bOk = true; // this format is not supported! // - however the image format number is actually stored in the EBLC table // - and so any errors should get reported there return(bOk); }
public uint getImageLength(Table_EBLC.indexSubTable cIndexSubTable, uint nGlyphIndex, uint nStartGlyphIndex, uint nImageOffset) { int nIndexFormat = cIndexSubTable.header.indexFormat; uint nImageLength = 0; switch (nIndexFormat) { case 1: { nImageLength = cIndexSubTable.header.imageDataOffset + ((Table_EBLC.indexSubTable1)cIndexSubTable).GetOffset((uint)((nGlyphIndex + 1) - nStartGlyphIndex)); nImageLength -= nImageOffset; break; } case 2: { nImageLength = ((Table_EBLC.indexSubTable2)cIndexSubTable).imageSize; break; } case 3: { nImageLength = cIndexSubTable.header.imageDataOffset + ((Table_EBLC.indexSubTable3)cIndexSubTable).GetOffset((uint)((nGlyphIndex + 1) - nStartGlyphIndex)); nImageLength -= nImageOffset; break; } case 4: { Table_EBLC.indexSubTable4 ist = (Table_EBLC.indexSubTable4)cIndexSubTable; for (uint i = 0; i < ist.numGlyphs; i++) { if (ist.GetCodeOffsetPair(i).glyphCode == nGlyphIndex) { nImageLength = ist.header.imageDataOffset + ist.GetCodeOffsetPair(i + 1).offset; nImageLength -= nImageOffset; } } break; } case 5: { nImageLength = ((Table_EBLC.indexSubTable5)cIndexSubTable).imageSize; break; } } return(nImageLength); }
public bool Validate_Format5(Validator v, string sIdentity, Table_EBLC.indexSubTable ist) { bool bOk = true; Table_EBLC.indexSubTableArray ista = ist.GetIndexSubTableArray(); for (ushort idGlyph = ista.firstGlyphIndex; idGlyph <= ista.lastGlyphIndex; idGlyph++) { // no metrics in format 5 // validate image data // - this is just bitmap data, any values should be valid } return(bOk); }
protected byte[,] DecodeImageData(Table_EBLC.indexSubTable ist, byte width, byte height, byte bitDepth, byte[] databuf) { byte [,] bits = null; switch (ist.header.imageFormat) { case 0: throw new ApplicationException("illegal image format: 0"); //break; case 1: bits = DecodeImageDataFmt16(width, height, bitDepth, databuf); break; case 2: bits = DecodeImageDataFmt257(width, height, bitDepth, databuf); break; case 3: throw new ApplicationException("illegal image format: 3"); //break; case 4: throw new ApplicationException("illegal image format: 4"); //break; case 5: bits = DecodeImageDataFmt257(width, height, bitDepth, databuf); break; case 6: bits = DecodeImageDataFmt16(width, height, bitDepth, databuf); break; case 7: bits = DecodeImageDataFmt257(width, height, bitDepth, databuf); break; default: break; } return(bits); }
public byte[] GetImageData(Table_EBLC.indexSubTable cIndexSubTable, uint nGlyphIndex, uint nStartGlyphIndex) { int nIndexFormat = cIndexSubTable.header.indexFormat; int nImageFormat = cIndexSubTable.header.imageFormat; byte[] bufImageData = null; // 8 and 9 are composites so their image data should be retrieved through the composite glyphs Debug.Assert(nImageFormat != 8 && nImageFormat != 9); if (nGlyphIndex >= nStartGlyphIndex) { uint nImageFormatOffset = getImageFormatOffset(cIndexSubTable, nGlyphIndex, nStartGlyphIndex); if (nImageFormatOffset > 0) { uint nImageLength = 0; if (nImageFormat == 1 || nImageFormat == 2) { nImageFormatOffset += smallGlyphMetrics.bufSize; } else if (nImageFormat == 5) { } else if (nImageFormat == 6 || nImageFormat == 7) { nImageFormatOffset += bigGlyphMetrics.bufSize; } nImageLength = getImageLength(cIndexSubTable, nGlyphIndex, nStartGlyphIndex, nImageFormatOffset); if (nImageLength > 0) { bufImageData = new byte[nImageLength]; System.Buffer.BlockCopy(m_bufTable.GetBuffer(), (int)nImageFormatOffset, bufImageData, 0, (int)nImageLength); } } } return(bufImageData); }
public bigGlyphMetrics GetBigMetrics(Table_EBLC.indexSubTable cIndexSubTable, uint nGlyphIndex, uint nStartGlyphIndex) { bigGlyphMetrics bgm = null; int nIndexFormat = cIndexSubTable.header.indexFormat; int nImageFormat = cIndexSubTable.header.imageFormat; Debug.Assert(nImageFormat == 6 || nImageFormat == 7 || nImageFormat == 9); // These images all have the same metrics as described in the indexSubTable so should have the proper image format //Debug.Assert( nIndexFormat != 2 && nIndexFormat != 5 ); if (nImageFormat == 6 || nImageFormat == 7 || nImageFormat == 9) { if (nGlyphIndex >= nStartGlyphIndex) { try { uint nImageFormatOffset = getImageFormatOffset(cIndexSubTable, nGlyphIndex, nStartGlyphIndex); if (nImageFormatOffset != 0 && nImageFormatOffset + bigGlyphMetrics.bufSize <= m_bufTable.GetLength()) { // All of the supported image formats start with this data first bgm = new bigGlyphMetrics(); bgm.height = m_bufTable.GetByte(nImageFormatOffset + (uint)bigGlyphMetrics.FieldOffsets.height); bgm.width = m_bufTable.GetByte(nImageFormatOffset + (uint)bigGlyphMetrics.FieldOffsets.width); bgm.horiBearingX = m_bufTable.GetSbyte(nImageFormatOffset + (uint)bigGlyphMetrics.FieldOffsets.horiBearingX); bgm.horiBearingY = m_bufTable.GetSbyte(nImageFormatOffset + (uint)bigGlyphMetrics.FieldOffsets.horiBearingY); bgm.horiAdvance = m_bufTable.GetByte(nImageFormatOffset + (uint)bigGlyphMetrics.FieldOffsets.horiAdvance); bgm.vertBearingX = m_bufTable.GetSbyte(nImageFormatOffset + (uint)bigGlyphMetrics.FieldOffsets.vertBearingX); bgm.vertBearingY = m_bufTable.GetSbyte(nImageFormatOffset + (uint)bigGlyphMetrics.FieldOffsets.vertBearingY); bgm.vertAdvance = m_bufTable.GetByte(nImageFormatOffset + (uint)bigGlyphMetrics.FieldOffsets.vertAdvance); } } catch (Exception) { bgm = null; } } } return(bgm); }
public ebdtComponent GetComponent(Table_EBLC.indexSubTable cIndexSubTable, uint nGlyphIndex, uint nStartGlyphIndex, uint nComponent) { ebdtComponent ebdtc = null; int nIndexFormat = cIndexSubTable.header.indexFormat; int nImageFormat = cIndexSubTable.header.imageFormat; Debug.Assert(nIndexFormat != 2 && nIndexFormat != 5); // These images all have the same metrics as described in the indexSubTable so should have the proper image format Debug.Assert(nIndexFormat != 3 && nIndexFormat != 5); if (nImageFormat == 8 || nImageFormat == 9) { if (nGlyphIndex >= nStartGlyphIndex) { uint nImageFormatOffset = getImageFormatOffset(cIndexSubTable, nGlyphIndex, nStartGlyphIndex); if (nImageFormatOffset != 0) { ebdtc = new ebdtComponent(); if (nImageFormat == 8) { nImageFormatOffset += smallGlyphMetrics.bufSize + 3 + (nComponent * ebdtComponent.bufSize); } else // nImageFormat = 9 { nImageFormatOffset += smallGlyphMetrics.bufSize + 2 + (nComponent * ebdtComponent.bufSize); } ebdtc.glyphCode = m_bufTable.GetUshort(nImageFormatOffset + (uint)ebdtComponent.FieldOffsets.glyphCode); ebdtc.xOffset = m_bufTable.GetSbyte(nImageFormatOffset + (uint)ebdtComponent.FieldOffsets.xOffset); ebdtc.yOffset = m_bufTable.GetSbyte(nImageFormatOffset + (uint)ebdtComponent.FieldOffsets.yOffset); } } } return(ebdtc); }
public byte [,] GetBitmapImage(Table_EBLC.bitmapSizeTable bst, ushort glyphID) { byte [,] bits = null; Table_EBLC.indexSubTableArray ista = bst.FindIndexSubTableArray(glyphID); if (ista != null) { Table_EBLC.indexSubTable ist = bst.GetIndexSubTable(ista); if (ist.header.imageFormat < 8) { // simple bitmap byte [] encodedDataBuf = GetImageData(ist, glyphID, ista.firstGlyphIndex); byte width = 0, height = 0; switch (ist.header.imageFormat) { case 0: throw new ApplicationException("illegal image format: 0"); //break; case 1: case 2: smallGlyphMetrics sgm = this.GetSmallMetrics(ist, glyphID, ista.firstGlyphIndex); width = sgm.width; height = sgm.height; break; case 3: case 4: throw new ApplicationException("illegal image format: " + ist.header.imageFormat); //break; case 5: switch (ist.header.indexFormat) { case 2: Table_EBLC.indexSubTable2 ist2 = (Table_EBLC.indexSubTable2)ist; width = ist2.bigMetrics.width; height = ist2.bigMetrics.height; break; case 5: Table_EBLC.indexSubTable5 ist5 = (Table_EBLC.indexSubTable5)ist; width = ist5.bigMetrics.width; height = ist5.bigMetrics.height; break; } break; case 6: case 7: bigGlyphMetrics bgm = this.GetBigMetrics(ist, glyphID, ista.firstGlyphIndex); width = bgm.width; height = bgm.height; break; } if (encodedDataBuf != null) { bits = DecodeImageData(ist, width, height, bst.bitDepth, encodedDataBuf); } else { //Debug.Assert(false); } } else if (ist.header.imageFormat < 10) { // composite bitmap throw new ApplicationException("TODO: impelement bitmap composites"); } else { Debug.Assert(false, "illegal image format"); } } return(bits); }
/************************ * public methods */ public bool Validate(Validator v, OTFontVal fontOwner) { bool bRet = true; if (fontOwner.GetFile().IsCollection()) { if (fontOwner.GetFontIndexInFile() > 0) { // checksum not matching data is covered by check elsewhere. Assume they match. DirectoryEntry de_EBDT = fontOwner.GetDirectoryEntry("EBDT"); for (uint i = 0; i < fontOwner.GetFontIndexInFile(); i++) { if (fontOwner.GetFile().GetFont(i).GetDirectoryEntry("EBDT").checkSum == de_EBDT.checkSum) { v.Info(T.T_NULL, I.glyf_I_IDENTICAL_GLYF_TABLES_IN_TTC, m_tag); return(true); } } } } m_nCachedMaxpNumGlyphs = fontOwner.GetMaxpNumGlyphs(); if (v.PerformTest(T.EBDT_version)) { if (version.GetUint() == 0x00020000 || version.GetUint() == 0x00030000) { v.Pass(T.EBDT_version, P.EBDT_P_version, m_tag); } else { v.Error(T.EBDT_version, E.EBDT_E_version, m_tag, "version = 0x" + version.GetUint().ToString("x8") + ", unable to continue validation"); return(false); } } //TODO: check tag for EBDT v3, CBDT v2, bdat if (v.PerformTest(T.EBDT_TableDependency)) { Table_EBLC EBLCTable = (Table_EBLC)fontOwner.GetTable("EBLC"); if (EBLCTable != null) { v.Pass(T.EBDT_TableDependency, P.EBDT_P_TableDependency, m_tag); } else { v.Error(T.EBDT_TableDependency, E.EBDT_E_TableDependency, m_tag); bRet = false; } } // T.EBDT_GlyphImageData depends on T.EBDT_TableDependency passing. if (v.PerformTest(T.EBDT_GlyphImageData)) { bool bGlyphImageDataOk = true; Table_EBLC EBLCTable = (Table_EBLC)fontOwner.GetTable("EBLC"); if (EBLCTable == null) { return(bRet); //failed the last test, not going on. } // for each bitmap size for (uint i = 0; i < EBLCTable.numSizes; i++) { Table_EBLC.bitmapSizeTable bst = EBLCTable.GetBitmapSizeTable(i); string sSize = "bitmapsize[" + i + "], ppemX=" + bst.ppemX + ", ppemY=" + bst.ppemY; if (true) { for (uint j = 0; j < bst.numberOfIndexSubTables; j++) { Table_EBLC.indexSubTable ist = null; Table_EBLC.indexSubTableArray ista_j = EBLCTable.GetIndexSubTableArray(bst, j); if (ista_j != null) { ist = bst.GetIndexSubTable(ista_j); } if (ist != null) { string sID = sSize + ", indexSubTable[" + j + "](index fmt " + ist.header.indexFormat + ", image fmt " + ist.header.imageFormat + ")"; switch (ist.header.imageFormat) { case 1: if (!Validate_Format1(v, sID, ist)) { bGlyphImageDataOk = false; bRet = false; } break; case 2: if (!Validate_Format2(v, sID, ist)) { bGlyphImageDataOk = false; bRet = false; } break; case 3: if (!Validate_Format3(v, sID, ist)) { bGlyphImageDataOk = false; bRet = false; } break; case 4: if (!Validate_Format4(v, sID, ist)) { bGlyphImageDataOk = false; bRet = false; } break; case 5: if (!Validate_Format5(v, sID, ist)) { bGlyphImageDataOk = false; bRet = false; } break; case 6: if (!Validate_Format6(v, sID, ist)) { bGlyphImageDataOk = false; bRet = false; } break; case 7: if (!Validate_Format7(v, sID, ist)) { bGlyphImageDataOk = false; bRet = false; } break; case 8: if (!Validate_Format8(v, sID, ist)) { bGlyphImageDataOk = false; bRet = false; } break; case 9: if (!Validate_Format9(v, sID, ist)) { bGlyphImageDataOk = false; bRet = false; } break; case 17: if (version.GetUint() != 0x00030000) { bGlyphImageDataOk = false; bRet = false; } // TODO: adding 3 checks break; case 18: if (version.GetUint() != 0x00030000) { bGlyphImageDataOk = false; bRet = false; } // TODO: adding 3 checks break; case 19: if (version.GetUint() != 0x00030000) { bGlyphImageDataOk = false; bRet = false; } // TODO: adding 3 checks break; default: // TODO: emit Unknown break; } } } } } if (bGlyphImageDataOk) { v.Pass(T.EBDT_GlyphImageData, P.EBDT_P_GlyphImageData, m_tag); } } return(bRet); }
public bool Validate_Format9(Validator v, string sIdentity, Table_EBLC.indexSubTable ist) { bool bOk = true; Table_EBLC.indexSubTableArray ista = ist.GetIndexSubTableArray(); for (ushort idGlyph = ista.firstGlyphIndex; idGlyph <= ista.lastGlyphIndex; idGlyph++) { // validate big metrics bigGlyphMetrics bgm = GetBigMetrics(ist, idGlyph, ista.firstGlyphIndex); if (bgm != null) { bigGlyphMetrics_val bgm_val = bigGlyphMetrics_val.CreateFromBigGlyphMetrics(bgm); if (!bgm_val.Validate(v, sIdentity + ", idGlyph=" + idGlyph, this)) { bOk = false; } ushort numComponents = this.GetNumComponents(ist, idGlyph, ista.firstGlyphIndex); // validate component array for (uint i = 0; i < numComponents; i++) { ebdtComponent component = GetComponent(ist, idGlyph, ista.firstGlyphIndex, i); Debug.Assert(component != null); // validate the ebdtComponent // verify that the component's glyph code is less than maxp numGlyphs if (component.glyphCode >= m_nCachedMaxpNumGlyphs) { string sDetails = sIdentity + ", idGlyph=" + idGlyph + ", component[" + i + "].glyphCode=" + component.glyphCode + ", maxp.numGlyphs = " + m_nCachedMaxpNumGlyphs; v.Error(T.EBDT_GlyphImageData, E.EBDT_E_GlyphImageData, m_tag, sDetails); bOk = false; } // verify that the component's glyph code isn't 0, which should be reserved as the empty glyph // (technically, someone could use the empty glyph as a component, but it's more likely to be an error) if (component.glyphCode == 0) { string sDetails = sIdentity + ", idGlyph=" + idGlyph + ", component[" + i + "].glyphCode=" + component.glyphCode; v.Error(T.EBDT_GlyphImageData, E.EBDT_E_GlyphImageData, m_tag, sDetails); bOk = false; } // verify that the component's glyph code isn't the glyph code of its parent if (component.glyphCode == idGlyph) { string sDetails = sIdentity + ", idGlyph=" + idGlyph + ", component[" + i + "].glyphCode=" + component.glyphCode + " (glyph can't use itself as a component)"; v.Error(T.EBDT_GlyphImageData, E.EBDT_E_GlyphImageData, m_tag, sDetails); bOk = false; } } } } return(bOk); }
/************************ * public methods */ public bool Validate(Validator v, OTFontVal fontOwner) { bool bRet = true; m_nCachedMaxpNumGlyphs = fontOwner.GetMaxpNumGlyphs(); if (v.PerformTest(T.EBDT_version)) { if (version.GetUint() == 0x00020000) { v.Pass(T.EBDT_version, P.EBDT_P_version, m_tag); } else { v.Error(T.EBDT_version, E.EBDT_E_version, m_tag, "version = 0x" + version.GetUint().ToString("x8") + ", unable to continue validation"); return(false); } } if (v.PerformTest(T.EBDT_TableDependency)) { Table_EBLC EBLCTable = (Table_EBLC)fontOwner.GetTable("EBLC"); if (EBLCTable != null) { v.Pass(T.EBDT_TableDependency, P.EBDT_P_TableDependency, m_tag); } else { v.Error(T.EBDT_TableDependency, E.EBDT_E_TableDependency, m_tag); bRet = false; } } if (v.PerformTest(T.EBDT_GlyphImageData)) { bool bGlyphImageDataOk = true; Table_EBLC EBLCTable = (Table_EBLC)fontOwner.GetTable("EBLC"); // for each bitmap size for (uint i = 0; i < EBLCTable.numSizes; i++) { Table_EBLC.bitmapSizeTable bst = EBLCTable.GetBitmapSizeTable(i); string sSize = "bitmapsize[" + i + "], ppemX=" + bst.ppemX + ", ppemY=" + bst.ppemY; Table_EBLC.indexSubTableArray[] ista = EBLCTable.GetIndexSubTableArray(bst); if (ista != null) { for (uint j = 0; j < bst.numberOfIndexSubTables; j++) { Table_EBLC.indexSubTable ist = null; if (ista[j] != null) { ist = bst.GetIndexSubTable(ista[j]); } if (ist != null) { string sID = sSize + ", indexSubTable[" + j + "](index fmt " + ist.header.indexFormat + ", image fmt " + ist.header.imageFormat + ")"; switch (ist.header.imageFormat) { case 1: if (!Validate_Format1(v, sID, ist)) { bGlyphImageDataOk = false; bRet = false; } break; case 2: if (!Validate_Format2(v, sID, ist)) { bGlyphImageDataOk = false; bRet = false; } break; case 3: if (!Validate_Format3(v, sID, ist)) { bGlyphImageDataOk = false; bRet = false; } break; case 4: if (!Validate_Format4(v, sID, ist)) { bGlyphImageDataOk = false; bRet = false; } break; case 5: if (!Validate_Format5(v, sID, ist)) { bGlyphImageDataOk = false; bRet = false; } break; case 6: if (!Validate_Format6(v, sID, ist)) { bGlyphImageDataOk = false; bRet = false; } break; case 7: if (!Validate_Format7(v, sID, ist)) { bGlyphImageDataOk = false; bRet = false; } break; case 8: if (!Validate_Format8(v, sID, ist)) { bGlyphImageDataOk = false; bRet = false; } break; case 9: if (!Validate_Format9(v, sID, ist)) { bGlyphImageDataOk = false; bRet = false; } break; default: break; } } } } } if (bGlyphImageDataOk) { v.Pass(T.EBDT_GlyphImageData, P.EBDT_P_GlyphImageData, m_tag); } } return(bRet); }