public eblcGlyphList(TTFFile file, bitmapSizeTable size) { this.file = file; this.entry = file.tables["EBLC"]; this.size = size; this.InitComponents(); }
public eblcSizeTreeNode(TTFFile file, TableDirectoryEntry entry, bitmapSizeTable size) : base(size.ppemX.ToString() + "×" + size.ppemY.ToString()) { this.file = file; this.entry = entry; this.size = size; }
public unsafe void SetStrike(TTFFile file, TableDirectoryEntry entry, bitmapSizeTable size) { this.file = file; this.entry = entry; this.size = size; this.horiLineMetrics.SetLineMetrics(size.hori); this.vertLineMetrics.SetLineMetrics(size.vert); // set text to labels this.lStartGlyphIndex.Text = "0x" + ((uint)this.size.startGlyphIndex).ToString("X4"); this.lEndGlyphIndex.Text = "0x" + ((uint)this.size.endGlyphIndex).ToString("X4"); this.lPpemX.Text = this.size.ppemX.ToString(); this.lPpemY.Text = this.size.ppemY.ToString(); this.lBitDepth.Text = this.size.bitDepth.ToString(); this.lColorRef.Text = "0x" + ((uint)this.size.colorRef).ToString("X8"); this.pictColorRef.BackColor = System.Drawing.Color.FromArgb((int)(uint)this.size.colorRef); this.chkHoriLayout.Checked = this.size.HorizontalLayout; this.chkVertLayout.Checked = this.size.VerticalLayout; // indexSubTableArray this.listView1.Items.Clear(); fixed(byte *pImg = &this.file.image[0]) { indexSubTableArray *subtableAB = (indexSubTableArray *)(pImg + (uint)entry.offset + (uint)size.indexSubTableArrayOffset); indexSubTableArray *subtableAM = subtableAB + (uint)size.numberOfIndexSubTables; indexSubTableArray *subtableA = subtableAB; indexSubHeader * subheader; while (subtableA < subtableAM) { subheader = (indexSubHeader *)((byte *)subtableAB + (uint)subtableA->additionalOffsetToIndexSubTable); string[] items = new string[] { string.Format("{0:X4} - {1:X4}", (ushort)subtableA->firstGlyphIndex, (ushort)subtableA->lastGlyphIndex) , subheader->IndexFormatString , subheader->ImageFormatString , subheader->NumberOfGlyph(*subtableA).ToString() }; this.listView1.Items.Add(new System.Windows.Forms.ListViewItem(items)); subtableA++; } } }
/************************ * public methods */ public bool Validate(Validator v, OTFontVal fontOwner) { bool bRet = true; bool bNumSizesOkay = true; Table_EBDT EBDTTable = (Table_EBDT)fontOwner.GetTable("EBDT"); if (v.PerformTest(T.EBLC_version)) { if (version.GetUint() == 0x00020000) { v.Pass(T.EBLC_version, P.EBLC_P_version, m_tag); } else { v.Error(T.EBLC_version, E.EBLC_E_version, m_tag, "version = 0x" + version.GetUint().ToString("x8") + ", unable to continue validation"); return(false); } } if (v.PerformTest(T.EBLC_numSizes)) { if (numSizes < (m_bufTable.GetLength() / 48)) { v.Pass(T.EBLC_numSizes, P.EBLC_P_numSizes, m_tag); } else { v.Error(T.EBLC_numSizes, E.EBLC_E_numSizes, m_tag, "0x" + numSizes.ToString("x8")); bNumSizesOkay = false; bRet = false; } } if (v.PerformTest(T.EBLC_TableDependency)) { if (EBDTTable != null) { v.Pass(T.EBLC_TableDependency, P.EBLC_P_TableDependency, m_tag); } else { v.Error(T.EBLC_TableDependency, E.EBLC_E_TableDependency, m_tag); bRet = false; } } if (v.PerformTest(T.EBLC_indexSubTableArrayOffset) && bNumSizesOkay == true) { bool bOffsetsOk = true; bool bIndicesOk = true; uint SmallestPossibleOffset = 8 + numSizes * 48; // sizeof header + sizeof bitmapSizeTAbles for (uint i = 0; i < numSizes; i++) { bitmapSizeTable bst = GetBitmapSizeTable(i); // start must be less than or equal to end if (bst.startGlyphIndex > bst.endGlyphIndex) { string s = "index = " + i + ", start index = " + bst.startGlyphIndex + ", stop index = " + bst.endGlyphIndex; v.Error(T.EBLC_SizeTableIndexOrder, E.EBLC_E_BitmapSizeTableIndexOrder, m_tag, s); bIndicesOk = false; bRet = false; } if (bst.indexSubTableArrayOffset < SmallestPossibleOffset || bst.indexSubTableArrayOffset + bst.indexTablesSize > GetLength()) { string s = "index = " + i + ", indexSubTableArrayOffset = " + bst.indexSubTableArrayOffset + ", indexTablesSize = " + bst.indexTablesSize; v.Error(T.EBLC_indexSubTableArrayOffset, E.EBLC_E_indexSubTableArrayOffset, m_tag, s); bOffsetsOk = false; bRet = false; } else { indexSubTableArray[] ista = GetIndexSubTableArray(bst); for (uint j = 0; j < bst.numberOfIndexSubTables; j++) { // first must be less than or equal to last if (ista[j].firstGlyphIndex > ista[j].lastGlyphIndex) { } // subtable indices must be within size table range if (ista[j].firstGlyphIndex <bst.startGlyphIndex || ista[j].lastGlyphIndex> bst.endGlyphIndex) { } } } } if (bOffsetsOk) { v.Pass(T.EBLC_indexSubTableArrayOffset, P.EBLC_P_indexSubTableArrayOffset, m_tag); } if (bIndicesOk) { v.Pass(T.EBLC_SizeTableIndexOrder, P.EBLC_P_BitmapSizeTableIndexOrder, m_tag); } } if (v.PerformTest(T.EBLC_bitDepth) && bNumSizesOkay == true) { bool bBitDepthOk = true; for (uint i = 0; i < numSizes; i++) { bitmapSizeTable bst = GetBitmapSizeTable(i); if (bst.bitDepth != 1 && bst.bitDepth != 2 && bst.bitDepth != 4 && bst.bitDepth != 8) { string s = "index = " + i + ", bitDepth = " + bst.bitDepth; v.Error(T.EBLC_bitDepth, E.EBLC_E_bitDepth, m_tag, s); bBitDepthOk = false; bRet = false; } } if (bBitDepthOk) { v.Pass(T.EBLC_bitDepth, P.EBLC_P_bitDepth, m_tag); } } if (v.PerformTest(T.EBLC_indexSubTables) && bNumSizesOkay == true) { for (uint i = 0; i < numSizes; i++) { bitmapSizeTable bst = GetBitmapSizeTable(i); string sSize = "bitmapsize[" + i + "], ppemX=" + bst.ppemX + ", ppemY=" + bst.ppemY; indexSubTableArray[] ista = GetIndexSubTableArray(bst); for (uint j = 0; j < bst.numberOfIndexSubTables; j++) { indexSubTable ist = bst.GetIndexSubTable(ista[j]); string sID = sSize + ", indexSubTable[" + j + "](fmt " + ist.header.indexFormat + ")"; if (!Validate_indexSubTable(v, ist, ista[j], sID, fontOwner)) { bRet = false; } } } } return(bRet); }
public indexSubTableArray[] GetIndexSubTableArray(bitmapSizeTable bst) { indexSubTableArray[] ista = null; if (bst.indexSubTableArrayOffset < m_bufTable.GetLength()) { ista = new indexSubTableArray[bst.numberOfIndexSubTables]; for (uint i=0; i<bst.numberOfIndexSubTables; i++) { ista[i] = GetIndexSubTableArray(bst, i); } } return ista; }
public indexSubTableArray GetIndexSubTableArray(bitmapSizeTable bst, uint i) { indexSubTableArray ista = null; if (bst.indexSubTableArrayOffset < m_bufTable.GetLength()) { uint istaOffset = bst.indexSubTableArrayOffset + i*8; if (istaOffset + indexSubTableArray.bufSize <= m_bufTable.GetLength()) { ista = new indexSubTableArray(istaOffset, m_bufTable); } } return ista; }
public bitmapSizeTable GetBitmapSizeTable(uint i) { bitmapSizeTable bst = null; if (i < numSizes) { uint bstOffset = (uint)FieldOffsets.FirstbitmapSizeTable + i*48; bst = new bitmapSizeTable(bstOffset, m_bufTable); } return bst; }
private indexSubTableCache getEBLCIndexSubTable( Table_EBLC OwnerTable, bitmapSizeTable bst, indexSubTableArray ista ) { indexSubTable ist = bst.GetIndexSubTable(ista); Table_EBDT tableEDBT = OwnerTable.getTableEDBT(); indexSubTableCache istc = null; switch( ist.header.indexFormat ) { case 1: { ArrayList cImageCache = new ArrayList(); for( uint i = ista.firstGlyphIndex; i <= ista.lastGlyphIndex; i++ ) { cImageCache.Add( getEBDTImageFormat( tableEDBT, ist, i, ista.firstGlyphIndex )); } istc = new indexSubTableCache1( ist.header.indexFormat, ist.header.imageFormat, cImageCache ); break; } case 2: { ArrayList cImageCache = new ArrayList(); for( uint i = ista.firstGlyphIndex; i <= ista.lastGlyphIndex; i++ ) { cImageCache.Add( getEBDTImageFormat( tableEDBT, ist, i, ista.firstGlyphIndex )); } uint nImageSize = ((indexSubTable2)ist).imageSize; Table_EBDT.bigGlyphMetrics bgm = ((indexSubTable2)ist).bigMetrics; istc = new indexSubTableCache2( ist.header.indexFormat, ist.header.imageFormat, cImageCache, nImageSize, bgm ); break; } case 3: { ArrayList cImageCache = new ArrayList(); for( uint i = ista.firstGlyphIndex; i <= ista.lastGlyphIndex; i++ ) { cImageCache.Add( getEBDTImageFormat( tableEDBT, ist, i, ista.firstGlyphIndex )); } istc = new indexSubTableCache3( ist.header.indexFormat, ist.header.imageFormat, cImageCache ); break; } case 4: { ArrayList cImageCache = new ArrayList(); ArrayList cGlyphCodes = new ArrayList(); for( uint i = 0; i < ((indexSubTable4)ist).numGlyphs; i++ ) { ushort nGlyphCode = ((indexSubTable4)ist).GetCodeOffsetPair( i ).glyphCode; cGlyphCodes.Add( nGlyphCode ); cImageCache.Add( getEBDTImageFormat( tableEDBT, ist, nGlyphCode, ista.firstGlyphIndex )); } istc = new indexSubTableCache4( ist.header.indexFormat, ist.header.imageFormat, cImageCache, cGlyphCodes ); break; } case 5: { ArrayList cImageCache = new ArrayList(); uint nImageSize = ((indexSubTable5)ist).imageSize; Table_EBDT.bigGlyphMetrics bgm = ((indexSubTable5)ist).bigMetrics; ArrayList cGlyphCodes = new ArrayList(); for( uint i = 0; i < ((indexSubTable5)ist).numGlyphs; i++ ) { ushort nGlyphCode = ((indexSubTable5)ist).GetGlyphCode( i ); cGlyphCodes.Add( nGlyphCode ); cImageCache.Add( getEBDTImageFormat( tableEDBT, ist, nGlyphCode, ista.firstGlyphIndex )); } istc = new indexSubTableCache5( ist.header.indexFormat, ist.header.imageFormat, cImageCache, nImageSize, bgm, cGlyphCodes ); break; } default: { Debug.Assert( false, "unsupported index format" ); break; } } return istc; }
public bitmapSizeTableCache( Table_EBLC OwnerTable, bitmapSizeTable bst ) { m_numberOfIndexSubTables = bst.numberOfIndexSubTables; m_indexSubTableArray = new ArrayList( (int)m_numberOfIndexSubTables ); indexSubTableArray[] ista = OwnerTable.GetIndexSubTableArray( bst ); for( int i = 0; i < m_numberOfIndexSubTables; i++ ) { indexSubTableCache istc = getEBLCIndexSubTable( OwnerTable, bst, ista[i] ); indexSubTableArrayCache istac = new indexSubTableArrayCache( ista[i].firstGlyphIndex, ista[i].lastGlyphIndex, istc ); m_indexSubTableArray.Add( istac ); indexSubTable ic = bst.GetIndexSubTable(ista[i]); //ista[i].additionalOffsetToIndexSubtable += bst.indexSubTableArrayOffset; } m_colorRef = bst.colorRef; hori = sbitLineMetricsCache.FromSbitLineMetrics(bst.hori); vert = sbitLineMetricsCache.FromSbitLineMetrics(bst.vert); m_startGlyphIndex = bst.startGlyphIndex; m_endGlyphIndex = bst.endGlyphIndex; ppemX = bst.ppemX; ppemY = bst.ppemY; bitDepth = bst.bitDepth; flags = bst.flags; }
public eblcSizeControl(TTFFile file, TableDirectoryEntry entry, bitmapSizeTable size) : this() { this.SetStrike(file, entry, size); }