protected int NumGlyph(OTFont fontOwner) { if (this.m_numGlyph == Table_loca.ValueInvalid) { Table_maxp tableMaxp = (Table_maxp)fontOwner.GetTable("maxp"); if (tableMaxp != null) { this.m_numGlyph = tableMaxp.NumGlyphs; } } return(this.m_numGlyph); }
/************************ * protected methods */ protected ushort GetNumGlyphs(OTFont fontOwner) { if (m_numGlyphs == 0) { Table_maxp maxpTable = (Table_maxp)fontOwner.GetTable("maxp"); if (maxpTable != null) { m_numGlyphs = maxpTable.NumGlyphs; } } Debug.Assert(m_numGlyphs != 0, "m_numGlyphs == 0"); return(m_numGlyphs); }
public ushort GetMaxpNumGlyphs() { // this routine caches the maxp.numGlyphs value for better performance if (m_maxpNumGlyphs == 0) { Table_maxp maxpTable = (Table_maxp)GetTable("maxp"); if (maxpTable != null) { m_maxpNumGlyphs = maxpTable.NumGlyphs; } else { throw new InvalidOperationException("maxp table missing or invalid"); } } return(m_maxpNumGlyphs); }
// generate a new table from the cached data public override OTTable GenerateTable() { // create a Motorola Byte Order buffer for the new table MBOBuffer newbuf; if (m_TableVersionNumber.GetUint() == 0x00000000) { newbuf = new MBOBuffer(6); newbuf.SetFixed(m_TableVersionNumber, (uint)Table_maxp.FieldOffsets.TableVersionNumber); newbuf.SetUshort(m_NumGlyphs, (uint)Table_maxp.FieldOffsets.NumGlyphs); } else { newbuf = new MBOBuffer(32); newbuf.SetFixed(m_TableVersionNumber, (uint)Table_maxp.FieldOffsets.TableVersionNumber); newbuf.SetUshort(m_NumGlyphs, (uint)Table_maxp.FieldOffsets.NumGlyphs); newbuf.SetUshort(m_maxPoints, (uint)Table_maxp.FieldOffsets.maxPoints); newbuf.SetUshort(m_maxContours, (uint)Table_maxp.FieldOffsets.maxContours); newbuf.SetUshort(m_maxCompositePoints, (uint)Table_maxp.FieldOffsets.maxCompositePoints); newbuf.SetUshort(m_maxCompositeContours, (uint)Table_maxp.FieldOffsets.maxCompositeContours); newbuf.SetUshort(m_maxZones, (uint)Table_maxp.FieldOffsets.maxZones); newbuf.SetUshort(m_maxTwilightPoints, (uint)Table_maxp.FieldOffsets.maxTwilightPoints); newbuf.SetUshort(m_maxStorage, (uint)Table_maxp.FieldOffsets.maxStorage); newbuf.SetUshort(m_maxFunctionDefs, (uint)Table_maxp.FieldOffsets.maxFunctionDefs); newbuf.SetUshort(m_maxInstructionDefs, (uint)Table_maxp.FieldOffsets.maxInstructionDefs); newbuf.SetUshort(m_maxStackElements, (uint)Table_maxp.FieldOffsets.maxStackElements); newbuf.SetUshort(m_maxSizeOfInstructions, (uint)Table_maxp.FieldOffsets.maxSizeOfInstructions); newbuf.SetUshort(m_maxComponentElements, (uint)Table_maxp.FieldOffsets.maxComponentElements); newbuf.SetUshort(m_maxComponentDepth, (uint)Table_maxp.FieldOffsets.maxComponentDepth); } // put the buffer into a Table_maxp object and return it Table_maxp maxpTable = new Table_maxp("maxp", newbuf); return(maxpTable); }
// constructor public maxp_cache(Table_maxp OwnerTable) { // copy the data from the owner table's MBOBuffer // and store it in the cache variables m_TableVersionNumber = OwnerTable.TableVersionNumber; m_NumGlyphs = OwnerTable.NumGlyphs; if (m_TableVersionNumber.GetUint() == 0x00010000) { m_maxPoints = OwnerTable.maxPoints; m_maxContours = OwnerTable.maxContours; m_maxCompositePoints = OwnerTable.maxCompositePoints; m_maxCompositeContours = OwnerTable.maxCompositeContours; m_maxZones = OwnerTable.maxZones; m_maxTwilightPoints = OwnerTable.maxTwilightPoints; m_maxStorage = OwnerTable.maxStorage; m_maxFunctionDefs = OwnerTable.maxFunctionDefs; m_maxInstructionDefs = OwnerTable.maxInstructionDefs; m_maxStackElements = OwnerTable.maxStackElements; m_maxSizeOfInstructions = OwnerTable.maxSizeOfInstructions; m_maxComponentElements = OwnerTable.maxComponentElements; m_maxComponentDepth = OwnerTable.maxComponentDepth; } }
public virtual OTTable CreateTableObject(OTTag tag, MBOBuffer buf) { OTTable table = null; string sName = GetUnaliasedTableName(tag); switch (sName) { case "BASE": table = new Table_BASE(tag, buf); break; case "CFF ": table = new Table_CFF(tag, buf); break; case "cmap": table = new Table_cmap(tag, buf); break; case "cvt ": table = new Table_cvt(tag, buf); break; case "DSIG": table = new Table_DSIG(tag, buf); break; case "EBDT": table = new Table_EBDT(tag, buf); break; case "EBLC": table = new Table_EBLC(tag, buf); break; case "EBSC": table = new Table_EBSC(tag, buf); break; case "fpgm": table = new Table_fpgm(tag, buf); break; case "gasp": table = new Table_gasp(tag, buf); break; case "GDEF": table = new Table_GDEF(tag, buf); break; case "glyf": table = new Table_glyf(tag, buf); break; case "GPOS": table = new Table_GPOS(tag, buf); break; case "GSUB": table = new Table_GSUB(tag, buf); break; case "hdmx": table = new Table_hdmx(tag, buf); break; case "head": table = new Table_head(tag, buf); break; case "hhea": table = new Table_hhea(tag, buf); break; case "hmtx": table = new Table_hmtx(tag, buf); break; case "JSTF": table = new Table_JSTF(tag, buf); break; case "kern": table = new Table_kern(tag, buf); break; case "loca": table = new Table_loca(tag, buf); break; case "LTSH": table = new Table_LTSH(tag, buf); break; case "maxp": table = new Table_maxp(tag, buf); break; case "name": table = new Table_name(tag, buf); break; case "OS/2": table = new Table_OS2(tag, buf); break; case "PCLT": table = new Table_PCLT(tag, buf); break; case "post": table = new Table_post(tag, buf); break; case "prep": table = new Table_prep(tag, buf); break; case "VDMX": table = new Table_VDMX(tag, buf); break; case "vhea": table = new Table_vhea(tag, buf); break; case "vmtx": table = new Table_vmtx(tag, buf); break; case "VORG": table = new Table_VORG(tag, buf); break; //case "Zapf": table = new Table_Zapf(tag, buf); break; default: table = new Table__Unknown(tag, buf); break; } return(table); }
public virtual OTTable CreateTableObject(OTTag tag, MBOBuffer buf) { OTTable table = null; string sName = GetUnaliasedTableName(tag); switch (sName) { case "BASE": table = new Table_BASE(tag, buf); break; case "CFF ": table = new Table_CFF(tag, buf); break; case "cmap": table = new Table_cmap(tag, buf); break; case "cvt ": table = new Table_cvt(tag, buf); break; case "DSIG": table = new Table_DSIG(tag, buf); break; case "EBDT": table = new Table_EBDT(tag, buf); break; case "EBLC": table = new Table_EBLC(tag, buf); break; case "EBSC": table = new Table_EBSC(tag, buf); break; case "fpgm": table = new Table_fpgm(tag, buf); break; case "gasp": table = new Table_gasp(tag, buf); break; case "GDEF": table = new Table_GDEF(tag, buf); break; case "glyf": table = new Table_glyf(tag, buf); break; case "GPOS": table = new Table_GPOS(tag, buf); break; case "GSUB": table = new Table_GSUB(tag, buf); break; case "hdmx": table = new Table_hdmx(tag, buf); break; case "head": table = new Table_head(tag, buf); break; case "hhea": table = new Table_hhea(tag, buf); break; case "hmtx": table = new Table_hmtx(tag, buf); break; case "JSTF": table = new Table_JSTF(tag, buf); break; case "kern": table = new Table_kern(tag, buf); break; case "loca": table = new Table_loca(tag, buf); break; case "LTSH": table = new Table_LTSH(tag, buf); break; case "maxp": table = new Table_maxp(tag, buf); break; case "name": table = new Table_name(tag, buf); break; case "OS/2": table = new Table_OS2(tag, buf); break; case "PCLT": table = new Table_PCLT(tag, buf); break; case "post": table = new Table_post(tag, buf); break; case "prep": table = new Table_prep(tag, buf); break; case "VDMX": table = new Table_VDMX(tag, buf); break; case "vhea": table = new Table_vhea(tag, buf); break; case "vmtx": table = new Table_vmtx(tag, buf); break; case "VORG": table = new Table_VORG(tag, buf); break; //case "Zapf": table = new Table_Zapf(tag, buf); break; default: table = new Table__Unknown(tag, buf); break; } return table; }
// generate a new table from the cached data public override OTTable GenerateTable() { // create a Motorola Byte Order buffer for the new table MBOBuffer newbuf; if( m_TableVersionNumber.GetUint() == 0x00000000 ) { newbuf = new MBOBuffer(6); newbuf.SetFixed (m_TableVersionNumber, (uint)Table_maxp.FieldOffsets.TableVersionNumber); newbuf.SetUshort (m_NumGlyphs, (uint)Table_maxp.FieldOffsets.NumGlyphs); } else { newbuf = new MBOBuffer(32); newbuf.SetFixed (m_TableVersionNumber, (uint)Table_maxp.FieldOffsets.TableVersionNumber); newbuf.SetUshort (m_NumGlyphs, (uint)Table_maxp.FieldOffsets.NumGlyphs); newbuf.SetUshort (m_maxPoints, (uint)Table_maxp.FieldOffsets.maxPoints); newbuf.SetUshort (m_maxContours, (uint)Table_maxp.FieldOffsets.maxContours); newbuf.SetUshort (m_maxCompositePoints, (uint)Table_maxp.FieldOffsets.maxCompositePoints); newbuf.SetUshort (m_maxCompositeContours, (uint)Table_maxp.FieldOffsets.maxCompositeContours); newbuf.SetUshort (m_maxZones, (uint)Table_maxp.FieldOffsets.maxZones); newbuf.SetUshort (m_maxTwilightPoints, (uint)Table_maxp.FieldOffsets.maxTwilightPoints); newbuf.SetUshort (m_maxStorage, (uint)Table_maxp.FieldOffsets.maxStorage); newbuf.SetUshort (m_maxFunctionDefs, (uint)Table_maxp.FieldOffsets.maxFunctionDefs); newbuf.SetUshort (m_maxInstructionDefs, (uint)Table_maxp.FieldOffsets.maxInstructionDefs); newbuf.SetUshort (m_maxStackElements, (uint)Table_maxp.FieldOffsets.maxStackElements); newbuf.SetUshort (m_maxSizeOfInstructions, (uint)Table_maxp.FieldOffsets.maxSizeOfInstructions); newbuf.SetUshort (m_maxComponentElements, (uint)Table_maxp.FieldOffsets.maxComponentElements); newbuf.SetUshort (m_maxComponentDepth, (uint)Table_maxp.FieldOffsets.maxComponentDepth); } // put the buffer into a Table_maxp object and return it Table_maxp maxpTable = new Table_maxp("maxp", newbuf); return maxpTable; }
// constructor public maxp_cache(Table_maxp OwnerTable) { // copy the data from the owner table's MBOBuffer // and store it in the cache variables m_TableVersionNumber = OwnerTable.TableVersionNumber; m_NumGlyphs = OwnerTable.NumGlyphs; if( m_TableVersionNumber.GetUint() == 0x00010000 ) { m_maxPoints = OwnerTable.maxPoints; m_maxContours = OwnerTable.maxContours; m_maxCompositePoints = OwnerTable.maxCompositePoints; m_maxCompositeContours = OwnerTable.maxCompositeContours; m_maxZones = OwnerTable.maxZones; m_maxTwilightPoints = OwnerTable.maxTwilightPoints; m_maxStorage = OwnerTable.maxStorage; m_maxFunctionDefs = OwnerTable.maxFunctionDefs; m_maxInstructionDefs = OwnerTable.maxInstructionDefs; m_maxStackElements = OwnerTable.maxStackElements; m_maxSizeOfInstructions = OwnerTable.maxSizeOfInstructions; m_maxComponentElements = OwnerTable.maxComponentElements; m_maxComponentDepth = OwnerTable.maxComponentDepth; } }