public object Clone() { ebdtComponent ec = new ebdtComponent(); ec.glyphCode = glyphCode; ec.xOffset = xOffset; ec.yOffset = yOffset; return(ec); }
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 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 object Clone() { ebdtComponent ec = new ebdtComponent(); ec.glyphCode = glyphCode; ec.xOffset = xOffset; ec.yOffset = yOffset; return ec; }
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); }