public bool addBitmapScaleTable(bitmapScaleTable cBitmapScaleTable, uint nIndex) { bool bResult = true; if (cBitmapScaleTable == null) { bResult = false; throw new ArgumentNullException(); } else if (nIndex > m_numSizes) { bResult = false; throw new ArgumentOutOfRangeException("Index is greater than number of sizes."); } else { bitmapScaleTableCache bstc = bitmapScaleTableCache.FromBitmapScaleTable(cBitmapScaleTable); m_bitmapScaleTables.Insert((int)nIndex, bstc); m_bDirty = true; } return(bResult); }
static public bitmapScaleTableCache FromBitmapScaleTable(bitmapScaleTable bst) { bitmapScaleTableCache bstc = new bitmapScaleTableCache(); bstc.hori = Table_EBLC.EBLC_cache.sbitLineMetricsCache.FromSbitLineMetrics(bst.hori); bstc.vert = Table_EBLC.EBLC_cache.sbitLineMetricsCache.FromSbitLineMetrics(bst.vert); bstc.ppemX = bst.ppemX; bstc.ppemY = bst.ppemY; bstc.substitutePpemX = bst.substitutePpemX; bstc.substitutePpemY = bst.substitutePpemY; return(bstc); }
public bitmapScaleTable GetBitmapScaleTable(uint i) { bitmapScaleTable bst = null; if (i < numSizes) { uint bstOffset = (uint)FieldOffsets.FirstBitmapScaleTable + i * bitmapScaleTable.length; bst = new bitmapScaleTable(bstOffset, m_bufTable); } return(bst); }
public override OTTable GenerateTable() { // create a Motorola Byte Order buffer for the new table MBOBuffer newbuf = new MBOBuffer((uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(Table_EBSC.bitmapScaleTable.length * m_numSizes)); // populate the buffer newbuf.SetFixed(m_version, (uint)Table_EBSC.FieldOffsets.version); newbuf.SetUint(m_numSizes, (uint)Table_EBSC.FieldOffsets.numSizes); for (uint i = 0; i < m_numSizes; i++) { bitmapScaleTable bst = (bitmapScaleTable)m_bitmapScaleTables[(int)i]; newbuf.SetSbyte(bst.hori.ascender, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length)); newbuf.SetSbyte(bst.hori.descender, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 1); newbuf.SetByte(bst.hori.widthMax, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 2); newbuf.SetSbyte(bst.hori.caretSlopeNumerator, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 3); newbuf.SetSbyte(bst.hori.caretSlopeDenominator, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 4); newbuf.SetSbyte(bst.hori.caretOffset, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 5); newbuf.SetSbyte(bst.hori.minOriginSB, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 6); newbuf.SetSbyte(bst.hori.minAdvanceSB, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 7); newbuf.SetSbyte(bst.hori.maxBeforeBL, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 8); newbuf.SetSbyte(bst.hori.minAfterBL, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 9); newbuf.SetSbyte(bst.hori.pad1, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 10); newbuf.SetSbyte(bst.hori.pad2, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 11); newbuf.SetSbyte(bst.vert.ascender, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 12); newbuf.SetSbyte(bst.vert.descender, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 13); newbuf.SetByte(bst.vert.widthMax, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 14); newbuf.SetSbyte(bst.vert.caretSlopeNumerator, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 15); newbuf.SetSbyte(bst.vert.caretSlopeDenominator, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 16); newbuf.SetSbyte(bst.vert.caretOffset, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 17); newbuf.SetSbyte(bst.vert.minOriginSB, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 18); newbuf.SetSbyte(bst.vert.minAdvanceSB, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 19); newbuf.SetSbyte(bst.vert.maxBeforeBL, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 20); newbuf.SetSbyte(bst.vert.minAfterBL, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 21); newbuf.SetSbyte(bst.vert.pad1, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 22); newbuf.SetSbyte(bst.vert.pad2, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 23); newbuf.SetByte(bst.ppemX, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 24); newbuf.SetByte(bst.ppemY, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 25); newbuf.SetByte(bst.substitutePpemX, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 26); newbuf.SetByte(bst.substitutePpemY, (uint)Table_EBSC.FieldOffsets.FirstBitmapScaleTable + (uint)(i * Table_EBSC.bitmapScaleTable.length) + 27); } // put the buffer into a Table_EBSC object and return it Table_EBSC EBSCTable = new Table_EBSC("EBSC", newbuf); return(EBSCTable); }
public bitmapScaleTable getBitmapScaleTable(uint nIndex) { bitmapScaleTable bst = null; if (nIndex > m_numSizes) { throw new ArgumentOutOfRangeException("Index is greater than number of sizes."); } else { bst = (bitmapScaleTable)m_bitmapScaleTables[(int)nIndex]; } return(bst); }
/************************ * public methods */ public bool Validate(Validator v, OTFontVal fontOwner) { bool bRet = true; if (v.PerformTest(T.EBSC_version)) { if (version.GetUint() == 0x00020000) { v.Pass(T.EBSC_version, P.EBSC_P_version, m_tag); } else { v.Error(T.EBSC_version, E.EBSC_E_version, m_tag, "version = 0x" + version.GetUint().ToString("x8") + ", unable to continue validation"); return(false); } } if (v.PerformTest(T.EBSC_TableLength)) { uint CalcLength = 8 + (numSizes * 28); if (CalcLength == GetLength()) { v.Pass(T.EBSC_TableLength, P.EBSC_P_TableLength, m_tag); } else { string s = "actual length = " + GetLength() + ", calculated = " + CalcLength; v.Error(T.EBSC_TableLength, E.EBSC_E_TableLength, m_tag, s); bRet = false; } } if (v.PerformTest(T.EBSC_TableDependency)) { Table_EBLC EBLCTable = (Table_EBLC)fontOwner.GetTable("EBLC"); Table_EBDT EBDTTable = (Table_EBDT)fontOwner.GetTable("EBDT"); if (EBLCTable != null && EBDTTable != null) { v.Pass(T.EBSC_TableDependency, P.EBSC_P_TableDependency, m_tag); } else { string s = "Missing: "; if (EBLCTable == null) { s = s + "EBLC"; } if (EBDTTable == null) { if (EBLCTable == null) { s = s + ", EBDT"; } else { s = s + "EBDT"; } } v.Error(T.EBSC_TableDependency, E.EBSC_E_TableDependency, m_tag, s); bRet = false; } } if (v.PerformTest("EBSC_StrikeSizes")) { Table_EBLC EBLCTable = (Table_EBLC)fontOwner.GetTable("EBLC"); if (EBLCTable != null) { string s = "Missing strike: "; bool bPass = true; for (uint i = 0; i < numSizes; i++) { bitmapScaleTable bitmapScale = GetBitmapScaleTable(i); if (bitmapScale != null) { bool bFound = false; for (uint n = 0; n < EBLCTable.numSizes; n++) { Table_EBLC.bitmapSizeTable bitmapSize = EBLCTable.GetBitmapSizeTable(n); if (bitmapSize != null) { if (bitmapScale.substitutePpemX == bitmapSize.ppemX && bitmapScale.substitutePpemY == bitmapSize.ppemY) { bFound = true; break; } } } if (!bFound) { string size = "(PpemX:" + bitmapScale.substitutePpemX + ", PpemY:" + bitmapScale.substitutePpemY + ") "; s = s + size; bPass = false; } } } if (bPass) { v.Pass(T.EBSC_StrikeSizes, P.EBSC_P_StrikeSize, m_tag); } else { v.Error(T.EBSC_StrikeSizes, E.EBSC_E_StrikeSize, m_tag, s); } } else { v.Error(T.EBSC_StrikeSizes, E.EBSC_E_StrikeSizeNoEBLC, m_tag); } } return(bRet); }
static public bitmapScaleTableCache FromBitmapScaleTable(bitmapScaleTable bst) { bitmapScaleTableCache bstc = new bitmapScaleTableCache(); bstc.hori = Table_EBLC.EBLC_cache.sbitLineMetricsCache.FromSbitLineMetrics(bst.hori); bstc.vert = Table_EBLC.EBLC_cache.sbitLineMetricsCache.FromSbitLineMetrics(bst.vert); bstc.ppemX = bst.ppemX; bstc.ppemY = bst.ppemY; bstc.substitutePpemX = bst.substitutePpemX; bstc.substitutePpemY = bst.substitutePpemY; return bstc; }
public bool addBitmapScaleTable( bitmapScaleTable cBitmapScaleTable, uint nIndex ) { bool bResult = true; if( cBitmapScaleTable == null ) { bResult = false; throw new ArgumentNullException(); } else if( nIndex > m_numSizes ) { bResult = false; throw new ArgumentOutOfRangeException( "Index is greater than number of sizes." ); } else { bitmapScaleTableCache bstc = bitmapScaleTableCache.FromBitmapScaleTable(cBitmapScaleTable); m_bitmapScaleTables.Insert( (int)nIndex, bstc ); m_bDirty = true; } return bResult; }
public bitmapScaleTable GetBitmapScaleTable(uint i) { bitmapScaleTable bst = null; if (i < numSizes) { uint bstOffset = (uint)FieldOffsets.FirstBitmapScaleTable + i*bitmapScaleTable.length; bst = new bitmapScaleTable(bstOffset, m_bufTable); } return bst; }